diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/GitDeploy/Console/Application.php (renamed from src/GitHubPagesDeploy/Console/Application.php) | 6 | ||||
-rw-r--r-- | src/GitDeploy/Console/Command/DeployCommand.php (renamed from src/GitHubPagesDeploy/Console/Command/DeployCommand.php) | 17 | ||||
-rw-r--r-- | src/GitDeploy/GitDeploy.php (renamed from src/GitHubPagesDeploy/GitHubPagesDeploy.php) | 11 |
3 files changed, 22 insertions, 12 deletions
diff --git a/src/GitHubPagesDeploy/Console/Application.php b/src/GitDeploy/Console/Application.php index a7791ad..0ba70c9 100644 --- a/src/GitHubPagesDeploy/Console/Application.php +++ b/src/GitDeploy/Console/Application.php @@ -1,13 +1,13 @@ <?php -namespace GitHubPagesDeploy\Console; +namespace GitDeploy\Console; use Symfony\Component\Console\Application as BaseApplication; -use GitHubPagesDeploy\Console\Command\DeployCommand; +use GitDeploy\Console\Command\DeployCommand; class Application extends BaseApplication { - const NAME = 'GitHub Pages Deploy'; + const NAME = 'Git Deploy'; const VERSION = '@package_version@'; public function __construct() diff --git a/src/GitHubPagesDeploy/Console/Command/DeployCommand.php b/src/GitDeploy/Console/Command/DeployCommand.php index 70c7d8a..b504d4b 100644 --- a/src/GitHubPagesDeploy/Console/Command/DeployCommand.php +++ b/src/GitDeploy/Console/Command/DeployCommand.php @@ -1,8 +1,8 @@ <?php -namespace GitHubPagesDeploy\Console\Command; +namespace GitDeploy\Console\Command; -use GitHubPagesDeploy\GitHubPagesDeploy; +use GitDeploy\GitDeploy; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputOption; @@ -15,16 +15,23 @@ class DeployCommand extends Command { $this ->setName('deploy') - ->setDescription('Deploys the list of GitHub Pages repositories.') + ->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 = GitHubPagesDeploy::fromFile(); + $deploy = GitDeploy::fromFile($input->getOption('file')); $repositories = $deploy->getRepositories(); if (empty($repositories)) { - $output->writeln('<info>gh-pages-deploy.json is empty.</info>'); + $output->writeln('<info>Configuration file empty.</info>'); } else { $deploy->update(); diff --git a/src/GitHubPagesDeploy/GitHubPagesDeploy.php b/src/GitDeploy/GitDeploy.php index 0fb0a0c..d1c2cf6 100644 --- a/src/GitHubPagesDeploy/GitHubPagesDeploy.php +++ b/src/GitDeploy/GitDeploy.php @@ -1,11 +1,11 @@ <?php -namespace GitHubPagesDeploy; +namespace GitDeploy; use GitWrapper\GitWrapper; use GitWrapper\GitWorkingCopy; -class GitHubPagesDeploy +class GitDeploy { protected $repositories; @@ -14,7 +14,7 @@ class GitHubPagesDeploy $this->repositories = $repositories; } - public static function fromFile($file = 'gh-pages-deploy.json') + public static function fromFile($file = 'git-deploy.json') { $results = array(); @@ -23,7 +23,7 @@ class GitHubPagesDeploy $results = json_decode($contents); } - return new GitHubPagesDeploy($results); + return new GitDeploy($results); } public function update() @@ -47,6 +47,9 @@ class GitHubPagesDeploy // Reset over to the gh-pages branch. $git->reset('origin/gh-pages', array('hard' => true)); + + // Remove any extra files. + $git->clean('-d', '-f', '-x'); } } |