diff options
Diffstat (limited to 'src/GitDeploy/Console/Command/DeployCommand.php')
-rw-r--r-- | src/GitDeploy/Console/Command/DeployCommand.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/GitDeploy/Console/Command/DeployCommand.php b/src/GitDeploy/Console/Command/DeployCommand.php new file mode 100644 index 0000000..b504d4b --- /dev/null +++ b/src/GitDeploy/Console/Command/DeployCommand.php @@ -0,0 +1,40 @@ +<?php + +namespace GitDeploy\Console\Command; + +use GitDeploy\GitDeploy; +use Symfony\Component\Console\Command\Command; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; + +class DeployCommand extends Command +{ + protected function configure() + { + $this + ->setName('deploy') + ->setDescription('Deploys the list of repositories.') + ->addOption( + 'file', + 'f', + InputOption::VALUE_OPTIONAL, + 'The configuration file to load.', + 'git-deploy.json' + ) + ; + } + + protected function execute(InputInterface $input, OutputInterface $output) + { + $deploy = GitDeploy::fromFile($input->getOption('file')); + $repositories = $deploy->getRepositories(); + if (empty($repositories)) { + $output->writeln('<info>Configuration file empty.</info>'); + } + else { + $deploy->update(); + } + } +} |