Skip to content

Commit d1bdf11

Browse files
committed
Ensure all generated directories exist
1 parent c6e5158 commit d1bdf11

12 files changed

+25
-17
lines changed

src/Generators/Statements/EventGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function output(array $tree): array
4242
}
4343

4444
if (!$this->files->exists(dirname($path))) {
45-
$this->files->makeDirectory(dirname($path));
45+
$this->files->makeDirectory(dirname($path), 0755, true);
4646
}
4747

4848
$this->files->put(

src/Generators/Statements/FormRequestGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function output(array $tree): array
4949
}
5050

5151
if (!$this->files->exists(dirname($path))) {
52-
$this->files->makeDirectory(dirname($path));
52+
$this->files->makeDirectory(dirname($path), 0755, true);
5353
}
5454

5555
$this->files->put(

src/Generators/Statements/JobGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function output(array $tree): array
3838
}
3939

4040
if (!$this->files->exists(dirname($path))) {
41-
$this->files->makeDirectory(dirname($path));
41+
$this->files->makeDirectory(dirname($path), 0755, true);
4242
}
4343

4444
$this->files->put(

src/Generators/Statements/MailGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function output(array $tree): array
3838
}
3939

4040
if (!$this->files->exists(dirname($path))) {
41-
$this->files->makeDirectory(dirname($path));
41+
$this->files->makeDirectory(dirname($path), 0755, true);
4242
}
4343

4444
$this->files->put(

src/Generators/Statements/ViewGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function output(array $tree): array
3939
}
4040

4141
if (!$this->files->exists(dirname($path))) {
42-
$this->files->makeDirectory(dirname($path));
42+
$this->files->makeDirectory(dirname($path), 0755, true);
4343
}
4444

4545
$this->files->put(

src/Generators/TestGenerator.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ public function output(array $tree): array
4949
/** @var \Blueprint\Models\Controller $controller */
5050
foreach ($tree['controllers'] as $controller) {
5151
$path = $this->getPath($controller);
52+
53+
if (!$this->files->exists(dirname($path))) {
54+
$this->files->makeDirectory(dirname($path), 0755, true);
55+
}
56+
5257
$this->files->put(
5358
$path,
5459
$this->populateStub($stub, $controller)

tests/Feature/Generator/Statements/EventGeneratorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function output_writes_events()
8383
->with('app/Events/UserCreated.php')
8484
->andReturnFalse();
8585
$this->files->expects('makeDirectory')
86-
->with('app/Events');
86+
->with('app/Events', 0755, true);
8787
$this->files->expects('put')
8888
->with('app/Events/UserCreated.php', $this->fixture('events/user-created.php'));
8989

@@ -137,7 +137,7 @@ public function it_respects_configuration()
137137
->with('src/path/Events')
138138
->andReturnFalse();
139139
$this->files->expects('makeDirectory')
140-
->with('src/path/Events');
140+
->with('src/path/Events', 0755, true);
141141
$this->files->expects('exists')
142142
->with('src/path/Events/NewPost.php')
143143
->andReturnFalse();

tests/Feature/Generator/Statements/FormRequestGeneratorTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function output_writes_form_requests()
8080
->with('app/Http/Requests/PostIndexRequest.php')
8181
->andReturnFalse();
8282
$this->files->expects('makeDirectory')
83-
->with('app/Http/Requests');
83+
->with('app/Http/Requests', 0755, true);
8484
$this->files->expects('put')
8585
->with('app/Http/Requests/PostIndexRequest.php', $this->fixture('form-requests/post-index.php'));
8686

@@ -143,7 +143,7 @@ public function output_supports_nested_form_requests()
143143
->with('app/Http/Requests/Admin/UserStoreRequest.php')
144144
->andReturnFalse();
145145
$this->files->expects('makeDirectory')
146-
->with('app/Http/Requests/Admin');
146+
->with('app/Http/Requests/Admin', 0755, true);
147147
$this->files->expects('put')
148148
->with('app/Http/Requests/Admin/UserStoreRequest.php', $this->fixture('form-requests/nested-components.php'));
149149

@@ -172,7 +172,7 @@ public function it_respects_configuration()
172172
->with('src/path/Http/Requests/PostStoreRequest.php')
173173
->andReturnFalse();
174174
$this->files->expects('makeDirectory')
175-
->with('src/path/Http/Requests');
175+
->with('src/path/Http/Requests', 0755, true);
176176
$this->files->expects('put')
177177
->with('src/path/Http/Requests/PostStoreRequest.php', $this->fixture('form-requests/form-request-configured.php'));
178178

tests/Feature/Generator/Statements/JobGeneratorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function output_writes_jobs()
8383
->with('app/Jobs/CreateUser.php')
8484
->andReturnFalse();
8585
$this->files->expects('makeDirectory')
86-
->with('app/Jobs');
86+
->with('app/Jobs', 0755, true);
8787
$this->files->expects('put')
8888
->with('app/Jobs/CreateUser.php', $this->fixture('jobs/create-user.php'));
8989

@@ -140,7 +140,7 @@ public function it_respects_configuration()
140140
->with('src/path/Jobs/SyncMedia.php')
141141
->andReturnFalse();
142142
$this->files->expects('makeDirectory')
143-
->with('src/path/Jobs');
143+
->with('src/path/Jobs', 0755, true);
144144
$this->files->expects('put')
145145
->with('src/path/Jobs/SyncMedia.php', $this->fixture('jobs/job-configured.php'));
146146

tests/Feature/Generator/Statements/MailGeneratorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public function output_writes_mails()
8383
->with('app/Mail/ReviewPost.php')
8484
->andReturnFalse();
8585
$this->files->expects('makeDirectory')
86-
->with('app/Mail');
86+
->with('app/Mail', 0755, true);
8787
$this->files->expects('put')
8888
->with('app/Mail/ReviewPost.php', $this->fixture('mailables/review-post.php'));
8989

@@ -140,7 +140,7 @@ public function it_respects_configuration()
140140
->with('src/path/Mail/ReviewNotification.php')
141141
->andReturnFalse();
142142
$this->files->expects('makeDirectory')
143-
->with('src/path/Mail');
143+
->with('src/path/Mail', 0755, true);
144144
$this->files->expects('put')
145145
->with('src/path/Mail/ReviewNotification.php', $this->fixture('mailables/mail-configured.php'));
146146

0 commit comments

Comments
 (0)