Skip to content

Commit df9c5af

Browse files
committed
Minor improvements; Code simplified
1 parent d5193e1 commit df9c5af

File tree

3 files changed

+44
-23
lines changed

3 files changed

+44
-23
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
nbproject/
1+
nbproject/
2+
.projectile

src/LaraBue.php

+40-21
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class LaraBue extends Preset
2020
*
2121
* @return void
2222
*/
23+
2324
public static function install()
2425
{
2526
static::cleanSassDirectory();
@@ -92,39 +93,57 @@ public static function updatePackageArray(array $packages)
9293

9394
public static function updateResources()
9495
{
95-
// FOR OLDER VERSIONS
96-
97-
if (static::grabAppVersion() <= 5.6) {
98-
// SASS stuff copying
96+
return (static::grabAppVersion() <= 5.6) ? static::updateOldResources() : static::updateNewResources();
97+
}
98+
99+
/**
100+
* Method for updating resources directory for Laravel less that 5.6 version
101+
*
102+
* @return void
103+
*/
104+
105+
106+
public static function updateOldResources()
107+
{
108+
// SASS stuff copying
99109

100-
copy(__DIR__ . '/stubs/sass/app.scss', resource_path('assets/sass/app.scss'));
110+
copy(__DIR__ . '/stubs/sass/app.scss', resource_path('assets/sass/app.scss'));
111+
112+
// JS stuff copying
101113

102-
// JS stuff copying
114+
copy(__DIR__ . '/stubs/js/app.js', resource_path('assets/js/app.js'));
115+
copy(__DIR__ . '/stubs/js/bootstrap.js', resource_path('assets/js/bootstrap.js'));
103116

104-
copy(__DIR__ . '/stubs/js/app.js', resource_path('assets/js/app.js'));
105-
copy(__DIR__ . '/stubs/js/bootstrap.js', resource_path('assets/js/bootstrap.js'));
117+
// everything including components, we just grab components directory from stubs and copy to resources
106118

107-
// everything including components, we just grab components directory from stubs and copy to resources
119+
File::copyDirectory(__DIR__ . '/stubs/js/components', resource_path('assets/js/components'));
108120

109-
File::copyDirectory(__DIR__ . '/stubs/js/components', resource_path('assets/js/components'));
121+
File::copyDirectory(__DIR__ . '/stubs/js/router', resource_path('assets/js/router'));
122+
}
110123

111-
File::copyDirectory(__DIR__ . '/stubs/js/router', resource_path('assets/js/router'));
112-
} else {
113-
// SASS stuff copying
124+
/**
125+
* Method for updating 'resources' directory for Laravel more than 5.6 version
126+
*
127+
* @return void
128+
*/
129+
130+
131+
public static function updateNewResources()
132+
{
133+
// SASS stuff copying
114134

115-
copy(__DIR__ . '/stubs/sass/app.scss', resource_path('sass/app.scss'));
135+
copy(__DIR__ . '/stubs/sass/app.scss', resource_path('sass/app.scss'));
116136

117-
// JS stuff copying
137+
// JS stuff copying
118138

119-
copy(__DIR__ . '/stubs/js/app.js', resource_path('js/app.js'));
120-
copy(__DIR__ . '/stubs/js/bootstrap.js', resource_path('js/bootstrap.js'));
139+
copy(__DIR__ . '/stubs/js/app.js', resource_path('js/app.js'));
140+
copy(__DIR__ . '/stubs/js/bootstrap.js', resource_path('js/bootstrap.js'));
121141

122-
// everything including components, we just grab components directory from stubs and copy to resources
142+
// everything including components, we just grab components directory from stubs and copy to resources
123143

124-
File::copyDirectory(__DIR__ . '/stubs/js/components', resource_path('js/components'));
144+
File::copyDirectory(__DIR__ . '/stubs/js/components', resource_path('js/components'));
125145

126-
File::copyDirectory(__DIR__ . '/stubs/js/router', resource_path('js/router'));
127-
}
146+
File::copyDirectory(__DIR__ . '/stubs/js/router', resource_path('js/router'));
128147
}
129148

130149
/**

src/LaraBueProvider.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class LaraBueProvider extends ServiceProvider
1515
*
1616
* @return void
1717
*/
18+
1819
public function boot()
1920
{
2021
PresetCommand::macro('bue', function ($command) {
@@ -23,4 +24,4 @@ public function boot()
2324
$command->comment('Please run "npm install && npm run dev" to compile your fresh scaffolding');
2425
});
2526
}
26-
}
27+
}

0 commit comments

Comments
 (0)