ORIENT/modules/system/console/OctoberFresh.php

62 lines
1.4 KiB
PHP
Raw Normal View History

<?php namespace System\Console;
use File;
2015-05-02 02:29:22 +00:00
use Artisan;
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
/**
* Console command to remove boilerplate.
*
* This removes the demo theme and plugin. A great way to start a fresh project!
*
* @package october\system
* @author Alexey Bobkov, Samuel Georges
*/
class OctoberFresh extends Command
{
2015-05-02 02:29:22 +00:00
use \Illuminate\Console\ConfirmableTrait;
/**
* The console command name.
*/
protected $name = 'october:fresh';
/**
* The console command description.
*/
2015-05-02 02:29:22 +00:00
protected $description = 'Removes the demo theme and plugin.';
/**
* Execute the console command.
*/
2017-07-14 06:28:47 +00:00
public function handle()
{
if (!$this->confirmToProceed('Are you sure?')) {
return;
}
$demoThemePath = themes_path().'/demo';
2021-03-11 10:16:57 +00:00
if (File::exists($demoThemePath)) {
2021-03-11 10:16:57 +00:00
Artisan::call('plugin:remove', ['name' => 'October.Demo', '--force' => true]);
File::deleteDirectory($demoThemePath);
2021-03-11 10:16:57 +00:00
$this->info('Demo has been removed! Enjoy a fresh start.');
}
2021-03-11 10:16:57 +00:00
else {
$this->error('Demo theme is already removed.');
}
}
/**
* Get the console command options.
*/
protected function getOptions()
{
2015-05-02 02:29:22 +00:00
return [
['force', null, InputOption::VALUE_NONE, 'Force the operation to run.'],
];
}
}