Skip to content

Commit

Permalink
Add conditional check for artisan command.
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-cintra committed Sep 6, 2024
1 parent d2d80ad commit 17ecedf
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ public function handle(): void
$this->copyResourcesComponentsFiles();
$this->copyTranslationFile();

$this->call('storage:link');
if (!is_link(public_path('storage'))) {
$this->call('storage:link');
}

$this->call('modular:blog-migrate');

Expand All @@ -45,39 +47,39 @@ private function copyBlogModuleDirectory(): void
{
$this->info('Copying Blog Module directory...');
(new Filesystem)->ensureDirectoryExists(base_path('modules'));
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/modules/Blog', base_path('modules/Blog'));
(new Filesystem)->copyDirectory(__DIR__ . '/../../stubs/modules/Blog', base_path('modules/Blog'));
$this->info('Blog Module directory copied successfully.');
}

private function copyResourcesComponentsFiles(): void
{
$this->info('Copying Blog Module components...');
(new Filesystem)->ensureDirectoryExists(resource_path('js/Components/Modules/Blog'));
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/resources/js/Components/Modules/Blog', resource_path('js/Components/Modules/Blog'));
(new Filesystem)->copyDirectory(__DIR__ . '/../../stubs/resources/js/Components/Modules/Blog', resource_path('js/Components/Modules/Blog'));
$this->info('Blog Module components copied successfully.');
}

private function copyBlogSeederImages(): void
{
$this->info('Copying Blog Seeder images...');
(new Filesystem)->ensureDirectoryExists(resource_path('images/blog'));
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/resources/images/blog', resource_path('images/blog'));
(new Filesystem)->copyDirectory(__DIR__ . '/../../stubs/resources/images/blog', resource_path('images/blog'));
$this->info('Blog Module Seeder images copied successfully.');
}

private function copyResourcesFiles(): void
{
$this->info('Copying Blog Module resources...');
(new Filesystem)->ensureDirectoryExists(resource_path('js/Pages'));
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/resources/js/Pages', resource_path('js/Pages'));
(new Filesystem)->copyDirectory(__DIR__ . '/../../stubs/resources/js/Pages', resource_path('js/Pages'));
$this->info('Blog Module resources copied successfully.');
}

private function copyResourcesSiteFiles(): void
{
$this->info('Copying Blog Module resources-site...');
(new Filesystem)->ensureDirectoryExists(base_path('resources-site'));
(new Filesystem)->copyDirectory(__DIR__.'/../../stubs/resources-site', base_path('resources-site'));
(new Filesystem)->copyDirectory(__DIR__ . '/../../stubs/resources-site', base_path('resources-site'));
$this->info('Blog Module resources-site copied successfully.');
}

Expand All @@ -87,7 +89,7 @@ private function copyTranslationFile(): void

if (! file_exists($paginationEnglish)) {
(new Filesystem)->ensureDirectoryExists(base_path('lang/en'));
copy(__DIR__.'/../../stubs/lang/en/pagination.php', base_path('lang/en/pagination.php'));
copy(__DIR__ . '/../../stubs/lang/en/pagination.php', base_path('lang/en/pagination.php'));
}
}
}

0 comments on commit 17ecedf

Please sign in to comment.