From 7a096b9dd1acf2f26adc28703efa40bf0ab533f2 Mon Sep 17 00:00:00 2001 From: Anton Medvedev Date: Sat, 10 Oct 2020 20:38:11 +0200 Subject: [PATCH] Simplify init command --- src/Component/Initializer/Initializer.php | 15 +++---- src/Console/InitCommand.php | 49 ----------------------- 2 files changed, 8 insertions(+), 56 deletions(-) diff --git a/src/Component/Initializer/Initializer.php b/src/Component/Initializer/Initializer.php index 5315629f..38b7595f 100644 --- a/src/Component/Initializer/Initializer.php +++ b/src/Component/Initializer/Initializer.php @@ -7,6 +7,10 @@ namespace Deployer\Component\Initializer; +use function Deployer\cd; +use function Deployer\run; +use function Deployer\task; + class Initializer { public function getRecipes() @@ -65,15 +69,12 @@ add('writable_dirs', []); // Tasks -task('build', function () { - run('cd {{release_path}} && npm run build'); +task('deploy:build', function () { + cd('{{release_path}}'); + run('npm run build'); }); -task('build:upload', function () { - upload('dist', '{{release_path}}/dist'); -}); - -// If deploy fails automatically unlock. +//after('deploy:update_code', 'deploy:build'); after('deploy:failed', 'deploy:unlock'); PHP; diff --git a/src/Console/InitCommand.php b/src/Console/InitCommand.php index b12273ba..c785848d 100644 --- a/src/Console/InitCommand.php +++ b/src/Console/InitCommand.php @@ -115,31 +115,6 @@ class InitCommand extends Command // Hosts $hosts = explode(',', $io->ask('Hosts (comma separated)', 'deployer.org')); - - // Privacy - $io->text(<<Contribute to the Deployer Development - -Help development and improve features of Deployer by -an optional usage data collection program. This program -collects anonymous usage data and sends it to Deployer. -The data is used in Deployer development to get reliable -statistics on which features are used (or not used). The -information is not traceable to any individual or -organization. Participation is voluntary, and you can -change your mind at any time. - -Anonymous usage data contains Deployer version, PHP version, -OS type, name of the command being executed and whether -it was successful or not, count of hosts and anonymized -project hash. This program will not affect the performance -of Deployer as the data is insignificant and transmitted -in a separate process. - -We appreciate your involvement! -TEXT); - - $allow = $io->confirm('Do you confirm?'); } file_put_contents($filepath, $initializer->getTemplate($template, $project, $repository, $hosts, $allow)); @@ -150,28 +125,4 @@ TEXT); )); return 0; } - - /** - * Create a initializer system - * - * @return Initializer - */ - private function createInitializer() - { - $initializer = new Initializer(); - - $initializer->addTemplate('Common', new CommonTemplate()); - $initializer->addTemplate('Laravel', new LaravelTemplate()); - $initializer->addTemplate('Symfony', new SymfonyTemplate()); - $initializer->addTemplate('Yii', new YiiTemplate()); - $initializer->addTemplate('Yii2 Basic App', new Yii2BasicAppTemplate()); - $initializer->addTemplate('Yii2 Advanced App', new Yii2AdvancedAppTemplate()); - $initializer->addTemplate('Zend Framework', new ZendTemplate()); - $initializer->addTemplate('CakePHP', new CakeTemplate()); - $initializer->addTemplate('CodeIgniter', new CodeIgniterTemplate()); - $initializer->addTemplate('Drupal', new DrupalTemplate()); - $initializer->addTemplate('TYPO3', new Typo3Template()); - - return $initializer; - } }