Skip to content

Commit

Permalink
Fix force option on publish stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
EsdertCO committed Jul 24, 2020
1 parent b72d8dc commit fbb9598
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Console/Publish/PublishStubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,15 @@ public function handle()
(new Filesystem)->makeDirectory($stubsPath);
}

File::copyDirectory(__DIR__.'/../../stubs/', $stubsPath);
$files = File::allFiles(__DIR__.'/../../stubs/');

foreach ($files as $file) {
$to = $stubsPath . '/' . $file->getFilename();
$from = $file->getPathName();
if (! file_exists($to) || $this->option('force')) {
file_put_contents($to, file_get_contents($from));
}
}

return $this->info('Stubs published successfully');
}
Expand Down

0 comments on commit fbb9598

Please sign in to comment.