summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRob Loach <robloach@gmail.com>2013-12-25 07:47:58 -0500
committerRob Loach <robloach@gmail.com>2013-12-25 07:47:58 -0500
commit7ac95ae857f496dc6092d978fdd1b12d0dc13b83 (patch)
tree080826fe0ac1b1ec2197e4e36e5639823742d775
parent00830e04b65b2ae71200ec48d6598960c13f1c90 (diff)
downloadgit-deploy-0.0.2.zip
git-deploy-0.0.2.tar.gz
git-deploy-0.0.2.tar.bz2
Clean the repository0.0.2
-rw-r--r--README.md15
-rw-r--r--src/GitHubPagesDeploy/GitHubPagesDeploy.php14
2 files changed, 22 insertions, 7 deletions
diff --git a/README.md b/README.md
index 2f4a773..50a0438 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,6 @@
# GitHub Pages Deploy
-Deploys a number of repositories using the `gh-pages` branch, and keeps them
-up to date.
+Deploy and maintain a number of static web applications on GitHub pages.
## Installation
@@ -31,3 +30,15 @@ $ php composer.phar create-project robloach/gh-pages-deploy
``` bash
$ gh-pages-deploy/bin/gh-pages-deploy deploy
```
+
+3. Set up a cron job to deploy every once in a while.
+``` bash
+$ gh-pages-deploy/bin/gh-pages-deploy deploy
+```
+
+
+## License
+
+Licensed under the incredibly [permissive](http://en.wikipedia.org/wiki/Permissive_free_software_licence) [MIT license](http://creativecommons.org/licenses/MIT/)
+
+Copyright &copy; Rob Loach (http://robloach.net)
diff --git a/src/GitHubPagesDeploy/GitHubPagesDeploy.php b/src/GitHubPagesDeploy/GitHubPagesDeploy.php
index 34c31d4..bcf2fde 100644
--- a/src/GitHubPagesDeploy/GitHubPagesDeploy.php
+++ b/src/GitHubPagesDeploy/GitHubPagesDeploy.php
@@ -33,6 +33,7 @@ class GitHubPagesDeploy
$wrapper->streamOutput();
foreach ($this->repositories as $dir => $repo) {
+ // Build our git interface.
$git = null;
if (!is_dir($dir)) {
$git = $wrapper->cloneRepository($repo, $dir);
@@ -41,17 +42,20 @@ class GitHubPagesDeploy
$git = new GitWorkingCopy($wrapper, $dir);
}
+ // Fetch all the latest.
+ $git->fetch('--all');
+
// Remove any local changes.
$git->reset(array('hard' => true));
+ // Clean up the repository.
+ $git->run(array('clean', array('d' => TRUE, 'f' => TRUE)));
+
// Ensure we are on the correct branch.
- $git->checkout('gh-pages');
+ $git->checkout('gh-pages', array('force' => TRUE));
- // Pull in any changes.
+ // Finally, pull in the changes.
$git->pull();
-
- // Ensure there aren't any local changes.
- $git->reset(array('hard' => true));
}
}