From f062640bb1e87c82108067d238b47e7289ea11df Mon Sep 17 00:00:00 2001 From: theshka Date: Fri, 20 Nov 2015 23:28:09 -0600 Subject: [PATCH 1/7] test auto docs --- .travis.yml | 11 ++++++++++- build/gh-pages.sh | 31 +++++++++++++++++++++++++++++++ composer.json | 3 +++ 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 build/gh-pages.sh diff --git a/.travis.yml b/.travis.yml index 01b5c42..04c9e4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,17 @@ script: - find . -type f -name '*.php' -print0 | xargs -0 -I file php -l file > /dev/null before_deploy: + #update composer + - composer self-update + # install dependencies + req-dev - composer install + # Generate API documentation + - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then php vendor/bin/phpdoc -d $TRAVIS_BUILD_DIR -t $TRAVIS_BUILD_DIR/build/docs/$TRAVIS_TAG ; fi" + # Send documentation to Github Pages + - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then cd build/docs; bash ../gh-pages.sh; fi" + # remove req-dev depenedencies + - composer update --no-dev + # package Pico - tar -czf "pico-release-$TRAVIS_TAG.tar.gz" .htaccess README.md CHANGELOG.md CONTRIBUTING.md composer.json composer.lock LICENSE config content-sample lib plugins themes vendor index.php deploy: @@ -26,4 +36,3 @@ deploy: php: 5.3 sudo: false - diff --git a/build/gh-pages.sh b/build/gh-pages.sh new file mode 100644 index 0000000..1e821ff --- /dev/null +++ b/build/gh-pages.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# +# https://gist.github.com/domenic/ec8b0fc8ab45f39403dd +# + +# Exit with nonzero exit code if anything fails +set -e + +# Clone Pico, then create & checkout gh-pages branch +git clone -b gh-pages "https://github.com/theshka/Pico.git" + +# Inside this git repo we'll pretend to be a new user +git config user.name "theshka" +git config user.email "tyler@heshka.com" + +#move old files +mv $TRAVIS_BUILD_DIR/Pico/phpDoc/master $TRAVIS_BUILD_DIR/Pico/phpDoc/old-stable +#move new files +cp $TRAVIS_BUILD_DIR/build/docs/$TRAVIS_TAG $TRAVIS_BUILD_DIR/Pico/phpDoc/master + +# Add the files to our commit +git add $TRAVIS_BUILD_DIR/Pico/phpDoc/* + +# Commit the files with our commit message +git commit -m "update documentation" + +# Force push from the current repo's master branch to the remote +# repo's gh-pages branch.We redirect any output to +# /dev/null to hide any sensitive credential data that might otherwise be exposed. +#git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:gh-pages > /dev/null 2>&1 +git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:gh-pages > /dev/null 2>&1 diff --git a/composer.json b/composer.json index b0d75e1..b16ab1d 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,9 @@ "erusev/parsedown-extra": "0.7.*", "symfony/yaml" : "2.3" }, + "require-dev" : { + "phpdocumentor/phpdocumentor": "2.*" + }, "autoload": { "psr-0": { "Pico": "lib/", From 7f910e913f9629828b3535c7979b589bed906bdb Mon Sep 17 00:00:00 2001 From: theshka Date: Mon, 23 Nov 2015 11:59:05 -0600 Subject: [PATCH 2/7] update auto-docs files * [Changed] move everything inside /build/ directory Implement @PhrozenByte 's suggestions. * [Changed] don't change directories, pass the paths * [Removed] unnecessary `composer install`, travis-ci runs this already * [Removed] unnecessary `composer self-update` command * [Removed] unnecessary php version check on script --- .travis.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 04c9e4a..c03cc77 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,14 +12,10 @@ script: - find . -type f -name '*.php' -print0 | xargs -0 -I file php -l file > /dev/null before_deploy: - #update composer - - composer self-update - # install dependencies + req-dev - - composer install # Generate API documentation - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then php vendor/bin/phpdoc -d $TRAVIS_BUILD_DIR -t $TRAVIS_BUILD_DIR/build/docs/$TRAVIS_TAG ; fi" + - sh -c "php $TRAVIS_BUILD_DIR/vendor/bin/phpdoc -d $TRAVIS_BUILD_DIR -t $TRAVIS_BUILD_DIR/build/docs/pico-$TRAVIS_TAG" # Send documentation to Github Pages - - sh -c "if [ '$TRAVIS_PHP_VERSION' = '5.6' ]; then cd build/docs; bash ../gh-pages.sh; fi" + - sh -c "bash $TRAVIS_BUILD_DIR/build/deploy-phpdoc.sh;" # remove req-dev depenedencies - composer update --no-dev # package Pico From e0c63834066c6401bd2cc649a6cc1a6f78b1a20c Mon Sep 17 00:00:00 2001 From: theshka Date: Mon, 23 Nov 2015 12:03:53 -0600 Subject: [PATCH 3/7] rename script --- build/gh-pages.sh | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 build/gh-pages.sh diff --git a/build/gh-pages.sh b/build/gh-pages.sh deleted file mode 100644 index 1e821ff..0000000 --- a/build/gh-pages.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash -# -# https://gist.github.com/domenic/ec8b0fc8ab45f39403dd -# - -# Exit with nonzero exit code if anything fails -set -e - -# Clone Pico, then create & checkout gh-pages branch -git clone -b gh-pages "https://github.com/theshka/Pico.git" - -# Inside this git repo we'll pretend to be a new user -git config user.name "theshka" -git config user.email "tyler@heshka.com" - -#move old files -mv $TRAVIS_BUILD_DIR/Pico/phpDoc/master $TRAVIS_BUILD_DIR/Pico/phpDoc/old-stable -#move new files -cp $TRAVIS_BUILD_DIR/build/docs/$TRAVIS_TAG $TRAVIS_BUILD_DIR/Pico/phpDoc/master - -# Add the files to our commit -git add $TRAVIS_BUILD_DIR/Pico/phpDoc/* - -# Commit the files with our commit message -git commit -m "update documentation" - -# Force push from the current repo's master branch to the remote -# repo's gh-pages branch.We redirect any output to -# /dev/null to hide any sensitive credential data that might otherwise be exposed. -#git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:gh-pages > /dev/null 2>&1 -git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:gh-pages > /dev/null 2>&1 From bf2a9622db3c35b94eceaeb32d9e919dd18f36bf Mon Sep 17 00:00:00 2001 From: theshka Date: Mon, 23 Nov 2015 12:04:08 -0600 Subject: [PATCH 4/7] Update deploy script * [Changed] move everything inside /build/ directory * [Changed] use absolute file paths in script * [Changed] copy docs to both the release number and master dirs Implement @PhrozenByte 's suggestions. * [Changed] use `$GITHUB_OAUTH_TOKEN` instead of `$GITHUB_TOKEN` --- build/deploy-phpdoc.sh | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 build/deploy-phpdoc.sh diff --git a/build/deploy-phpdoc.sh b/build/deploy-phpdoc.sh new file mode 100644 index 0000000..921fc7b --- /dev/null +++ b/build/deploy-phpdoc.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# Modified from: https://gist.github.com/domenic/ec8b0fc8ab45f39403dd + +# Exit with nonzero exit code if anything fails +set -e + +# Clone Pico, then create & checkout gh-pages branch +git clone -b gh-pages "https://github.com/picocms/Pico.git $TRAVIS_BUILD_DIR/build/Pico" + +# Inside this git repo we'll pretend to be a new user +git config user.name "Travis CI" +git config user.email "travis-ci@picocms.org" + +#copy new files to release number +cp -a $TRAVIS_BUILD_DIR/build/docs/pico-$TRAVIS_TAG $TRAVIS_BUILD_DIR/build/Pico/phpDoc/pico-$TRAVIS_TAG +#move old files +mv -f $TRAVIS_BUILD_DIR/build/Pico/phpDoc/master $TRAVIS_BUILD_DIR/build/Pico/phpDoc/old-stable +#copy new files to master +cp -a $TRAVIS_BUILD_DIR/build/docs/pico-$TRAVIS_TAG $TRAVIS_BUILD_DIR/build/Pico/phpDoc/master + +# Add the files to our commit +git add $TRAVIS_BUILD_DIR/build/Pico/phpDoc/* + +# Commit the files with our commit message +git commit -m "Update Documentation for Pico $TRAVIS_TAG" + +# Force push from the current repo's master branch to the remote +# repo's gh-pages branch.We redirect any output to +# /dev/null to hide any sensitive credential data that might otherwise be exposed. +git push --force --quiet "https://${GITHUB_OAUTH_TOKEN}@${GH_REF}" master:gh-pages > /dev/null 2>&1 From edbf9f1747ebaf56a81c76fd673388901c6cebe3 Mon Sep 17 00:00:00 2001 From: theshka Date: Mon, 23 Nov 2015 12:07:54 -0600 Subject: [PATCH 5/7] Implement @PhrozenByte 's suggestions. * [Changed] require phpDocumentor version ^2.8 constraint --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index b16ab1d..2787259 100644 --- a/composer.json +++ b/composer.json @@ -18,7 +18,7 @@ "symfony/yaml" : "2.3" }, "require-dev" : { - "phpdocumentor/phpdocumentor": "2.*" + "phpdocumentor/phpdocumentor": "^2.8" }, "autoload": { "psr-0": { From 04f7140347e2bcb490058502c1fad7c36cbacc3b Mon Sep 17 00:00:00 2001 From: theshka Date: Mon, 23 Nov 2015 13:19:47 -0600 Subject: [PATCH 6/7] update .travis.yml for auto-docs --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c03cc77..2cc0f22 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ script: before_deploy: # Generate API documentation - - sh -c "php $TRAVIS_BUILD_DIR/vendor/bin/phpdoc -d $TRAVIS_BUILD_DIR -t $TRAVIS_BUILD_DIR/build/docs/pico-$TRAVIS_TAG" + - sh -c "php $TRAVIS_BUILD_DIR/vendor/bin/phpdoc -d $TRAVIS_BUILD_DIR -t $TRAVIS_BUILD_DIR/build/docs/$TRAVIS_TAG --ignore '*/vendor/*'" # Send documentation to Github Pages - sh -c "bash $TRAVIS_BUILD_DIR/build/deploy-phpdoc.sh;" # remove req-dev depenedencies From c3b908939f2664ad86f06b677ec50fc0757f0fbb Mon Sep 17 00:00:00 2001 From: theshka Date: Mon, 23 Nov 2015 13:26:31 -0600 Subject: [PATCH 7/7] update deploy-phpdoc.sh for auto docs --- build/deploy-phpdoc.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/build/deploy-phpdoc.sh b/build/deploy-phpdoc.sh index 921fc7b..0d447ed 100644 --- a/build/deploy-phpdoc.sh +++ b/build/deploy-phpdoc.sh @@ -12,11 +12,11 @@ git config user.name "Travis CI" git config user.email "travis-ci@picocms.org" #copy new files to release number -cp -a $TRAVIS_BUILD_DIR/build/docs/pico-$TRAVIS_TAG $TRAVIS_BUILD_DIR/build/Pico/phpDoc/pico-$TRAVIS_TAG -#move old files +cp -a $TRAVIS_BUILD_DIR/build/docs/$TRAVIS_TAG $TRAVIS_BUILD_DIR/build/Pico/phpDoc/$TRAVIS_TAG +#move old master files to old-stable mv -f $TRAVIS_BUILD_DIR/build/Pico/phpDoc/master $TRAVIS_BUILD_DIR/build/Pico/phpDoc/old-stable #copy new files to master -cp -a $TRAVIS_BUILD_DIR/build/docs/pico-$TRAVIS_TAG $TRAVIS_BUILD_DIR/build/Pico/phpDoc/master +cp -a $TRAVIS_BUILD_DIR/build/docs/$TRAVIS_TAG $TRAVIS_BUILD_DIR/build/Pico/phpDoc/master # Add the files to our commit git add $TRAVIS_BUILD_DIR/build/Pico/phpDoc/* @@ -24,7 +24,6 @@ git add $TRAVIS_BUILD_DIR/build/Pico/phpDoc/* # Commit the files with our commit message git commit -m "Update Documentation for Pico $TRAVIS_TAG" -# Force push from the current repo's master branch to the remote -# repo's gh-pages branch.We redirect any output to -# /dev/null to hide any sensitive credential data that might otherwise be exposed. -git push --force --quiet "https://${GITHUB_OAUTH_TOKEN}@${GH_REF}" master:gh-pages > /dev/null 2>&1 +# Force push from the current repo's gh-pages branch to the remote repo's gh-pages branch. +# We redirect output to /dev/null to hide any sensitive data that might otherwise be exposed. +git push --force --quiet "https://${GITHUB_OAUTH_TOKEN}@github.com/picocms/Pico.git" master:gh-pages > /dev/null 2>&1