Skip to content

Commit

Permalink
cleanup configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
jadjoubran committed Jan 23, 2016
1 parent 189968f commit 2daa1a4
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions config/generators.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

return [
'source' => [
'main' => 'angular',
'root' => 'angular',
'page' => 'app/pages',
'components' => 'app/components',
'config' => 'config',
'dialogs' => 'dialogs',
'filters' => 'filters',
'services' => 'services',
],
'prefixFileNames' => [
'prefix' => [
'component' => '.component.js',
'componentView' => '.component.html',
'dialog' => '.dialog.js',
Expand Down
6 changes: 3 additions & 3 deletions src/Console/Commands/AngularComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function handle()
$js = str_replace('{{name}}', $name, $js);
$js = str_replace('{{componentName}}', $component_name, $js);

$folder = base_path(config('generators.source.main')).'/'.config('generators.source.components').'/'.$name;
$folder = base_path(config('generators.source.root')).'/'.config('generators.source.components').'/'.$name;
if (is_dir($folder)) {
$this->info('Folder already exists');

Expand All @@ -61,10 +61,10 @@ public function handle()
File::makeDirectory($folder, 0775, true);

//create view (.component.html)
File::put($folder.'/'.$name.config('generators.prefixFileNames.componentView'), $html);
File::put($folder.'/'.$name.config('generators.prefix.componentView'), $html);

//create component (.component.js)
File::put($folder.'/'.$name.config('generators.prefixFileNames.component'), $js);
File::put($folder.'/'.$name.config('generators.prefix.component'), $js);

//create less file (.less)
File::put($folder.'/'.$name.'.less', $less);
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/AngularConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function handle()

$js = file_get_contents(__DIR__.'/Stubs/AngularConfig/config.js.stub');

$folder = base_path(config('generators.source.main')).'/'.config('generators.source.config').'/';
$folder = base_path(config('generators.source.root')).'/'.config('generators.source.config').'/';

//create config (.js)
File::put($folder.'/'.$name.'.js', $js);
Expand Down
4 changes: 2 additions & 2 deletions src/Console/Commands/AngularDialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function handle()
$js = str_replace('{{StudlyName}}', $studly_name, $js);
$html = str_replace('{{HumanReadableName}}', $human_readable, $html);

$folder = base_path(config('generators.source.main')).'/'.config('generators.source.dialogs').'/'.$name;
$folder = base_path(config('generators.source.root')).'/'.config('generators.source.dialogs').'/'.$name;

if (is_dir($folder)) {
$this->info('Folder already exists');
Expand All @@ -64,7 +64,7 @@ public function handle()
File::put($folder.'/'.$name.'.html', $html);

//create controller (.js)
File::put($folder.'/'.$name.config('generators.prefixFileNames.dialog'), $js);
File::put($folder.'/'.$name.config('generators.prefix.dialog'), $js);

$this->info('Dialog created successfully.');
}
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/AngularFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function handle()

$js = str_replace('{{StudlyName}}', $studly_name, $js);

$folder = base_path(config('generators.source.main')).'/'.config('generators.source.filters');
$folder = base_path(config('generators.source.root')).'/'.config('generators.source.filters');

//create filter (.js)
File::put($folder.'/'.$name.'.js', $js);
Expand Down
2 changes: 1 addition & 1 deletion src/Console/Commands/AngularPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function handle()
$html = file_get_contents(__DIR__.'/Stubs/AngularPage/page.html.stub');
$less = file_get_contents(__DIR__.'/Stubs/AngularPage/page.less.stub');

$folder = base_path(config('generators.source.main')).'/'.config('generators.source.page').'/'.$name;
$folder = base_path(config('generators.source.root')).'/'.config('generators.source.page').'/'.$name;
if (is_dir($folder)) {
$this->info('Folder already exists');

Expand Down
4 changes: 2 additions & 2 deletions src/Console/Commands/AngularService.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ public function handle()

$js = str_replace('{{StudlyName}}', $studly_name, $js);

$folder = base_path(config('generators.source.main')).'/'.config('generators.source.services');
$folder = base_path(config('generators.source.root')).'/'.config('generators.source.services');

//create service (.js)
File::put($folder.'/'.$name.config('generators.prefixFileNames.service'), $js);
File::put($folder.'/'.$name.config('generators.prefix.service'), $js);

$this->info('Service created successfully.');
}
Expand Down

0 comments on commit 2daa1a4

Please sign in to comment.