@@ -42,7 +42,7 @@ var _ = Describe("TileWriter", func() {
4242 ProductName : "cool-product-name" ,
4343 FilenamePrefix : "cool-product-file" ,
4444 ReleaseTarballs : []string {"/some/path/release-1.tgz" , "/some/path/release-2.tgz" },
45- MigrationsDirectory : "/some/path/migrations" ,
45+ MigrationDirectories : [] string { "/some/path/migrations" , "/some/other/ path/migrations" } ,
4646 ContentMigrations : []string {"/some/path/content-migration-1.yml" , "/some/path/content-migration-2.yml" },
4747 BaseContentMigration : "/some/path/base-content-migration.yml" ,
4848 Version : "1.2.3-build.4" ,
@@ -59,9 +59,17 @@ var _ = Describe("TileWriter", func() {
5959 migrationInfo .IsDirReturns (false )
6060
6161 filesystem .WalkStub = func (root string , walkFn filepath.WalkFunc ) error {
62- walkFn ("/some/path/migrations" , dirInfo , nil )
63- walkFn ("/some/path/migrations/migration-1.js" , migrationInfo , nil )
64- walkFn ("/some/path/migrations/migration-2.js" , migrationInfo , nil )
62+ switch root {
63+ case "/some/path/migrations" :
64+ walkFn ("/some/path/migrations" , dirInfo , nil )
65+ walkFn ("/some/path/migrations/migration-1.js" , migrationInfo , nil )
66+ walkFn ("/some/path/migrations/migration-2.js" , migrationInfo , nil )
67+ case "/some/other/path/migrations" :
68+ walkFn ("/some/other/path/migrations" , dirInfo , nil )
69+ walkFn ("/some/other/path/migrations/other-migration.js" , migrationInfo , nil )
70+ default :
71+ return nil
72+ }
6573 return nil
6674 }
6775
@@ -75,6 +83,8 @@ var _ = Describe("TileWriter", func() {
7583 return NewBuffer (bytes .NewBuffer ([]byte ("migration-1" ))), nil
7684 case "/some/path/migrations/migration-2.js" :
7785 return NewBuffer (bytes .NewBuffer ([]byte ("migration-2" ))), nil
86+ case "/some/other/path/migrations/other-migration.js" :
87+ return NewBuffer (bytes .NewBuffer ([]byte ("other-migration" ))), nil
7888 default :
7989 return nil , fmt .Errorf ("open %s: no such file or directory" , path )
8090 }
@@ -93,7 +103,7 @@ var _ = Describe("TileWriter", func() {
93103 Expect (zipper .SetPathCall .CallCount ).To (Equal (1 ))
94104 Expect (zipper .SetPathCall .Receives .Path ).To (Equal ("cool-product-file-1.2.3-build.4.pivotal" ))
95105
96- Expect (zipper .AddCall .Calls ).To (HaveLen (6 ))
106+ Expect (zipper .AddCall .Calls ).To (HaveLen (7 ))
97107
98108 Expect (zipper .AddCall .Calls [0 ].Path ).To (Equal (filepath .Join ("content_migrations" , "migrations.yml" )))
99109 Eventually (gbytes .BufferReader (zipper .AddCall .Calls [0 ].File )).Should (gbytes .Say ("combined-content-migration-contents" ))
@@ -107,11 +117,14 @@ var _ = Describe("TileWriter", func() {
107117 Expect (zipper .AddCall .Calls [3 ].Path ).To (Equal (filepath .Join ("migrations" , "v1" , "migration-2.js" )))
108118 Eventually (gbytes .BufferReader (zipper .AddCall .Calls [3 ].File )).Should (gbytes .Say ("migration-2" ))
109119
110- Expect (zipper .AddCall .Calls [4 ].Path ).To (Equal (filepath .Join ("releases" , "release-1.tgz" )))
111- Eventually (gbytes .BufferReader (zipper .AddCall .Calls [4 ].File )).Should (gbytes .Say (release1Content ))
120+ Expect (zipper .AddCall .Calls [4 ].Path ).To (Equal (filepath .Join ("migrations" , "v1" , "other-migration.js" )))
121+ Eventually (gbytes .BufferReader (zipper .AddCall .Calls [4 ].File )).Should (gbytes .Say ("other-migration" ))
122+
123+ Expect (zipper .AddCall .Calls [5 ].Path ).To (Equal (filepath .Join ("releases" , "release-1.tgz" )))
124+ Eventually (gbytes .BufferReader (zipper .AddCall .Calls [5 ].File )).Should (gbytes .Say (release1Content ))
112125
113- Expect (zipper .AddCall .Calls [5 ].Path ).To (Equal (filepath .Join ("releases" , "release-2.tgz" )))
114- Eventually (gbytes .BufferReader (zipper .AddCall .Calls [5 ].File )).Should (gbytes .Say (release2Content ))
126+ Expect (zipper .AddCall .Calls [6 ].Path ).To (Equal (filepath .Join ("releases" , "release-2.tgz" )))
127+ Eventually (gbytes .BufferReader (zipper .AddCall .Calls [6 ].File )).Should (gbytes .Say (release2Content ))
115128
116129 Expect (zipper .CloseCall .CallCount ).To (Equal (1 ))
117130
@@ -122,6 +135,7 @@ var _ = Describe("TileWriter", func() {
122135 "Adding metadata/cool-product-name.yml to .pivotal..." ,
123136 "Adding migrations/v1/migration-1.js to .pivotal..." ,
124137 "Adding migrations/v1/migration-2.js to .pivotal..." ,
138+ "Adding migrations/v1/other-migration.js to .pivotal..." ,
125139 "Adding releases/release-1.tgz to .pivotal..." ,
126140 "Adding releases/release-2.tgz to .pivotal..." ,
127141 "Calculated md5 sum: THIS-IS-THE-SUM" ,
@@ -140,7 +154,7 @@ var _ = Describe("TileWriter", func() {
140154 ProductName : "cool-product-name" ,
141155 FilenamePrefix : "cool-product-file" ,
142156 ReleaseTarballs : []string {"/some/path/release-1.tgz" , "/some/path/release-2.tgz" },
143- MigrationsDirectory : "" ,
157+ MigrationDirectories : [] string {} ,
144158 ContentMigrations : []string {},
145159 BaseContentMigration : "" ,
146160 Version : "1.2.3-build.4" ,
@@ -177,7 +191,7 @@ var _ = Describe("TileWriter", func() {
177191 ProductName : "cool-product-name" ,
178192 FilenamePrefix : "cool-product-file" ,
179193 ReleaseTarballs : []string {"/some/path/release-1.tgz" , "/some/path/release-2.tgz" },
180- MigrationsDirectory : "/some/path/migrations" ,
194+ MigrationDirectories : [] string { "/some/path/migrations" } ,
181195 ContentMigrations : []string {},
182196 BaseContentMigration : "" ,
183197 Version : "1.2.3-build.4" ,
@@ -250,9 +264,9 @@ var _ = Describe("TileWriter", func() {
250264 }
251265
252266 config := commands.BakeConfig {
253- ReleaseTarballs : []string {"/some/path/release-1.tgz" },
254- MigrationsDirectory : "/some/path/migrations" ,
255- StubReleases : true ,
267+ ReleaseTarballs : []string {"/some/path/release-1.tgz" },
268+ MigrationDirectories : [] string { "/some/path/migrations" } ,
269+ StubReleases : true ,
256270 }
257271
258272 err := tileWriter .Write ([]byte {}, config )
0 commit comments