blob: b504d4b086e342373bcec229620347bdcd53c361 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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();
}
}
}
|