Skip to content

Commit 819f04e

Browse files
authored
Merge pull request #36 from webfactor/fix-22
Fixes #22 - console output more relevant to developer
2 parents aa397c1 + 52eabf5 commit 819f04e

23 files changed

+179
-29
lines changed

src/Commands/MakeEntity.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,13 @@ public function handle()
4747

4848
private function loadSchema()
4949
{
50-
$this->info('Load Schema');
50+
$this->info('Loading Schema');
5151
$this->schema = new Schema($this->option('schema'));
52-
$this->info('Schema loaded');
53-
$this->line('');
5452
}
5553

5654
private function loadNaming()
5755
{
58-
$this->info('Load Naming Classes');
56+
$this->info('Loading Naming Classes');
5957

6058
$namingClasses = config('webfactor.generators.naming');
6159
$count = count($namingClasses);
@@ -68,7 +66,6 @@ private function loadNaming()
6866
$this->naming[$key] = $namingObject;
6967
}
7068

71-
$this->info('Naming Classes loaded');
7269
$this->line('');
7370
}
7471

@@ -77,15 +74,14 @@ private function loadServices()
7774
$services = $this->getServicesToBeExecuted();
7875
$progressBar = $this->output->createProgressBar(count($services));
7976

80-
foreach ($services as $serviceClass) {
81-
$progressBar->advance();
82-
$this->info(' Call: ' . $serviceClass);
77+
foreach ($services as $k => $serviceClass) {
78+
$serviceInstance = new $serviceClass($this);
79+
$this->executeService($serviceInstance);
8380

84-
$this->executeService(new $serviceClass($this));
81+
$progressBar->advance();
82+
$this->info(' '.$serviceInstance->getConsoleOutput());
8583
}
8684

87-
$progressBar->finish();
88-
$this->info(' Service Classes loaded');
8985
$this->line('');
9086
}
9187

src/Contracts/ServiceAbstract.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,9 @@ private function getSplFile(string $pathToFile): \SplFileInfo
4343

4444
return null;
4545
}
46+
47+
public function getConsoleOutput()
48+
{
49+
return 'Handling ' . $this->key;
50+
}
4651
}

src/Schemas/Naming/CrudController.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
class CrudController extends NamingAbstract
88
{
9+
private $path = 'Http/Controllers/Admin';
10+
911
/**
1012
* @return string
1113
*/
@@ -35,7 +37,15 @@ public function getFileName(): string
3537
*/
3638
public function getPath(): string
3739
{
38-
return app_path('Http/Controllers/Admin');
40+
return app_path($this->path);
41+
}
42+
43+
/**
44+
* @return string
45+
*/
46+
public function getRelativeFilePath(): string
47+
{
48+
return str_replace("\\", '/', $this->getAppNamespace()).$this->path.'/'.$this->getFileName();
3949
}
4050

4151
/**

src/Schemas/Naming/CrudModel.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
class CrudModel extends NamingAbstract
88
{
9+
private $path = 'Models';
10+
911
/**
1012
* @return string
1113
*/
@@ -35,7 +37,15 @@ public function getFileName(): string
3537
*/
3638
public function getPath(): string
3739
{
38-
return app_path('Models');
40+
return app_path($this->path);
41+
}
42+
43+
/**
44+
* @return string
45+
*/
46+
public function getRelativeFilePath(): string
47+
{
48+
return str_replace("\\", '/', $this->getAppNamespace()).$this->path.'/'.$this->getFileName();
3949
}
4050

4151
/**

src/Schemas/Naming/CrudRequest.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
class CrudRequest extends NamingAbstract
88
{
9+
private $path = 'Http/Requests/Admin';
10+
911
/**
1012
* @return string
1113
*/
@@ -35,7 +37,15 @@ public function getFileName(): string
3537
*/
3638
public function getPath(): string
3739
{
38-
return app_path('Http/Requests/Admin');
40+
return app_path($this->path);
41+
}
42+
43+
/**
44+
* @return string
45+
*/
46+
public function getRelativeFilePath(): string
47+
{
48+
return str_replace("\\", '/', $this->getAppNamespace()).$this->path.'/'.$this->getFileName();
3949
}
4050

4151
/**

src/Schemas/Naming/Factory.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ public function getPath(): string
3030
return database_path('factories');
3131
}
3232

33+
/**
34+
* @return string
35+
*/
36+
public function getRelativeFilePath(): string
37+
{
38+
return 'database/factories/'.$this->getFileName();
39+
}
40+
3341
/**
3442
* @return string
3543
*/

src/Schemas/Naming/LanguageFile.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,4 +45,12 @@ public function getPath(): string
4545
{
4646
return resource_path('lang/' . \Lang::locale());
4747
}
48+
49+
/**
50+
* @return string
51+
*/
52+
public function getRelativeFilePath(): string
53+
{
54+
return 'resources/lang/'.\Lang::locale().'/'.$this->getFileName();
55+
}
4856
}

src/Schemas/Naming/Migration.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ public function getPath(): string
6060
return database_path('migrations');
6161
}
6262

63+
/**
64+
* @return string
65+
*/
66+
public function getRelativeFilePath(): string
67+
{
68+
return 'database/migrations/'.$this->getFileName();
69+
}
70+
6371
/**
6472
* @return string
6573
*/

src/Schemas/Naming/RouteFile.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,12 @@ public function getPath(): string
2929
{
3030
return base_path('routes/backpack');
3131
}
32+
33+
/**
34+
* @return string
35+
*/
36+
public function getRelativeFilePath(): string
37+
{
38+
return 'routes/backpack/'.$this->getFileName();
39+
}
3240
}

src/Schemas/Naming/Seeder.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ public function getPath(): string
3838
return database_path('seeds');
3939
}
4040

41+
/**
42+
* @return string
43+
*/
44+
public function getRelativeFilePath(): string
45+
{
46+
return 'database/seeds/'.$this->getFileName();
47+
}
48+
4149
/**
4250
* @return string
4351
*/

0 commit comments

Comments
 (0)