Skip to content

Commit

Permalink
Merge pull request #95 from hydephp/88-rename-publishconfigs-to-updat…
Browse files Browse the repository at this point in the history
…econfigs-and-make-force-default-behaviour

Update and simplify the command and rename signature from publish:configs to update:configs, making overwriting files the default.
  • Loading branch information
caendesilva authored Apr 10, 2022
2 parents 5c871cb + e8c08d3 commit 71133ab
Showing 1 changed file with 8 additions and 64 deletions.
72 changes: 8 additions & 64 deletions src/Commands/HydePublishConfigsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,82 +2,26 @@

namespace Hyde\Framework\Commands;

use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\ServiceProvider;
use Hyde\Framework\Hyde;
use Illuminate\Support\Facades\File;
use LaravelZero\Framework\Commands\Command;

/**
* Publish the Hyde Config Files.
*
* @uses HydeBasePublishingCommand
*/
class HydePublishConfigsCommand extends HydeBasePublishingCommand
class HydePublishConfigsCommand extends Command
{
protected $signature = 'publish:configs {--force : Overwrite any existing files}';
protected $signature = 'update:configs';
protected $description = 'Publish the default configuration files';

protected $description = 'Publish the Hyde configuration files';

/**
* Create a new command instance.
*
* @param \Illuminate\Filesystem\Filesystem $files
* @return void
*/
public function __construct(Filesystem $files)
{
parent::__construct();

$this->files = $files;
}

/**
* Execute the console command.
*
* @return int
*
* @throws \League\Flysystem\FilesystemException
*/
public function handle(): int
{
$this->tags = array_flip(array_filter(
array_flip(ServiceProvider::publishableGroups()),
fn ($key) => str_starts_with($key, 'configs'),
ARRAY_FILTER_USE_KEY
));

foreach ($this->tags ?: [null] as $tag) {
$this->publishTag($tag);
}
File::copyDirectory(Hyde::vendorPath('config'), Hyde::path('config'));

$this->info('Publishing complete.');
$this->line('<info>Published config files to</info> <comment>'.Hyde::path('config').'</comment>');

return 0;
}

/**
* Determine the provider or tag(s) to publish.
*
* @return void
*/
protected function determineWhatShouldBePublished()
{
}

/**
* Prompt for which tag to publish.
*
* @return void
*/
protected function promptForProviderOrTag()
{
}

/**
* The choices available via the prompt.
*
* @return array
*/
protected function publishableChoices(): array
{
return [];
}
}

0 comments on commit 71133ab

Please sign in to comment.