Permalink
Browse files

Build system: Minor code refactoring

  • Loading branch information...
1 parent 10495c2 commit ce84a8618ca3d80bc69ef8e90e67b63348f080c4 @PhrozenByte PhrozenByte committed Jan 17, 2016
Showing with 28 additions and 28 deletions.
  1. +4 −4 .gitignore
  2. +13 −13 _build/deploy-phpdoc-branch.sh
  3. +11 −11 _build/deploy-phpdoc-release.sh
View
@@ -15,10 +15,10 @@ desktop.ini
/composer.phar
/vendor
-# phpDocumentor
-/_build/phpdoc/
-/_build/phpdoc.cache/
-/_build/phpdoc-*/
+# Build system
+/_build/phpdoc
+/_build/phpdoc.cache
+/_build/deploy-*.git
# User config
/config/config.php
@@ -1,29 +1,29 @@
#!/usr/bin/env bash
if [ "$TRAVIS_PHP_VERSION" != "5.3" ]; then
- echo "Skipping phpDoc deployment because this is not on the required runtime"
+ echo "Skipping branch deployment because this is not on the required runtime"
exit 0
fi
-if [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]]; then
- echo "Skipping phpDoc deployment because this branch ($TRAVIS_BRANCH) is not permitted to deploy"
+if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
+ echo "Skipping branch deployment because this pull request (#$TRAVIS_PULL_REQUEST) is not permitted to deploy"
exit 0
fi
-if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
- echo "Skipping phpDoc deployment because this pull request (#$TRAVIS_PULL_REQUEST) is not permitted to deploy"
+if [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]]; then
+ echo "Skipping phpDoc branch deployment because this branch ($TRAVIS_BRANCH) is not permitted to deploy"
exit 0
fi
-PHPDOC_ID="${TRAVIS_BRANCH//\//_}"
-PHPDOC_GIT_DIR="$TRAVIS_BUILD_DIR/_build/phpdoc-$PHPDOC_ID.git"
+DEPLOYMENT_ID="${TRAVIS_BRANCH//\//_}"
+DEPLOYMENT_DIR="$TRAVIS_BUILD_DIR/_build/deploy-$DEPLOYMENT_ID.git"
# clone repo
echo "Cloning repo..."
-git clone --branch="gh-pages" "https://github.com/$TRAVIS_REPO_SLUG.git" "$PHPDOC_GIT_DIR"
+git clone --branch="gh-pages" "https://github.com/$TRAVIS_REPO_SLUG.git" "$DEPLOYMENT_DIR"
[ $? -eq 0 ] || exit 1
-cd "$PHPDOC_GIT_DIR"
+cd "$DEPLOYMENT_DIR"
echo
# setup repo
@@ -32,17 +32,17 @@ github-setup.sh
# generate phpDocs
generate-phpdoc.sh \
"$TRAVIS_BUILD_DIR/.phpdoc.xml" \
- "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID.cache" "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID" \
+ "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" \
"Pico 1.0 API Documentation ($TRAVIS_BRANCH branch)"
[ $? -eq 0 ] || exit 1
-[ -n "$(git status --porcelain "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID.cache")" ] || exit 0
+[ -n "$(git status --porcelain "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache")" ] || exit 0
# commit phpDocs
echo "Committing changes..."
-git add "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID.cache" "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID"
+git add "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID"
git commit \
--message="Update phpDocumentor class docs for $TRAVIS_BRANCH branch @ $TRAVIS_COMMIT" \
- "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID.cache" "$PHPDOC_GIT_DIR/phpDoc/$PHPDOC_ID"
+ "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID"
[ $? -eq 0 ] || exit 1
echo
@@ -10,15 +10,15 @@ if [ "$DEPLOY_PHPDOC_RELEASES" != "true" ] || [ "$DEPLOY_VERSION_BADGE" != "true
[ "$DEPLOY_PHPDOC_RELEASES" != "true" ] && [ "$DEPLOY_VERSION_BADGE" != "true" ] && exit 0 || echo
fi
-PHPDOC_ID="${TRAVIS_BRANCH//\//_}"
-GIT_DIR="$TRAVIS_BUILD_DIR/_build/phpdoc-$PHPDOC_ID.git"
+DEPLOYMENT_ID="${TRAVIS_BRANCH//\//_}"
+DEPLOYMENT_DIR="$TRAVIS_BUILD_DIR/_build/deploy-$DEPLOYMENT_ID.git"
# clone repo
echo "Cloning repo..."
-git clone --branch="gh-pages" "https://github.com/$TRAVIS_REPO_SLUG.git" "$GIT_DIR"
+git clone --branch="gh-pages" "https://github.com/$TRAVIS_REPO_SLUG.git" "$DEPLOYMENT_DIR"
[ $? -eq 0 ] || exit 1
-cd "$GIT_DIR"
+cd "$DEPLOYMENT_DIR"
echo
# setup repo
@@ -28,17 +28,17 @@ github-setup.sh
if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then
generate-phpdoc.sh \
"$TRAVIS_BUILD_DIR/.phpdoc.xml" \
- "-" "$GIT_DIR/phpDoc/$PHPDOC_ID" \
+ "-" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" \
"Pico 1.0 API Documentation ($TRAVIS_TAG)"
[ $? -eq 0 ] || exit 1
# commit phpDocs
- if [ -n "$(git status --porcelain "$GIT_DIR/phpDoc/$PHPDOC_ID")" ]; then
+ if [ -n "$(git status --porcelain "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID")" ]; then
echo "Committing phpDoc changes..."
- git add "$GIT_DIR/phpDoc/$PHPDOC_ID"
+ git add "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID"
git commit \
--message="Update phpDocumentor class docs for $TRAVIS_TAG" \
- "$GIT_DIR/phpDoc/$PHPDOC_ID"
+ "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID"
[ $? -eq 0 ] || exit 1
echo
fi
@@ -47,15 +47,15 @@ fi
# update version badge
if [ "$DEPLOY_VERSION_BADGE" == "true" ]; then
generate-badge.sh \
- "$GIT_DIR/badges/pico-version.svg" \
+ "$DEPLOYMENT_DIR/badges/pico-version.svg" \
"release" "$TRAVIS_TAG" "blue"
# commit version badge
echo "Committing changes..."
- git add "$GIT_DIR/badges/pico-version.svg"
+ git add "$DEPLOYMENT_DIR/badges/pico-version.svg"
git commit \
--message="Update version badge for $TRAVIS_TAG" \
- "$GIT_DIR/badges/pico-version.svg"
+ "$DEPLOYMENT_DIR/badges/pico-version.svg"
[ $? -eq 0 ] || exit 1
echo
fi

0 comments on commit ce84a86

Please sign in to comment.