Skip to content

Commit 13a97f6

Browse files
committed
Use Unix path separator
1 parent 6b98d99 commit 13a97f6

12 files changed

+25
-16
lines changed

src/Blueprint.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
namespace Blueprint;
44

5+
use Blueprint\Contracts\Generator;
56
use Blueprint\Contracts\Lexer;
67
use Illuminate\Support\Str;
78
use Symfony\Component\Yaml\Yaml;
8-
use Blueprint\Contracts\Generator;
99

1010
class Blueprint
1111
{
@@ -24,6 +24,11 @@ public static function relativeNamespace(string $fullyQualifiedClassName)
2424
return $reference;
2525
}
2626

27+
public static function appPath()
28+
{
29+
return str_replace('\\', '/', config('blueprint.app_path'));
30+
}
31+
2732
public function parse($content)
2833
{
2934
$content = str_replace(["\r\n", "\r"], "\n", $content);

src/Commands/TraceCommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ public function handle()
7777

7878
private function appClasses()
7979
{
80-
$dir = config('blueprint.app_path');
80+
$dir = Blueprint::appPath('app');
8181

8282
if (config('blueprint.models_namespace')) {
83-
$dir .= DIRECTORY_SEPARATOR . str_replace('\\', '/', config('blueprint.models_namespace'));
83+
$dir .= '/' . str_replace('\\', '/', config('blueprint.models_namespace'));
8484
}
8585

8686
if (!$this->files->exists($dir)) {
@@ -89,9 +89,9 @@ private function appClasses()
8989

9090
return array_map(function (\SplFIleInfo $file) {
9191
return str_replace(
92-
[config('blueprint.app_path') . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR],
92+
[Blueprint::appPath() . '/', '/'],
9393
[config('blueprint.namespace') . '\\', '\\'],
94-
$file->getPath() . DIRECTORY_SEPARATOR . $file->getBasename('.php')
94+
$file->getPath() . '/' . $file->getBasename('.php')
9595
);
9696
}, $this->files->allFiles($dir));
9797
}

src/FileMixins.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
<?php
22

3-
43
namespace Blueprint;
54

65
class FileMixins
@@ -11,7 +10,7 @@ public function stub()
1110
{
1211
return function ($path) {
1312
if (!isset($this->stubs[$path])) {
14-
$this->stubs[$path] = $this->get(STUBS_PATH . DIRECTORY_SEPARATOR . $path);
13+
$this->stubs[$path] = $this->get(STUBS_PATH . '/' . $path);
1514
}
1615

1716
return $this->stubs[$path];

src/Generators/ControllerGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ protected function getPath(Controller $controller)
167167
{
168168
$path = str_replace('\\', '/', Blueprint::relativeNamespace($controller->fullyQualifiedClassName()));
169169

170-
return config('blueprint.app_path') . '/' . $path . '.php';
170+
return Blueprint::appPath() . '/' . $path . '.php';
171171
}
172172

173173
private function addImport(Controller $controller, $class)

src/Generators/ModelGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ protected function getPath(Model $model)
157157
{
158158
$path = str_replace('\\', '/', Blueprint::relativeNamespace($model->fullyQualifiedClassName()));
159159

160-
return config('blueprint.app_path') . '/' . $path . '.php';
160+
return Blueprint::appPath() . '/' . $path . '.php';
161161
}
162162

163163
private function fillableColumns(array $columns)

src/Generators/Statements/EventGenerator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Blueprint\Generators\Statements;
44

5+
use Blueprint\Blueprint;
56
use Blueprint\Contracts\Generator;
67
use Blueprint\Models\Statements\FireStatement;
78

@@ -57,7 +58,7 @@ public function output(array $tree): array
5758

5859
protected function getPath(string $name)
5960
{
60-
return config('blueprint.app_path') . '/Events/' . $name . '.php';
61+
return Blueprint::appPath() . '/Events/' . $name . '.php';
6162
}
6263

6364
protected function populateStub(string $stub, FireStatement $fireStatement)

src/Generators/Statements/FormRequestGenerator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Blueprint\Generators\Statements;
44

5+
use Blueprint\Blueprint;
56
use Blueprint\Contracts\Generator;
67
use Blueprint\Models\Controller;
78
use Blueprint\Models\Statements\ValidateStatement;
@@ -64,7 +65,7 @@ public function output(array $tree): array
6465

6566
protected function getPath(Controller $controller, string $name)
6667
{
67-
return config('blueprint.app_path') . '/Http/Requests/' . ($controller->namespace() ? $controller->namespace() . '/' : '') . $name . '.php';
68+
return Blueprint::appPath() . '/Http/Requests/' . ($controller->namespace() ? $controller->namespace() . '/' : '') . $name . '.php';
6869
}
6970

7071
protected function populateStub(string $stub, string $name, $context, ValidateStatement $validateStatement, Controller $controller)

src/Generators/Statements/JobGenerator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Blueprint\Generators\Statements;
44

5+
use Blueprint\Blueprint;
56
use Blueprint\Contracts\Generator;
67
use Blueprint\Models\Statements\DispatchStatement;
78

@@ -53,7 +54,7 @@ public function output(array $tree): array
5354

5455
protected function getPath(string $name)
5556
{
56-
return config('blueprint.app_path') . '/Jobs/' . $name . '.php';
57+
return Blueprint::appPath() . '/Jobs/' . $name . '.php';
5758
}
5859

5960
protected function populateStub(string $stub, DispatchStatement $dispatchStatement)

src/Generators/Statements/MailGenerator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Blueprint\Generators\Statements;
44

5+
use Blueprint\Blueprint;
56
use Blueprint\Contracts\Generator;
67
use Blueprint\Models\Statements\SendStatement;
78

@@ -53,7 +54,7 @@ public function output(array $tree): array
5354

5455
protected function getPath(string $name)
5556
{
56-
return config('blueprint.app_path') . '/Mail/' . $name . '.php';
57+
return Blueprint::appPath() . '/Mail/' . $name . '.php';
5758
}
5859

5960
protected function populateStub(string $stub, SendStatement $sendStatement)

src/Generators/Statements/ResourceGenerator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Blueprint\Generators\Statements;
44

5+
use Blueprint\Blueprint;
56
use Blueprint\Contracts\Generator;
67
use Blueprint\Models\Controller;
78
use Blueprint\Models\Model;
@@ -61,7 +62,7 @@ public function output(array $tree): array
6162

6263
protected function getPath(string $name)
6364
{
64-
return config('blueprint.app_path').'/Http/Resources/'.$name.'.php';
65+
return Blueprint::appPath().'/Http/Resources/'.$name.'.php';
6566
}
6667

6768
protected function populateStub(string $stub, ResourceStatement $resource)

0 commit comments

Comments
 (0)