Simplify init command

This commit is contained in:
Anton Medvedev 2020-10-10 20:38:11 +02:00
parent f05f74642c
commit 7a096b9dd1
2 changed files with 8 additions and 56 deletions

View File

@ -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;

View File

@ -115,31 +115,6 @@ class InitCommand extends Command
// Hosts
$hosts = explode(',', $io->ask('Hosts (comma separated)', 'deployer.org'));
// Privacy
$io->text(<<<TEXT
<info>Contribute to the Deployer Development</info>
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;
}
}