Build system: Minor code refactoring
This commit is contained in:
parent
10495c2ce5
commit
ce84a8618c
8
.gitignore
vendored
8
.gitignore
vendored
@ -15,10 +15,10 @@ desktop.ini
|
|||||||
/composer.phar
|
/composer.phar
|
||||||
/vendor
|
/vendor
|
||||||
|
|
||||||
# phpDocumentor
|
# Build system
|
||||||
/_build/phpdoc/
|
/_build/phpdoc
|
||||||
/_build/phpdoc.cache/
|
/_build/phpdoc.cache
|
||||||
/_build/phpdoc-*/
|
/_build/deploy-*.git
|
||||||
|
|
||||||
# User config
|
# User config
|
||||||
/config/config.php
|
/config/config.php
|
||||||
|
@ -1,29 +1,29 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if [ "$TRAVIS_PHP_VERSION" != "5.3" ]; then
|
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"
|
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
|
||||||
echo "Skipping phpDoc deployment because this pull request (#$TRAVIS_PULL_REQUEST) is not permitted to deploy"
|
echo "Skipping branch deployment because this pull request (#$TRAVIS_PULL_REQUEST) is not permitted to deploy"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PHPDOC_ID="${TRAVIS_BRANCH//\//_}"
|
if [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]]; then
|
||||||
PHPDOC_GIT_DIR="$TRAVIS_BUILD_DIR/_build/phpdoc-$PHPDOC_ID.git"
|
echo "Skipping phpDoc branch deployment because this branch ($TRAVIS_BRANCH) is not permitted to deploy"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
DEPLOYMENT_ID="${TRAVIS_BRANCH//\//_}"
|
||||||
|
DEPLOYMENT_DIR="$TRAVIS_BUILD_DIR/_build/deploy-$DEPLOYMENT_ID.git"
|
||||||
|
|
||||||
# clone repo
|
# clone repo
|
||||||
echo "Cloning 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
|
[ $? -eq 0 ] || exit 1
|
||||||
|
|
||||||
cd "$PHPDOC_GIT_DIR"
|
cd "$DEPLOYMENT_DIR"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# setup repo
|
# setup repo
|
||||||
@ -32,17 +32,17 @@ github-setup.sh
|
|||||||
# generate phpDocs
|
# generate phpDocs
|
||||||
generate-phpdoc.sh \
|
generate-phpdoc.sh \
|
||||||
"$TRAVIS_BUILD_DIR/.phpdoc.xml" \
|
"$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)"
|
"Pico 1.0 API Documentation ($TRAVIS_BRANCH branch)"
|
||||||
[ $? -eq 0 ] || exit 1
|
[ $? -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
|
# commit phpDocs
|
||||||
echo "Committing changes..."
|
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 \
|
git commit \
|
||||||
--message="Update phpDocumentor class docs for $TRAVIS_BRANCH branch @ $TRAVIS_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
|
[ $? -eq 0 ] || exit 1
|
||||||
echo
|
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
|
[ "$DEPLOY_PHPDOC_RELEASES" != "true" ] && [ "$DEPLOY_VERSION_BADGE" != "true" ] && exit 0 || echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
PHPDOC_ID="${TRAVIS_BRANCH//\//_}"
|
DEPLOYMENT_ID="${TRAVIS_BRANCH//\//_}"
|
||||||
GIT_DIR="$TRAVIS_BUILD_DIR/_build/phpdoc-$PHPDOC_ID.git"
|
DEPLOYMENT_DIR="$TRAVIS_BUILD_DIR/_build/deploy-$DEPLOYMENT_ID.git"
|
||||||
|
|
||||||
# clone repo
|
# clone repo
|
||||||
echo "Cloning 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
|
[ $? -eq 0 ] || exit 1
|
||||||
|
|
||||||
cd "$GIT_DIR"
|
cd "$DEPLOYMENT_DIR"
|
||||||
echo
|
echo
|
||||||
|
|
||||||
# setup repo
|
# setup repo
|
||||||
@ -28,17 +28,17 @@ github-setup.sh
|
|||||||
if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then
|
if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then
|
||||||
generate-phpdoc.sh \
|
generate-phpdoc.sh \
|
||||||
"$TRAVIS_BUILD_DIR/.phpdoc.xml" \
|
"$TRAVIS_BUILD_DIR/.phpdoc.xml" \
|
||||||
"-" "$GIT_DIR/phpDoc/$PHPDOC_ID" \
|
"-" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" \
|
||||||
"Pico 1.0 API Documentation ($TRAVIS_TAG)"
|
"Pico 1.0 API Documentation ($TRAVIS_TAG)"
|
||||||
[ $? -eq 0 ] || exit 1
|
[ $? -eq 0 ] || exit 1
|
||||||
|
|
||||||
# commit phpDocs
|
# 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..."
|
echo "Committing phpDoc changes..."
|
||||||
git add "$GIT_DIR/phpDoc/$PHPDOC_ID"
|
git add "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID"
|
||||||
git commit \
|
git commit \
|
||||||
--message="Update phpDocumentor class docs for $TRAVIS_TAG" \
|
--message="Update phpDocumentor class docs for $TRAVIS_TAG" \
|
||||||
"$GIT_DIR/phpDoc/$PHPDOC_ID"
|
"$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID"
|
||||||
[ $? -eq 0 ] || exit 1
|
[ $? -eq 0 ] || exit 1
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
@ -47,15 +47,15 @@ fi
|
|||||||
# update version badge
|
# update version badge
|
||||||
if [ "$DEPLOY_VERSION_BADGE" == "true" ]; then
|
if [ "$DEPLOY_VERSION_BADGE" == "true" ]; then
|
||||||
generate-badge.sh \
|
generate-badge.sh \
|
||||||
"$GIT_DIR/badges/pico-version.svg" \
|
"$DEPLOYMENT_DIR/badges/pico-version.svg" \
|
||||||
"release" "$TRAVIS_TAG" "blue"
|
"release" "$TRAVIS_TAG" "blue"
|
||||||
|
|
||||||
# commit version badge
|
# commit version badge
|
||||||
echo "Committing changes..."
|
echo "Committing changes..."
|
||||||
git add "$GIT_DIR/badges/pico-version.svg"
|
git add "$DEPLOYMENT_DIR/badges/pico-version.svg"
|
||||||
git commit \
|
git commit \
|
||||||
--message="Update version badge for $TRAVIS_TAG" \
|
--message="Update version badge for $TRAVIS_TAG" \
|
||||||
"$GIT_DIR/badges/pico-version.svg"
|
"$DEPLOYMENT_DIR/badges/pico-version.svg"
|
||||||
[ $? -eq 0 ] || exit 1
|
[ $? -eq 0 ] || exit 1
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user