summaryrefslogtreecommitdiffstats
path: root/src/GitDeploy/Console/Command/DeployCommand.php
blob: 6a735bda780ed8537b5b5301a43e5c694849c83c (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
<?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'));
        $deploy->deploy();
    }
}