Skip to content

Commit 59561d0

Browse files
authored
Merge pull request #125 from netlify/rename-asset-mgmt
Rename asset management to large media (and LFS)
2 parents 76e1fa5 + f0beb37 commit 59561d0

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

go/models/deploy_site_capabilities.go

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go/porcelain/deploy.go

+7-7
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func newDeployFiles() *deployFiles {
121121
func (d *deployFiles) Add(p string, f *FileBundle) {
122122
d.Files[p] = f
123123
d.Sums[p] = f.Sum
124-
// Remove ":original_sha" part when to save in Hashed (asset management)
124+
// Remove ":original_sha" part when to save in Hashed (large media)
125125
sum := f.Sum
126126
if strings.Contains(sum, ":") {
127127
sum = strings.Split(sum, ":")[0]
@@ -167,8 +167,8 @@ func (n *Netlify) DoDeploy(ctx context.Context, options *DeployOptions, deploy *
167167
}
168168
}
169169

170-
context.GetLogger(ctx).Infof("Getting files info with asset management flag: %v", deploy.SiteCapabilities.AssetManagement)
171-
files, err := walk(options.Dir, options.Observer, deploy.SiteCapabilities.AssetManagement)
170+
context.GetLogger(ctx).Infof("Getting files info with large media flag: %v", deploy.SiteCapabilities.LargeMedia)
171+
files, err := walk(options.Dir, options.Observer, deploy.SiteCapabilities.LargeMedia)
172172
if err != nil {
173173
if options.Observer != nil {
174174
options.Observer.OnFailedWalk()
@@ -458,7 +458,7 @@ func (n *Netlify) uploadFile(ctx context.Context, d *models.Deploy, f *FileBundl
458458
}
459459
}
460460

461-
func walk(dir string, observer DeployObserver, useAssetManagement bool) (*deployFiles, error) {
461+
func walk(dir string, observer DeployObserver, useLargeMedia bool) (*deployFiles, error) {
462462
files := newDeployFiles()
463463

464464
err := filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
@@ -494,13 +494,13 @@ func walk(dir string, observer DeployObserver, useAssetManagement bool) (*deploy
494494
}
495495
file.Sum = hex.EncodeToString(s.Sum(nil))
496496

497-
if useAssetManagement {
497+
if useLargeMedia {
498498
o, err := os.Open(path)
499499
if err != nil {
500500
return err
501501
}
502502
defer o.Close()
503-
originalSha := getAssetManagementSha(o)
503+
originalSha := getLFSSha(o)
504504
if originalSha != "" {
505505
file.Sum += ":" + string(originalSha)
506506
}
@@ -654,7 +654,7 @@ func createHeader(archive *zip.Writer, i os.FileInfo, runtime string) (io.Writer
654654
return archive.Create(i.Name())
655655
}
656656

657-
func getAssetManagementSha(file io.Reader) string {
657+
func getLFSSha(file io.Reader) string {
658658
// currently this only supports certain type of git lfs pointer files
659659
// version [version]\noid sha256:[oid]\nsize [size]
660660
data := make([]byte, 150)

go/porcelain/deploy_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"testing"
66
)
77

8-
func TestGetAssetManagementSha(t *testing.T) {
8+
func TestGetLFSSha(t *testing.T) {
99
tests := []struct {
1010
contents string
1111
length int
@@ -18,14 +18,14 @@ func TestGetAssetManagementSha(t *testing.T) {
1818

1919
for _, test := range tests {
2020
file := strings.NewReader(test.contents)
21-
out := getAssetManagementSha(file)
21+
out := getLFSSha(file)
2222
if len(out) != test.length {
2323
t.Fatalf("expected `%d`, got `%d`", test.length, len(out))
2424
}
2525
}
2626
}
2727

28-
func TestAddWithAssetManagement(t *testing.T) {
28+
func TestAddWithLargeMedia(t *testing.T) {
2929
files := newDeployFiles()
3030
tests := []struct {
3131
rel string

swagger.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1580,7 +1580,7 @@ definitions:
15801580
site_capabilities:
15811581
type: object
15821582
properties:
1583-
asset_management:
1583+
large_media:
15841584
type: boolean
15851585
deployFiles:
15861586
type: object

0 commit comments

Comments
 (0)