@@ -101,8 +101,14 @@ func (b *Book) Checkout(step string) error {
101
101
terminal .Println ("<info>[ OK ]</>" )
102
102
}
103
103
104
+ _ , err = os .Stat (filepath .Join (b .Dir , "docker-compose.yaml" ))
105
+ hasDocker := err == nil
106
+ if ! hasDocker {
107
8000
+ _ , err = os .Stat (filepath .Join (b .Dir , "docker-compose.yml" ))
108
+ hasDocker = err == nil
109
+ }
104
110
printBanner ("<comment>[WEB]</> Stopping Docker Containers" , b .Debug )
105
- if _ , err := os . Stat ( filepath . Join ( b . Dir , "docker-compose.yaml" )); err == nil {
111
+ if hasDocker {
106
112
if err := executeCommand ([]string {"docker-compose" , "down" , "--remove-orphans" }, b .Debug , false , nil ); err != nil {
107
113
return err
108
114
}
@@ -145,7 +151,7 @@ func (b *Book) Checkout(step string) error {
145
151
}
146
152
147
153
printBanner ("<comment>[WEB]</> Starting Docker Compose" , b .Debug )
148
- if _ , err := os . Stat ( filepath . Join ( b . Dir , "docker-compose.yaml" )); err == nil {
154
+ if hasDocker {
149
155
if err := executeCommand ([]string {"docker-compose" , "up" , "-d" }, b .Debug , false , nil ); err != nil {
150
156
return err
151
157
}
@@ -165,18 +171,18 @@ func (b *Book) Checkout(step string) error {
165
171
}
166
172
167
173
printBanner ("<comment>[WEB]</> Migrating the database
8000
" , b .Debug )
168
- if _ , err := os .Stat (filepath .Join (b .Dir , "src" , "Migrations" )); err == nil {
174
+ files , err := filepath .Glob (filepath .Join (b .Dir , "src" , "Migrations" , "*.php" ))
175
+ hasMigrations := err == nil && len (files ) > 0
176
+ if ! hasMigrations {
177
+ files , err = filepath .Glob (filepath .Join (b .Dir , "migrations" , "*.php" ))
178
+ hasMigrations = err == nil && len (files ) > 0
179
+ }
180
+ if hasMigrations {
169
181
if err := executeCommand ([]string {"symfony" , "console" , "doctrine:migrations:migrate" , "-n" }, b .Debug , false , nil ); err != nil {
170
182
return err
171
183
}
172
184
} else {
173
- if _ , err := os .Stat (filepath .Join (b .Dir , "migrations" )); err == nil {
174
- if err := executeCommand ([]string {"symfony" , "console" , "doctrine:migrations:migrate" , "-n" }, b .Debug , false , nil ); err != nil {
175
- return err
176
- }
177
- } else {
178
- terminal .Println ("Skipped for this step" )
179
- }
185
+ terminal .Println ("Skipped for this step" )
180
186
}
181
187
182
188
printBanner ("<comment>[WEB]</> Inserting Fixtures" , b .Debug )
0 commit comments