summaryrefslogtreecommitdiffstats
path: root/src/GitHubPagesDeploy/Console/Command/DeployCommand.php
blob: 70c7d8a3018e6729241d3ece2c8e0d55c67488b7 (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
<?php

namespace GitHubPagesDeploy\Console\Command;

use GitHubPagesDeploy\GitHubPagesDeploy;
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 GitHub Pages repositories.')
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $deploy = GitHubPagesDeploy::fromFile();
        $repositories = $deploy->getRepositories();
        if (empty($repositories)) {
            $output->writeln('<info>gh-pages-deploy.json is empty.</info>');
        }
        else {
            $deploy->update();
        }
    }
}