diff options
author | Rob Loach <robloach@gmail.com> | 2015-02-07 22:05:07 -0500 |
---|---|---|
committer | Rob Loach <robloach@gmail.com> | 2015-02-07 22:05:07 -0500 |
commit | bc0f13b93a3b20f1640c75c9f28fe77b5a4c89ca (patch) | |
tree | 3530b776e0b69f6d7449a46224f46487ca576578 | |
parent | 7ca89a5eb6c7993658c9efce339f6805a0ee8351 (diff) | |
download | git-deploy-0.0.4.zip git-deploy-0.0.4.tar.gz git-deploy-0.0.4.tar.bz2 |
Rename to Git Deploy0.0.4
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .travis.yml | 8 | ||||
-rw-r--r-- | LICENSE.md | 2 | ||||
-rw-r--r-- | README.md | 14 | ||||
-rwxr-xr-x | bin/gh-pages-deploy | 4 | ||||
-rwxr-xr-x | bin/git-deploy | 4 | ||||
-rw-r--r-- | bin/git-deploy.php (renamed from bin/gh-pages-deploy.php) | 4 | ||||
-rw-r--r-- | box.json | 4 | ||||
-rw-r--r-- | composer.json | 23 | ||||
-rw-r--r-- | phpunit.xml.dist | 31 | ||||
-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 | ||||
-rw-r--r-- | tests/GitDeploy/Tests/Fixtures/git-deploy.json | 4 | ||||
-rw-r--r-- | tests/GitDeploy/Tests/GitDeployTest.php | 19 | ||||
-rw-r--r-- | tests/bootstrap.php | 6 |
16 files changed, 121 insertions, 37 deletions
@@ -1,4 +1,3 @@ -build composer.lock vendor composer.phar diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5bd57ec --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: php + +php: + - 5.3 + - 5.4 + - 5.5 + - 5.6 + - hhvm @@ -1,7 +1,7 @@ LICENSE ======= -GitHub Pages Deploy is released under the MIT License: +Git Deploy is released under the MIT License: > Copyright (C) 2013 [Rob Loach](http://robloach.net) > @@ -1,6 +1,12 @@ -# GitHub Pages Deploy +# Git Deploy -Deploy and maintain a number of static web applications on GitHub pages. +Deploy and maintain a number of git repositories through PHP. + + +## Requirements + +* PHP 5.4 or greater +* [Composer](http://getcomposer.org) ## Installation @@ -11,10 +17,10 @@ Deploy and maintain a number of static web applications on GitHub pages. $ php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));" ``` -2. Use Composer to download GitHub Pages Deploy: +2. Use Composer to install Git Deploy: ``` bash - $ php composer.phar create-project robloach/gh-pages-deploy + $ php composer.phar create-project robloach/git-deploy ``` diff --git a/bin/gh-pages-deploy b/bin/gh-pages-deploy deleted file mode 100755 index e323caa..0000000 --- a/bin/gh-pages-deploy +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env php -<?php - -require 'gh-pages-deploy.php'; diff --git a/bin/git-deploy b/bin/git-deploy new file mode 100755 index 0000000..7b1b816 --- /dev/null +++ b/bin/git-deploy @@ -0,0 +1,4 @@ +#!/usr/bin/env php +<?php + +require_once('git-deploy.php'); diff --git a/bin/gh-pages-deploy.php b/bin/git-deploy.php index 5b039bc..b0eeb3c 100644 --- a/bin/gh-pages-deploy.php +++ b/bin/git-deploy.php @@ -1,12 +1,12 @@ <?php if (PHP_SAPI !== 'cli') { - echo 'Warning: GitHub Pages Deploy should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL; + echo 'Warning: Git Deploy should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL; } require __DIR__.'/../src/bootstrap.php'; -use GitHubPagesDeploy\Console\Application; +use GitDeploy\Console\Application; error_reporting(-1); @@ -19,7 +19,7 @@ "in": "vendor" } ], - "main": "bin/gh-pages-deploy", - "output": "gh-pages-deploy.phar", + "main": "bin/git-deploy", + "output": "git-deploy.phar", "stub": true } diff --git a/composer.json b/composer.json index 2e34845..8791859 100644 --- a/composer.json +++ b/composer.json @@ -1,30 +1,31 @@ { - "title": "GitHub Pages Deploy", - "name": "robloach/gh-pages-deploy", - "type": "library", - "description": "Deploys a number of repositories using the gh-pages branch.", - "homepage": "https://github.com/RobLoach/gh-pages-deploy", + "title": "Git Deploy", + "name": "robloach/git-deploy", + "type": "project", + "description": "Deploy and manage git deployments.", + "homepage": "https://github.com/RobLoach/git-deploy", "license": "MIT", "authors": [ { "name": "See contributors", - "homepage": "https://github.com/RobLoach/gh-pages-deploy/graphs/contributors" + "homepage": "https://github.com/RobLoach/git-deploy/graphs/contributors" } ], "support": { - "issues": "https://github.com/RobLoach/gh-pages-deploy/issues" + "issues": "https://github.com/RobLoach/git-deploy/issues" }, "require": { "php": ">=5.3.0", - "cpliakas/git-wrapper": "1.2.*", - "symfony/console": "2.4.*" + "cpliakas/git-wrapper": "~1.4.1", + "symfony/console": "~2.6.4" }, "autoload": { "psr-0": { - "GitHubPagesDeploy": "src/" + "GitDeploy": "src/" } }, "bin": [ - "bin/gh-pages-deploy" + "bin/git-deploy", + "bin/git-deploy.php" ] } diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..0256322 --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,31 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<phpunit backupGlobals="false" + backupStaticAttributes="false" + colors="true" + convertErrorsToExceptions="true" + convertNoticesToExceptions="true" + convertWarningsToExceptions="true" + processIsolation="false" + stopOnFailure="false" + syntaxCheck="false" + bootstrap="tests/bootstrap.php" +> + <testsuites> + <testsuite name="Composer Test Suite"> + <directory>./tests/GitDeploy/</directory> + </testsuite> + </testsuites> + + <groups> + <exclude> + <group>slow</group> + </exclude> + </groups> + + <filter> + <whitelist> + <directory>./src/GitDeploy/</directory> + </whitelist> + </filter> +</phpunit> 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'); } } diff --git a/tests/GitDeploy/Tests/Fixtures/git-deploy.json b/tests/GitDeploy/Tests/Fixtures/git-deploy.json new file mode 100644 index 0000000..4ca1730 --- /dev/null +++ b/tests/GitDeploy/Tests/Fixtures/git-deploy.json @@ -0,0 +1,4 @@ +{ + "mywebsite": "https://github.com/my/website.git", + "myotherwebsite": "https://github.com/my/otherwebsite.git" +} diff --git a/tests/GitDeploy/Tests/GitDeployTest.php b/tests/GitDeploy/Tests/GitDeployTest.php new file mode 100644 index 0000000..ff1bf10 --- /dev/null +++ b/tests/GitDeploy/Tests/GitDeployTest.php @@ -0,0 +1,19 @@ +<?php + +namespace GitDeploy\Tests\GitDeployTest; + +use GitDeploy\GitDeploy; + +class GitDeployTest extends \PHPUnit_Framework_TestCase +{ + protected $fixtures; + + public function __construct() { + $this->fixtures = __DIR__ . '/Fixtures/'; + } + + public function testFromFile() { + $gitdeploy = GitDeploy::fromFile($this->fixtures . 'git-deploy.json'); + $this->assertNotEmpty($gitdeploy); + } +} diff --git a/tests/bootstrap.php b/tests/bootstrap.php new file mode 100644 index 0000000..2340dac --- /dev/null +++ b/tests/bootstrap.php @@ -0,0 +1,6 @@ +<?php + +error_reporting(E_ALL); + +$loader = require __DIR__ . '/../src/bootstrap.php'; +$loader->add('GitDeploy\Test', __DIR__); |