From ba766ea65c2c5b65cc56ebcb72b2eb57ece921ee Mon Sep 17 00:00:00 2001 From: theshka Date: Wed, 18 Nov 2015 13:39:48 -0600 Subject: [PATCH 01/42] Update Build & Release section --- CONTRIBUTING.md | 63 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 64e5f52..5ec7925 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -78,44 +78,63 @@ As soon as development reaches a point where feedback is appreciated, a pull req Build & Release process ----------------------- -This is work in progress. Please refer to [#268](https://github.com/picocms/Pico/issues/268) for details. +> This is work in progress. Please refer to [#268](https://github.com/picocms/Pico/issues/268) for details. - From 8093758b3ed2d98d4b32f2a8723eb1d08fe41a9f Mon Sep 17 00:00:00 2001 From: theshka Date: Wed, 18 Nov 2015 15:26:39 -0600 Subject: [PATCH 02/42] Improve headings and formatting --- CONTRIBUTING.md | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5ec7925..7634a33 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -82,10 +82,10 @@ Build & Release process Defined below is a specification to which the Build and Release process of Pico should follow. We use [travis-ci](https://travis-ci.com) to automate the process, and each commit to `master` should be deployable. Once a `feature/branch` or the `master` branch have reached a point where the need for a version increase is necessary move through these phases to generate a Pico release. -#### Commit phase +### Commit phase - Make/Commit/Merge changes -- Use a formatted commit message +- Use a formatted commit message with contents of changelog Example: ``` @@ -102,7 +102,7 @@ Defined below is a specification to which the Build and Release process of Pico [SemVer](http://semver.org) increase to avoid the need for manual amendments.__ -#### Analysis phase +### Analysis phase Does the commit pass all `travis-ci` checks? @@ -110,31 +110,32 @@ Does the commit pass all `travis-ci` checks? If not, all errors will need to be corrected before the build can complete. -#### Packaging phase -`travis-ci` +### Packaging phase + +###### travis-ci - will run [composer](http://getcomposer.org) locally. - will create a ZIP archive (so vendor/ is included) -`manually` +###### manually - build current documentation using [PhpDocumentor](http://phpdoc.org), -#### Release phase -`travis-ci` +### Release phase + +###### travis-ci - will create new Git release at tag - will include the properly formatted commit message including the changelog of items since the last release. - will include ZIP archive in release -`manually` +###### manually - rename `docs/master` folder in `gh-pages` branch to the name of the previous Pico release. (e.g. `docs/pico-1.0.0`) - upload current documentation to the `gh-pages` branch `/docs/master` - - update release information on GitHub with: - Release title (taken from changelog) - Changelog -`automatically` +###### automatically - Pico will be automatically updated on [Packagist](http://packagist.org/packages/picocms/pico) -#### Announcements -- Where to announce new Pico release? +### Announcements +- Releases will be available at https://github.com/picocms/Pico/releases From 31d611a5077191c1a2dfbdbb67047734d3e78daf Mon Sep 17 00:00:00 2001 From: theshka Date: Wed, 18 Nov 2015 18:55:26 -0600 Subject: [PATCH 03/42] add template for new issues --- CONTRIBUTING.md | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7634a33..1edef44 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,6 +14,39 @@ If you want to report an *issue* with Pico's core, please create a new [Issue](h Before creating a [new Issue on GitHub](https://github.com/picocms/Pico/issues/new), please make sure the problem wasn't reported yet using [GitHubs search engine](https://github.com/picocms/Pico/search?type=Issues). Please describe your issue as clear as possible and always include steps to reproduce the problem. +This is an example of what information to include with your issue. + + Version + - Operating System and version + - Pico Version + - other installed software, plugins, if applicable + - hardware information, if applicable + + Bug Description + - A concise description of what the problem is. Pure description, no narrative or conversational language. + + Severity + - Trivial, Minor, Major, or Catastrophic + + Steps to Reproduce + - Step by step instructions on how to reproduce this bug. + - Do not assume anything, the more detailed your list of instructions, the easier it is for the developer to track down the problem! + + Actual Behavior + - Type what happens when you follow the instructions. This is the manifestation of the bug. + + Expected Behavior + - Type what you expected to happen when you followed the instructions. + - This is important, because you may have misunderstood something or missed a step, + and knowing what you expected to see will help the developer recognize that. + + Troubleshooting/Testing Steps Attempted + - Describe anything you did to try to fix it on your own. + + Workaround + - If you found a way to make the program work in spite of the bug, describe how you did it here. + + Contributing code ----------------- From f6d5e8c7f40e101ab4a4367bce5ea5560a9015ce Mon Sep 17 00:00:00 2001 From: theshka Date: Fri, 20 Nov 2015 20:30:56 -0600 Subject: [PATCH 04/42] can phpDoc be automatic? --- CONTRIBUTING.md | 34 ++++++++++++++++++++++++++++------ 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1edef44..827f583 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -113,12 +113,12 @@ Build & Release process > This is work in progress. Please refer to [#268](https://github.com/picocms/Pico/issues/268) for details. -Defined below is a specification to which the Build and Release process of Pico should follow. We use [travis-ci](https://travis-ci.com) to automate the process, and each commit to `master` should be deployable. Once a `feature/branch` or the `master` branch have reached a point where the need for a version increase is necessary move through these phases to generate a Pico release. +Defined below is a specification to which the Build and Release process of Pico should follow. We use [travis-ci](https://travis-ci.com) to automate the process, and each commit to `master` should be deployable. Once a `feature/branch` or the `master` branch have reached a point where the need for a version increase is necessary, move through these phases to generate a Pico release. ### Commit phase - Make/Commit/Merge changes -- Use a formatted commit message with contents of changelog +- Use a formatted commit message with contents of `CHANGELOG.md` since last release. Example: ``` @@ -141,6 +141,10 @@ Does the commit pass all `travis-ci` checks? - We test PHP 5.3, 5.4, 5.5, 5.6, 7, the nighlty build, and HHVM +- should we `allow_failures:` in `.tavis.yml?` + - php: hhvm + - php: 7 + If not, all errors will need to be corrected before the build can complete. ### Packaging phase @@ -151,7 +155,24 @@ If not, all errors will need to be corrected before the build can complete. ###### manually -- build current documentation using [PhpDocumentor](http://phpdoc.org), +- build current documentation using [PhpDocumentor](http://phpdoc.org) + + `phpdoc -d path/to/Pico/ -t path/to/Pico/build/docs/master` + + When running `phpDocumentor` there are three command-line options that are essential: + - `-d`, specifies the directory, or directories, of your project that you want to document. + - `-f`, specifies a specific file, or files, in your project that you want to document. + - `-t`, specifies the location where your documentation will be written (also called ‘target folder’). + +TO-DO: in the future, this should be automatic. +- can `phpDocumentor` be included in Pico's `composer.json`? +- can `travis-ci` run `phpDocumentor`? `php vendor/bin/phpdoc ...` +- can `travis-ci` run a shell script to: + - `git clone`, `git add`, `git commit`, `git push` to `gh-pages`? + e.g. `git clone -b gh-pages "https://github.com/picocms/Pico.git"` + - (below) rename `docs/master` ... + - `git push` +- organize in `build` folder? ### Release phase @@ -161,11 +182,12 @@ If not, all errors will need to be corrected before the build can complete. - will include ZIP archive in release ###### manually +TO-DO: in the future, this should be automatic. (See above) - rename `docs/master` folder in `gh-pages` branch to the name of the previous Pico release. (e.g. `docs/pico-1.0.0`) -- upload current documentation to the `gh-pages` branch `/docs/master` +- upload current documentation to the `gh-pages` branch `/docs/master` - update release information on GitHub with: - - Release title (taken from changelog) - - Changelog + - release title (taken from changelog) + - changelog ###### automatically - Pico will be automatically updated on [Packagist](http://packagist.org/packages/picocms/pico) From f062640bb1e87c82108067d238b47e7289ea11df Mon Sep 17 00:00:00 2001 From: theshka Date: Fri, 20 Nov 2015 23:28:09 -0600 Subject: [PATCH 05/42] 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 06/42] 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 07/42] 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 08/42] 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 09/42] 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 10/42] 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 11/42] 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 From 7f4ad752454278a1a5ee50259737b1f4534a0778 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Mon, 23 Nov 2015 21:46:36 +0100 Subject: [PATCH 12/42] Refactor phpDoc auto-deployment --- .gitignore | 4 ++++ .travis.yml | 13 +++++-------- build/deploy-phpdoc.sh | 40 ++++++++++++++++++++-------------------- 3 files changed, 29 insertions(+), 28 deletions(-) diff --git a/.gitignore b/.gitignore index 01cdfee..25d5f39 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,10 @@ desktop.ini .DS_Store ._* +# Travis +/build/phpdoc-*/ +/build/phpdoc-*.git/ + # Composer composer.lock composer.phar diff --git a/.travis.yml b/.travis.yml index 2cc0f22..5a0544f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,14 +12,11 @@ script: - find . -type f -name '*.php' -print0 | xargs -0 -I file php -l file > /dev/null before_deploy: - # Generate API documentation - - 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 - - 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 + - composer install + - ./vendor/bin/phpdoc -d . -i 'vendor/*' -i 'plugins/*' -f 'plugins/DummyPlugin.php' -t "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" --title "Pico 1.0 API Documentation ($TRAVIS_TAG)" + - ./build/deploy-phpdoc.sh "picocms/Pico" "gh-pages" "$GITHUB_OAUTH_TOKEN" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "phpDoc/$TRAVIS_TAG" + - composer install --no-dev + - tar -czf "pico-release-$TRAVIS_TAG.tar.gz" README.md LICENSE CONTRIBUTING.md CHANGELOG.md composer.json composer.lock config content-sample lib plugins themes vendor .htaccess index.php deploy: provider: releases diff --git a/build/deploy-phpdoc.sh b/build/deploy-phpdoc.sh index 0d447ed..6a5d0b8 100644 --- a/build/deploy-phpdoc.sh +++ b/build/deploy-phpdoc.sh @@ -1,29 +1,29 @@ #!/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" +# parameters +GITHUB_PROJECT="$1" # GitHub repo (e.g. picocms/Pico) +GITHUB_BRANCH="$2" # branch to use (e.g. gh-pages) +GITHUB_OAUTH_TOKEN="$3" # see https://github.com/settings/tokens +SOURCE_DIR="$4" # absolute path to phpDocs target directory +TARGET_DIR="$5" # relative path within the specified GitHub repo -# Inside this git repo we'll pretend to be a new user +# clone repo +GIT_DIR="$(dirname "$0")/$(basename "$SOURCE_DIR").git" +git clone -b "$GITHUB_BRANCH" "https://github.com/$GITHUB_PROJECT.git" "$GIT_DIR" + +# setup git +cd "$GIT_DIR" 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/$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/$TRAVIS_TAG $TRAVIS_BUILD_DIR/build/Pico/phpDoc/master +# copy phpdoc +[ -e "$TARGET_DIR" ] && echo "FATAL: $(basename "$0") target directory exists" && exit 1 +cp -R "$SOURCE_DIR" "$TARGET_DIR" -# Add the files to our commit -git add $TRAVIS_BUILD_DIR/build/Pico/phpDoc/* +# commit changes +git add "$TARGET_DIR" +git commit -m "Add phpDocumentor class docs for Pico $TRAVIS_TAG" -# Commit the files with our commit message -git commit -m "Update Documentation for Pico $TRAVIS_TAG" - -# 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 +# push changes +git push --force --quiet "https://${GITHUB_OAUTH_TOKEN}@github.com/$GITHUB_PROJECT.git" "$GITHUB_BRANCH:$GITHUB_BRANCH" > /dev/null 2>&1 From 9712ae2a97dc9adb52f029631669f1367328a91b Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Mon, 23 Nov 2015 21:52:23 +0100 Subject: [PATCH 13/42] Fix permissions of build/deploy-phpdoc.sh --- build/deploy-phpdoc.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build/deploy-phpdoc.sh diff --git a/build/deploy-phpdoc.sh b/build/deploy-phpdoc.sh old mode 100644 new mode 100755 From 80049ed9666bdc96d0bdad7f31057b3c7b2a653b Mon Sep 17 00:00:00 2001 From: theshka Date: Mon, 23 Nov 2015 15:51:12 -0600 Subject: [PATCH 14/42] update build & release section for auto-docs --- CONTRIBUTING.md | 50 ++++++++++++------------------------------------- 1 file changed, 12 insertions(+), 38 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 827f583..aa812cb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -141,56 +141,30 @@ Does the commit pass all `travis-ci` checks? - We test PHP 5.3, 5.4, 5.5, 5.6, 7, the nighlty build, and HHVM -- should we `allow_failures:` in `.tavis.yml?` - - php: hhvm - - php: 7 - If not, all errors will need to be corrected before the build can complete. ### Packaging phase ###### travis-ci -- will run [composer](http://getcomposer.org) locally. +- will run [composer](http://getcomposer.org) locally with `req-dev` dependencies. +- will generate [PhpDocumentor](http://phpdoc.org) class docs automatically +- will run our `deploy-phpdoc.sh` script - will create a ZIP archive (so vendor/ is included) -###### manually - -- build current documentation using [PhpDocumentor](http://phpdoc.org) - - `phpdoc -d path/to/Pico/ -t path/to/Pico/build/docs/master` - - When running `phpDocumentor` there are three command-line options that are essential: - - `-d`, specifies the directory, or directories, of your project that you want to document. - - `-f`, specifies a specific file, or files, in your project that you want to document. - - `-t`, specifies the location where your documentation will be written (also called ‘target folder’). - -TO-DO: in the future, this should be automatic. -- can `phpDocumentor` be included in Pico's `composer.json`? -- can `travis-ci` run `phpDocumentor`? `php vendor/bin/phpdoc ...` -- can `travis-ci` run a shell script to: - - `git clone`, `git add`, `git commit`, `git push` to `gh-pages`? - e.g. `git clone -b gh-pages "https://github.com/picocms/Pico.git"` - - (below) rename `docs/master` ... - - `git push` -- organize in `build` folder? - ### Release phase ###### travis-ci +- will remove phpDocumentor from dependencies - will create new Git release at tag -- will include the properly formatted commit message including the changelog of items since the last release. +- will include the properly formatted commit message including the changelog of items since the last release. - will include ZIP archive in release -###### manually -TO-DO: in the future, this should be automatic. (See above) -- rename `docs/master` folder in `gh-pages` branch to the name of the previous Pico release. (e.g. `docs/pico-1.0.0`) -- upload current documentation to the `gh-pages` branch `/docs/master` -- update release information on GitHub with: - - release title (taken from changelog) - - changelog - -###### automatically -- Pico will be automatically updated on [Packagist](http://packagist.org/packages/picocms/pico) +###### Note: +If a properly formatted commit message was not provided, you may have to update release information on GitHub with: +- release title (taken from changelog) +- changelog ### Announcements -- Releases will be available at https://github.com/picocms/Pico/releases +- Releases will be available at: [https://github.com/picocms/Pico/releases](https://github.com/picocms/Pico/releases) + +- Pico will be automatically updated on [Packagist](http://packagist.org/packages/picocms/pico) From c9387610f3372ac62596cfc8b049985f488005d1 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 25 Nov 2015 20:39:49 +0100 Subject: [PATCH 15/42] Auto-generate phpDoc when committing to master --- .travis.yml | 26 +++++++++++--- build/deploy-phpdoc.sh | 75 ++++++++++++++++++++++++++++++++++------ build/generate-phpdoc.sh | 14 ++++++++ 3 files changed, 99 insertions(+), 16 deletions(-) create mode 100644 build/generate-phpdoc.sh diff --git a/.travis.yml b/.travis.yml index 06f34e8..71359de 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,15 +13,31 @@ matrix: - php: nightly fast-finish: true +install: + - composer install + +before_script: + - export PATH="$TRAVIS_BUILD_DIR/vendor/bin:$PATH" + script: - find . -not \( -path './vendor' -prune \) -type f -name '*.php' -print0 | xargs -0 -I file php -l file > /dev/null +after_success: + - | + [ "$DEPLOY_PHPDOC" == "yes" ] && ( + [ "$TRAVIS_BRANCH" == "master" ] && [ -z "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ( + ./build/generate-phpdoc.sh . "$TRAVIS_BUILD_DIR/build/phpdoc-master" "Pico 1.0 API Documentation (master@$TRAVIS_COMMIT)" + ./build/deploy-phpdoc.sh "$TRAVIS_BUILD_DIR/build/phpdoc-master" "$TRAVIS_REPO_SLUG" "gh-pages" "master@$TRAVIS_COMMIT" + ) + ) + before_deploy: - - composer install - - ./vendor/bin/phpdoc -d . -i 'vendor/*' -i 'plugins/*' -f 'plugins/DummyPlugin.php' -t "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" --title "Pico 1.0 API Documentation ($TRAVIS_TAG)" - - ./build/deploy-phpdoc.sh "picocms/Pico" "gh-pages" "$GITHUB_OAUTH_TOKEN" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "phpDoc/$TRAVIS_TAG" - - composer install --no-dev - - composer dump-autoload --optimize + - | + [ "$DEPLOY_PHPDOC" == "yes" ] && ( + ./build/generate-phpdoc.sh . "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "Pico 1.0 API Documentation ($TRAVIS_TAG)" + ./build/deploy-phpdoc.sh "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "$TRAVIS_REPO_SLUG" "gh-pages" "$TRAVIS_TAG" + ) + - composer install --no-dev --optimize-autoloader - tar -czf "pico-release-$TRAVIS_TAG.tar.gz" README.md LICENSE CONTRIBUTING.md CHANGELOG.md composer.json composer.lock config content-sample lib plugins themes vendor .htaccess index.php deploy: diff --git a/build/deploy-phpdoc.sh b/build/deploy-phpdoc.sh index 6a5d0b8..f7420b0 100755 --- a/build/deploy-phpdoc.sh +++ b/build/deploy-phpdoc.sh @@ -1,29 +1,82 @@ #!/usr/bin/env bash +APP_NAME="$(basename "$0")" +BASE_PWD="$PWD" set -e +# environment variables +# GITHUB_OAUTH_TOKEN GitHub authentication token, see https://github.com/settings/tokens + # parameters -GITHUB_PROJECT="$1" # GitHub repo (e.g. picocms/Pico) -GITHUB_BRANCH="$2" # branch to use (e.g. gh-pages) -GITHUB_OAUTH_TOKEN="$3" # see https://github.com/settings/tokens -SOURCE_DIR="$4" # absolute path to phpDocs target directory -TARGET_DIR="$5" # relative path within the specified GitHub repo +SOURCE_DIR="$1" # absolute local source path +TARGET_REPO_SLUG="$2" # target repo (e.g. picocms/Pico) +TARGET_BRANCH="$3" # target branch (e.g. gh-pages) +TARGET_REF="$4" # target reference (either [branch]@[commit], [branch] or [tag]) + +# evaluate target reference +if git check-ref-format "tags/$TARGET_REF"; then + TARGET_REF_TYPE="tag" + TARGET_REF_TAG="$TARGET_REF" + TARGET_DIR="$TARGET_REF_TAG" +elif [[ "$TARGET_REF" == *@* ]]; then + TARGET_REF_TYPE="commit" + TARGET_REF_BRANCH="${TARGET_REF%@*}" + TARGET_REF_COMMIT="${TARGET_REF##*@}" + TARGET_DIR="$TARGET_REF_BRANCH" + + if ! git check-ref-format "heads/$TARGET_REF_BRANCH"; then + echo "FATAL: $APP_NAME target reference '$TARGET_REF' is invalid" >&2 + exit 1 + fi +elif git check-ref-format "heads/$TARGET_REF"; then + TARGET_REF_TYPE="branch" + TARGET_REF_BRANCH="$TARGET_REF" + TARGET_DIR="$TARGET_REF_BRANCH" +else + echo "FATAL: $APP_NAME target reference '$TARGET_REF' is invalid" >&2 + exit 1 +fi # clone repo -GIT_DIR="$(dirname "$0")/$(basename "$SOURCE_DIR").git" -git clone -b "$GITHUB_BRANCH" "https://github.com/$GITHUB_PROJECT.git" "$GIT_DIR" +GIT_DIR="$SOURCE_DIR.git" +git clone -b "$TARGET_BRANCH" "https://github.com/$TARGET_REPO_SLUG.git" "$GIT_DIR" # setup git cd "$GIT_DIR" git config user.name "Travis CI" git config user.email "travis-ci@picocms.org" +[ -n "$GITHUB_OAUTH_TOKEN" ] && git config credential.https://github.com.username "$GITHUB_OAUTH_TOKEN" # copy phpdoc -[ -e "$TARGET_DIR" ] && echo "FATAL: $(basename "$0") target directory exists" && exit 1 -cp -R "$SOURCE_DIR" "$TARGET_DIR" +[ -e "$TARGET_DIR" ] && echo "FATAL: $(basename "$0") target directory '$TARGET_DIR' exists" >&2 && exit 1 +[ "${SOURCE_DIR:0:1}" == "/" ] || SOURCE_DIR="$BASE_PWD/$SOURCE_DIR" +cp -R "$SOURCE_DIR" "phpDoc/$TARGET_DIR" # commit changes git add "$TARGET_DIR" -git commit -m "Add phpDocumentor class docs for Pico $TRAVIS_TAG" +git commit -m "Add phpDocumentor class docs for $TARGET_REF" + +# very simple race condition protection for concurrent Travis builds +# this is no definite protection (race conditions are still possible during `git push`), +# but it should give a basic protection without disabling concurrent builds completely +if [ "$TARGET_REF_TYPE" == "commit" ]; then + # get latest commit + LATEST_COMMIT="$(wget -O- "https://api.github.com/repos/$TARGET_REPO_SLUG/git/refs/heads/$TARGET_REF_BRANCH" 2> /dev/null | php -r " + \$json = json_decode(stream_get_contents(STDIN), true); + if (\$json !== null) { + if (isset(\$json['ref']) && (\$json['ref'] === 'refs/heads/$TARGET_REF_BRANCH')) { + if (isset(\$json['object']) && isset(\$json['object']['sha'])) { + echo \$json['object']['sha']; + } + } + } + ")" + + # compare target reference against the latest commit + if [ "$LATEST_COMMIT" != "$TARGET_REF_COMMIT" ]; then + echo "WARNING: $APP_NAME target reference '$TARGET_REF' doesn't match the latest commit '$LATEST_COMMIT'" >&2 + exit 0 + fi +fi # push changes -git push --force --quiet "https://${GITHUB_OAUTH_TOKEN}@github.com/$GITHUB_PROJECT.git" "$GITHUB_BRANCH:$GITHUB_BRANCH" > /dev/null 2>&1 +git push "https://github.com/$TARGET_REPO_SLUG.git" "$TARGET_BRANCH:$TARGET_BRANCH" diff --git a/build/generate-phpdoc.sh b/build/generate-phpdoc.sh new file mode 100644 index 0000000..5a01653 --- /dev/null +++ b/build/generate-phpdoc.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +set -e + +# parameters +PHPDOC_SOURCE_DIR="$1" +PHPDOC_TARGET_DIR="$2" +PHPDOC_TITLE="$3" + +# generate phpdoc +phpdoc -d "$PHPDOC_SOURCE_DIR" \ + -i 'build/*' -i 'vendor/*' -i 'plugins/*' \ + -f 'plugins/DummyPlugin.php' \ + -t "$PHPDOC_TARGET_DIR" \ + --title "$PHPDOC_TITLE" From 586282526595ba6d8502fe430cfee212612adb77 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 25 Nov 2015 20:56:13 +0100 Subject: [PATCH 16/42] Travis: Deploy phpDocs on PHP 5.3 only and allow multiple branches --- .travis.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 71359de..da54042 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,8 +24,8 @@ script: after_success: - | - [ "$DEPLOY_PHPDOC" == "yes" ] && ( - [ "$TRAVIS_BRANCH" == "master" ] && [ -z "$TRAVIS_TAG" ] && [ "$TRAVIS_PULL_REQUEST" == "false" ] && ( + [[ ",$DEPLOY_PHPDOC_BRANCHES," == *,"$TRAVIS_BRANCH",* ]] && [ "$TRAVIS_PHP_VERSION" == "5.3" ] ( + [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ -z "$TRAVIS_TAG" ] ( ./build/generate-phpdoc.sh . "$TRAVIS_BUILD_DIR/build/phpdoc-master" "Pico 1.0 API Documentation (master@$TRAVIS_COMMIT)" ./build/deploy-phpdoc.sh "$TRAVIS_BUILD_DIR/build/phpdoc-master" "$TRAVIS_REPO_SLUG" "gh-pages" "master@$TRAVIS_COMMIT" ) @@ -33,7 +33,7 @@ after_success: before_deploy: - | - [ "$DEPLOY_PHPDOC" == "yes" ] && ( + [ "$DEPLOY_PHPDOC_TAGS" == "true" ] && ( ./build/generate-phpdoc.sh . "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "Pico 1.0 API Documentation ($TRAVIS_TAG)" ./build/deploy-phpdoc.sh "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "$TRAVIS_REPO_SLUG" "gh-pages" "$TRAVIS_TAG" ) From e4165d35b17581464868ed867e74bc7c6e57c2e8 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 25 Nov 2015 20:59:29 +0100 Subject: [PATCH 17/42] Fix .travis.yml --- .travis.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index da54042..0f4f888 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,8 +24,8 @@ script: after_success: - | - [[ ",$DEPLOY_PHPDOC_BRANCHES," == *,"$TRAVIS_BRANCH",* ]] && [ "$TRAVIS_PHP_VERSION" == "5.3" ] ( - [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ -z "$TRAVIS_TAG" ] ( + [[ ",$DEPLOY_PHPDOC_BRANCHES," == *,"$TRAVIS_BRANCH",* ]] && [ "$TRAVIS_PHP_VERSION" == "5.3" ] && ( + [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ -z "$TRAVIS_TAG" ] && ( ./build/generate-phpdoc.sh . "$TRAVIS_BUILD_DIR/build/phpdoc-master" "Pico 1.0 API Documentation (master@$TRAVIS_COMMIT)" ./build/deploy-phpdoc.sh "$TRAVIS_BUILD_DIR/build/phpdoc-master" "$TRAVIS_REPO_SLUG" "gh-pages" "master@$TRAVIS_COMMIT" ) From 32120e5bbc198b4f49a954c3d0316bf2ec279e97 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 25 Nov 2015 21:02:43 +0100 Subject: [PATCH 18/42] Fix build/generate-phpdoc.sh permissions --- build/generate-phpdoc.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 build/generate-phpdoc.sh diff --git a/build/generate-phpdoc.sh b/build/generate-phpdoc.sh old mode 100644 new mode 100755 From 9a46033141ca77e64f8cc95bb4bec382edd0f785 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 25 Nov 2015 21:36:56 +0100 Subject: [PATCH 19/42] Improve phpDocs auto-generation --- .travis.yml | 8 +++-- build/deploy-phpdoc.sh | 65 +++++++++++++++++++++------------------- build/generate-phpdoc.sh | 1 + 3 files changed, 41 insertions(+), 33 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0f4f888..9212024 100644 --- a/.travis.yml +++ b/.travis.yml @@ -25,9 +25,10 @@ script: after_success: - | [[ ",$DEPLOY_PHPDOC_BRANCHES," == *,"$TRAVIS_BRANCH",* ]] && [ "$TRAVIS_PHP_VERSION" == "5.3" ] && ( - [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ -z "$TRAVIS_TAG" ] && ( + [ "$TRAVIS_SECURE_ENV_VARS" == "true" ] && [ -z "$TRAVIS_TAG" ] && ( ./build/generate-phpdoc.sh . "$TRAVIS_BUILD_DIR/build/phpdoc-master" "Pico 1.0 API Documentation (master@$TRAVIS_COMMIT)" - ./build/deploy-phpdoc.sh "$TRAVIS_BUILD_DIR/build/phpdoc-master" "$TRAVIS_REPO_SLUG" "gh-pages" "master@$TRAVIS_COMMIT" + printf '\n' + ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-master" "master@$TRAVIS_COMMIT" "phpDoc/master" "gh-pages" ) ) @@ -35,7 +36,8 @@ before_deploy: - | [ "$DEPLOY_PHPDOC_TAGS" == "true" ] && ( ./build/generate-phpdoc.sh . "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "Pico 1.0 API Documentation ($TRAVIS_TAG)" - ./build/deploy-phpdoc.sh "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "$TRAVIS_REPO_SLUG" "gh-pages" "$TRAVIS_TAG" + printf '\n' + ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "$TRAVIS_TAG" "phpDoc/$TRAVIS_TAG" "gh-pages" ) - composer install --no-dev --optimize-autoloader - tar -czf "pico-release-$TRAVIS_TAG.tar.gz" README.md LICENSE CONTRIBUTING.md CHANGELOG.md composer.json composer.lock config content-sample lib plugins themes vendor .htaccess index.php diff --git a/build/deploy-phpdoc.sh b/build/deploy-phpdoc.sh index f7420b0..44d7424 100755 --- a/build/deploy-phpdoc.sh +++ b/build/deploy-phpdoc.sh @@ -7,38 +7,39 @@ set -e # GITHUB_OAUTH_TOKEN GitHub authentication token, see https://github.com/settings/tokens # parameters -SOURCE_DIR="$1" # absolute local source path -TARGET_REPO_SLUG="$2" # target repo (e.g. picocms/Pico) -TARGET_BRANCH="$3" # target branch (e.g. gh-pages) -TARGET_REF="$4" # target reference (either [branch]@[commit], [branch] or [tag]) +GITHUB_SLUG="$1" # GitHub repo (e.g. picocms/Pico) +SOURCE_DIR="$2" # absolute source path +SOURCE_REF="$3" # source reference (either [branch]@[commit], [branch] or [tag]) +TARGET_DIR="$4" # relative target path +TARGET_BRANCH="$5" # target branch (e.g. gh-pages) + +printf 'Deploying phpDocs (%s (%s) --> %s:%s/%s)...\n' "$SOURCE_DIR" "$SOURCE_REF" "$GITHUB_SLUG" "$TARGET_BRANCH" "$TARGET_DIR" # evaluate target reference -if git check-ref-format "tags/$TARGET_REF"; then - TARGET_REF_TYPE="tag" - TARGET_REF_TAG="$TARGET_REF" - TARGET_DIR="$TARGET_REF_TAG" -elif [[ "$TARGET_REF" == *@* ]]; then - TARGET_REF_TYPE="commit" - TARGET_REF_BRANCH="${TARGET_REF%@*}" - TARGET_REF_COMMIT="${TARGET_REF##*@}" - TARGET_DIR="$TARGET_REF_BRANCH" +if git check-ref-format "tags/$SOURCE_REF"; then + SOURCE_REF_TYPE="tag" + SOURCE_REF_TAG="$SOURCE_REF" +elif [[ "$SOURCE_REF" == *@* ]]; then + SOURCE_REF_TYPE="commit" + SOURCE_REF_BRANCH="${SOURCE_REF%@*}" + SOURCE_REF_COMMIT="${SOURCE_REF##*@}" - if ! git check-ref-format "heads/$TARGET_REF_BRANCH"; then - echo "FATAL: $APP_NAME target reference '$TARGET_REF' is invalid" >&2 + if ! git check-ref-format "heads/$SOURCE_REF_BRANCH"; then + echo "FATAL: $APP_NAME target reference '$SOURCE_REF' is invalid" >&2 exit 1 fi -elif git check-ref-format "heads/$TARGET_REF"; then - TARGET_REF_TYPE="branch" - TARGET_REF_BRANCH="$TARGET_REF" - TARGET_DIR="$TARGET_REF_BRANCH" +elif git check-ref-format "heads/$SOURCE_REF"; then + SOURCE_REF_TYPE="branch" + SOURCE_REF_BRANCH="$SOURCE_REF" else - echo "FATAL: $APP_NAME target reference '$TARGET_REF' is invalid" >&2 + echo "FATAL: $APP_NAME target reference '$SOURCE_REF' is invalid" >&2 exit 1 fi # clone repo +printf '\nCloning %s branch of %s...\n' "$TARGET_BRANCH" "https://github.com/$GITHUB_SLUG.git" GIT_DIR="$SOURCE_DIR.git" -git clone -b "$TARGET_BRANCH" "https://github.com/$TARGET_REPO_SLUG.git" "$GIT_DIR" +git clone -b "$TARGET_BRANCH" "https://github.com/$GITHUB_SLUG.git" "$GIT_DIR" # setup git cd "$GIT_DIR" @@ -47,23 +48,26 @@ git config user.email "travis-ci@picocms.org" [ -n "$GITHUB_OAUTH_TOKEN" ] && git config credential.https://github.com.username "$GITHUB_OAUTH_TOKEN" # copy phpdoc -[ -e "$TARGET_DIR" ] && echo "FATAL: $(basename "$0") target directory '$TARGET_DIR' exists" >&2 && exit 1 +[ ! -d "$TARGET_DIR" ] || rm -rf "$TARGET_DIR" [ "${SOURCE_DIR:0:1}" == "/" ] || SOURCE_DIR="$BASE_PWD/$SOURCE_DIR" -cp -R "$SOURCE_DIR" "phpDoc/$TARGET_DIR" +printf '\nCopying phpDoc (%s --> %s)...\n' "$SOURCE_DIR" "$GIT_DIR/$TARGET_DIR" +cp -R "$SOURCE_DIR" "$TARGET_DIR" # commit changes +printf '\nCommiting changes...\n' git add "$TARGET_DIR" -git commit -m "Add phpDocumentor class docs for $TARGET_REF" +git commit -m "Add phpDocumentor class docs for $SOURCE_REF" # very simple race condition protection for concurrent Travis builds # this is no definite protection (race conditions are still possible during `git push`), # but it should give a basic protection without disabling concurrent builds completely -if [ "$TARGET_REF_TYPE" == "commit" ]; then +if [ "$SOURCE_REF_TYPE" == "commit" ]; then # get latest commit - LATEST_COMMIT="$(wget -O- "https://api.github.com/repos/$TARGET_REPO_SLUG/git/refs/heads/$TARGET_REF_BRANCH" 2> /dev/null | php -r " + printf '\nRetrieving latest commit of %s:%s' "$GITHUB_SLUG" "$SOURCE_REF_BRANCH" + LATEST_COMMIT="$(wget -O- "https://api.github.com/repos/$GITHUB_SLUG/git/refs/heads/$SOURCE_REF_BRANCH" 2> /dev/null | php -r " \$json = json_decode(stream_get_contents(STDIN), true); if (\$json !== null) { - if (isset(\$json['ref']) && (\$json['ref'] === 'refs/heads/$TARGET_REF_BRANCH')) { + if (isset(\$json['ref']) && (\$json['ref'] === 'refs/heads/$SOURCE_REF_BRANCH')) { if (isset(\$json['object']) && isset(\$json['object']['sha'])) { echo \$json['object']['sha']; } @@ -72,11 +76,12 @@ if [ "$TARGET_REF_TYPE" == "commit" ]; then ")" # compare target reference against the latest commit - if [ "$LATEST_COMMIT" != "$TARGET_REF_COMMIT" ]; then - echo "WARNING: $APP_NAME target reference '$TARGET_REF' doesn't match the latest commit '$LATEST_COMMIT'" >&2 + if [ "$LATEST_COMMIT" != "$SOURCE_REF_COMMIT" ]; then + echo "WARNING: $APP_NAME target reference '$SOURCE_REF' doesn't match the latest commit '$LATEST_COMMIT'" >&2 exit 0 fi fi # push changes -git push "https://github.com/$TARGET_REPO_SLUG.git" "$TARGET_BRANCH:$TARGET_BRANCH" +printf '\nPushing changes...\n' +git push "https://github.com/$GITHUB_SLUG.git" "$TARGET_BRANCH:$TARGET_BRANCH" diff --git a/build/generate-phpdoc.sh b/build/generate-phpdoc.sh index 5a01653..0cbad7b 100755 --- a/build/generate-phpdoc.sh +++ b/build/generate-phpdoc.sh @@ -7,6 +7,7 @@ PHPDOC_TARGET_DIR="$2" PHPDOC_TITLE="$3" # generate phpdoc +printf 'Generating phpDocs (%s --> %s; "%s")...\n' "$PHPDOC_SOURCE_DIR" "$PHPDOC_TARGET_DIR" "$PHPDOC_TITLE" phpdoc -d "$PHPDOC_SOURCE_DIR" \ -i 'build/*' -i 'vendor/*' -i 'plugins/*' \ -f 'plugins/DummyPlugin.php' \ From 3852585ba0b1b4b6bee95217b261c1ddfc5e73b8 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 25 Nov 2015 21:55:28 +0100 Subject: [PATCH 20/42] Improve phpDocs auto-generation --- .travis.yml | 10 ++++------ build/deploy-phpdoc.sh | 16 ++++++++++++---- build/generate-phpdoc.sh | 9 ++++++++- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9212024..a613974 100644 --- a/.travis.yml +++ b/.travis.yml @@ -26,18 +26,16 @@ after_success: - | [[ ",$DEPLOY_PHPDOC_BRANCHES," == *,"$TRAVIS_BRANCH",* ]] && [ "$TRAVIS_PHP_VERSION" == "5.3" ] && ( [ "$TRAVIS_SECURE_ENV_VARS" == "true" ] && [ -z "$TRAVIS_TAG" ] && ( - ./build/generate-phpdoc.sh . "$TRAVIS_BUILD_DIR/build/phpdoc-master" "Pico 1.0 API Documentation (master@$TRAVIS_COMMIT)" - printf '\n' - ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-master" "master@$TRAVIS_COMMIT" "phpDoc/master" "gh-pages" + ./build/generate-phpdoc.sh . "build/phpdoc-master" "Pico 1.0 API Documentation (master)" + ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "build/phpdoc-master" "master@$TRAVIS_COMMIT" "phpDoc/master" "gh-pages" ) ) before_deploy: - | [ "$DEPLOY_PHPDOC_TAGS" == "true" ] && ( - ./build/generate-phpdoc.sh . "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "Pico 1.0 API Documentation ($TRAVIS_TAG)" - printf '\n' - ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "$TRAVIS_TAG" "phpDoc/$TRAVIS_TAG" "gh-pages" + ./build/generate-phpdoc.sh . "build/phpdoc-$TRAVIS_TAG" "Pico 1.0 API Documentation ($TRAVIS_TAG)" + ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "build/phpdoc-$TRAVIS_TAG" "$TRAVIS_TAG" "phpDoc/$TRAVIS_TAG" "gh-pages" ) - composer install --no-dev --optimize-autoloader - tar -czf "pico-release-$TRAVIS_TAG.tar.gz" README.md LICENSE CONTRIBUTING.md CHANGELOG.md composer.json composer.lock config content-sample lib plugins themes vendor .htaccess index.php diff --git a/build/deploy-phpdoc.sh b/build/deploy-phpdoc.sh index 44d7424..f68d1dd 100755 --- a/build/deploy-phpdoc.sh +++ b/build/deploy-phpdoc.sh @@ -13,7 +13,13 @@ SOURCE_REF="$3" # source reference (either [branch]@[commit], [branc TARGET_DIR="$4" # relative target path TARGET_BRANCH="$5" # target branch (e.g. gh-pages) -printf 'Deploying phpDocs (%s (%s) --> %s:%s/%s)...\n' "$SOURCE_DIR" "$SOURCE_REF" "$GITHUB_SLUG" "$TARGET_BRANCH" "$TARGET_DIR" +# print parameters +echo "Deploying phpDocs..." +printf 'GITHUB_SLUG="%s"\n' "$GITHUB_SLUG" +printf 'SOURCE_DIR="%s"\n' "$SOURCE_DIR" +printf 'SOURCE_REF="%s"\n' "$SOURCE_REF" +printf 'TARGET_DIR="%s"\n' "$TARGET_DIR" +printf 'TARGET_BRANCH="%s"\n' "$TARGET_BRANCH" # evaluate target reference if git check-ref-format "tags/$SOURCE_REF"; then @@ -24,7 +30,7 @@ elif [[ "$SOURCE_REF" == *@* ]]; then SOURCE_REF_BRANCH="${SOURCE_REF%@*}" SOURCE_REF_COMMIT="${SOURCE_REF##*@}" - if ! git check-ref-format "heads/$SOURCE_REF_BRANCH"; then + if ! git check-ref-format "heads/$SOURCE_REF_BRANCH" || ! git rev-parse --verify "$SOURCE_REF_COMMIT"; then echo "FATAL: $APP_NAME target reference '$SOURCE_REF' is invalid" >&2 exit 1 fi @@ -37,7 +43,7 @@ else fi # clone repo -printf '\nCloning %s branch of %s...\n' "$TARGET_BRANCH" "https://github.com/$GITHUB_SLUG.git" +printf '\nCloning repo...\n' GIT_DIR="$SOURCE_DIR.git" git clone -b "$TARGET_BRANCH" "https://github.com/$GITHUB_SLUG.git" "$GIT_DIR" @@ -48,9 +54,9 @@ git config user.email "travis-ci@picocms.org" [ -n "$GITHUB_OAUTH_TOKEN" ] && git config credential.https://github.com.username "$GITHUB_OAUTH_TOKEN" # copy phpdoc +printf '\nCopying phpDocs...\n' [ ! -d "$TARGET_DIR" ] || rm -rf "$TARGET_DIR" [ "${SOURCE_DIR:0:1}" == "/" ] || SOURCE_DIR="$BASE_PWD/$SOURCE_DIR" -printf '\nCopying phpDoc (%s --> %s)...\n' "$SOURCE_DIR" "$GIT_DIR/$TARGET_DIR" cp -R "$SOURCE_DIR" "$TARGET_DIR" # commit changes @@ -85,3 +91,5 @@ fi # push changes printf '\nPushing changes...\n' git push "https://github.com/$GITHUB_SLUG.git" "$TARGET_BRANCH:$TARGET_BRANCH" + +echo diff --git a/build/generate-phpdoc.sh b/build/generate-phpdoc.sh index 0cbad7b..83fef3f 100755 --- a/build/generate-phpdoc.sh +++ b/build/generate-phpdoc.sh @@ -6,10 +6,17 @@ PHPDOC_SOURCE_DIR="$1" PHPDOC_TARGET_DIR="$2" PHPDOC_TITLE="$3" +# print parameters +echo "Generating phpDocs..." +printf 'PHPDOC_SOURCE_DIR="%s"\n' "$PHPDOC_SOURCE_DIR" +printf 'PHPDOC_TARGET_DIR="%s"\n' "$PHPDOC_TARGET_DIR" +printf 'PHPDOC_TITLE="%s"\n' "$PHPDOC_TITLE" + # generate phpdoc -printf 'Generating phpDocs (%s --> %s; "%s")...\n' "$PHPDOC_SOURCE_DIR" "$PHPDOC_TARGET_DIR" "$PHPDOC_TITLE" phpdoc -d "$PHPDOC_SOURCE_DIR" \ -i 'build/*' -i 'vendor/*' -i 'plugins/*' \ -f 'plugins/DummyPlugin.php' \ -t "$PHPDOC_TARGET_DIR" \ --title "$PHPDOC_TITLE" + +echo From 3c6809507537f945585f3589eda4e4da2c21ac40 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 25 Nov 2015 22:04:16 +0100 Subject: [PATCH 21/42] Improve phpDocs auto-generation --- build/deploy-phpdoc.sh | 7 ++++--- build/generate-phpdoc.sh | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build/deploy-phpdoc.sh b/build/deploy-phpdoc.sh index f68d1dd..bc3e2fb 100755 --- a/build/deploy-phpdoc.sh +++ b/build/deploy-phpdoc.sh @@ -20,6 +20,7 @@ printf 'SOURCE_DIR="%s"\n' "$SOURCE_DIR" printf 'SOURCE_REF="%s"\n' "$SOURCE_REF" printf 'TARGET_DIR="%s"\n' "$TARGET_DIR" printf 'TARGET_BRANCH="%s"\n' "$TARGET_BRANCH" +echo # evaluate target reference if git check-ref-format "tags/$SOURCE_REF"; then @@ -43,9 +44,9 @@ else fi # clone repo -printf '\nCloning repo...\n' +printf 'Cloning repo...\n' GIT_DIR="$SOURCE_DIR.git" -git clone -b "$TARGET_BRANCH" "https://github.com/$GITHUB_SLUG.git" "$GIT_DIR" +git clone --branch="$TARGET_BRANCH" "https://github.com/$GITHUB_SLUG.git" "$GIT_DIR" # setup git cd "$GIT_DIR" @@ -61,7 +62,7 @@ cp -R "$SOURCE_DIR" "$TARGET_DIR" # commit changes printf '\nCommiting changes...\n' -git add "$TARGET_DIR" +git add --all "$TARGET_DIR" git commit -m "Add phpDocumentor class docs for $SOURCE_REF" # very simple race condition protection for concurrent Travis builds diff --git a/build/generate-phpdoc.sh b/build/generate-phpdoc.sh index 83fef3f..5e11255 100755 --- a/build/generate-phpdoc.sh +++ b/build/generate-phpdoc.sh @@ -11,6 +11,7 @@ echo "Generating phpDocs..." printf 'PHPDOC_SOURCE_DIR="%s"\n' "$PHPDOC_SOURCE_DIR" printf 'PHPDOC_TARGET_DIR="%s"\n' "$PHPDOC_TARGET_DIR" printf 'PHPDOC_TITLE="%s"\n' "$PHPDOC_TITLE" +echo # generate phpdoc phpdoc -d "$PHPDOC_SOURCE_DIR" \ From 728873c5a4e13e7f4b7fc60f1d8c61db18416886 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 25 Nov 2015 22:26:51 +0100 Subject: [PATCH 22/42] build/deploy-phpdoc.sh: Fix credentials --- build/deploy-phpdoc.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/deploy-phpdoc.sh b/build/deploy-phpdoc.sh index bc3e2fb..39bc0ec 100755 --- a/build/deploy-phpdoc.sh +++ b/build/deploy-phpdoc.sh @@ -52,7 +52,11 @@ git clone --branch="$TARGET_BRANCH" "https://github.com/$GITHUB_SLUG.git" "$GIT_ cd "$GIT_DIR" git config user.name "Travis CI" git config user.email "travis-ci@picocms.org" -[ -n "$GITHUB_OAUTH_TOKEN" ] && git config credential.https://github.com.username "$GITHUB_OAUTH_TOKEN" + +if [ -n "$GITHUB_OAUTH_TOKEN" ]; then + git config credential.helper 'store --file=.git/credentials' + (umask 077 && echo "https://GitHub:$GITHUB_OAUTH_TOKEN@github.com" > .git/credentials) +fi # copy phpdoc printf '\nCopying phpDocs...\n' From c198333de783c9d1e51fd795731d9c4427af9442 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 25 Nov 2015 22:55:21 +0100 Subject: [PATCH 23/42] Improve phpDocs auto-generation --- .travis.yml | 15 +++++++-------- build/deploy-phpdoc.sh | 8 ++++---- build/generate-phpdoc.sh | 5 +++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index a613974..34e8774 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,18 +24,17 @@ script: after_success: - | - [[ ",$DEPLOY_PHPDOC_BRANCHES," == *,"$TRAVIS_BRANCH",* ]] && [ "$TRAVIS_PHP_VERSION" == "5.3" ] && ( - [ "$TRAVIS_SECURE_ENV_VARS" == "true" ] && [ -z "$TRAVIS_TAG" ] && ( - ./build/generate-phpdoc.sh . "build/phpdoc-master" "Pico 1.0 API Documentation (master)" - ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "build/phpdoc-master" "master@$TRAVIS_COMMIT" "phpDoc/master" "gh-pages" - ) - ) + [ "$TRAVIS_PHP_VERSION" != "5.3" ] && echo "Skipping phpDoc deployment because this is not on the required runtime" && exit + [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]] && echo "Skipping phpDoc deployment because this branch is not permitted to deploy" && exit + [ "$TRAVIS_SECURE_ENV_VARS" != "true" ] && echo "Skipping phpDoc deployment because this is no environment with write access to the repository" && exit + ./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-master" "Pico 1.0 API Documentation (master)" + ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-master" "master @ $TRAVIS_COMMIT" "phpDoc/master" "gh-pages" before_deploy: - | [ "$DEPLOY_PHPDOC_TAGS" == "true" ] && ( - ./build/generate-phpdoc.sh . "build/phpdoc-$TRAVIS_TAG" "Pico 1.0 API Documentation ($TRAVIS_TAG)" - ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "build/phpdoc-$TRAVIS_TAG" "$TRAVIS_TAG" "phpDoc/$TRAVIS_TAG" "gh-pages" + ./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "Pico 1.0 API Documentation ($TRAVIS_TAG)" + ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "$TRAVIS_TAG" "phpDoc/$TRAVIS_TAG" "gh-pages" ) - composer install --no-dev --optimize-autoloader - tar -czf "pico-release-$TRAVIS_TAG.tar.gz" README.md LICENSE CONTRIBUTING.md CHANGELOG.md composer.json composer.lock config content-sample lib plugins themes vendor .htaccess index.php diff --git a/build/deploy-phpdoc.sh b/build/deploy-phpdoc.sh index 39bc0ec..4c13044 100755 --- a/build/deploy-phpdoc.sh +++ b/build/deploy-phpdoc.sh @@ -26,10 +26,10 @@ echo if git check-ref-format "tags/$SOURCE_REF"; then SOURCE_REF_TYPE="tag" SOURCE_REF_TAG="$SOURCE_REF" -elif [[ "$SOURCE_REF" == *@* ]]; then +elif [[ "$SOURCE_REF" == *" @ "* ]]; then SOURCE_REF_TYPE="commit" - SOURCE_REF_BRANCH="${SOURCE_REF%@*}" - SOURCE_REF_COMMIT="${SOURCE_REF##*@}" + SOURCE_REF_BRANCH="${SOURCE_REF% @ *}" + SOURCE_REF_COMMIT="${SOURCE_REF##* @ }" if ! git check-ref-format "heads/$SOURCE_REF_BRANCH" || ! git rev-parse --verify "$SOURCE_REF_COMMIT"; then echo "FATAL: $APP_NAME target reference '$SOURCE_REF' is invalid" >&2 @@ -67,7 +67,7 @@ cp -R "$SOURCE_DIR" "$TARGET_DIR" # commit changes printf '\nCommiting changes...\n' git add --all "$TARGET_DIR" -git commit -m "Add phpDocumentor class docs for $SOURCE_REF" +git commit -m "Update phpDocumentor class docs for $SOURCE_REF" # very simple race condition protection for concurrent Travis builds # this is no definite protection (race conditions are still possible during `git push`), diff --git a/build/generate-phpdoc.sh b/build/generate-phpdoc.sh index 5e11255..bd11e7e 100755 --- a/build/generate-phpdoc.sh +++ b/build/generate-phpdoc.sh @@ -15,8 +15,9 @@ echo # generate phpdoc phpdoc -d "$PHPDOC_SOURCE_DIR" \ - -i 'build/*' -i 'vendor/*' -i 'plugins/*' \ - -f 'plugins/DummyPlugin.php' \ + -i 'build/*' \ + -i 'vendor/*' \ + -i 'plugins/*' -f 'plugins/DummyPlugin.php' \ -t "$PHPDOC_TARGET_DIR" \ --title "$PHPDOC_TITLE" From 236ae43dabb08eb4861b09863978aeb30d421190 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 25 Nov 2015 23:09:15 +0100 Subject: [PATCH 24/42] phpDocs auto deployment: Fix deployment of branches --- .travis.yml | 8 ++++---- build/deploy-phpdoc.sh | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index 34e8774..25c939c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,14 +27,14 @@ after_success: [ "$TRAVIS_PHP_VERSION" != "5.3" ] && echo "Skipping phpDoc deployment because this is not on the required runtime" && exit [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]] && echo "Skipping phpDoc deployment because this branch is not permitted to deploy" && exit [ "$TRAVIS_SECURE_ENV_VARS" != "true" ] && echo "Skipping phpDoc deployment because this is no environment with write access to the repository" && exit - ./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-master" "Pico 1.0 API Documentation (master)" - ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-master" "master @ $TRAVIS_COMMIT" "phpDoc/master" "gh-pages" + ./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_BRANCH" "Pico 1.0 API Documentation ($TRAVIS_BRANCH)" || exit 1 + ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_BRANCH" "$TRAVIS_BRANCH @ $TRAVIS_COMMIT" "phpDoc/$TRAVIS_BRANCH" "gh-pages" || exit 1 before_deploy: - | [ "$DEPLOY_PHPDOC_TAGS" == "true" ] && ( - ./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "Pico 1.0 API Documentation ($TRAVIS_TAG)" - ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "$TRAVIS_TAG" "phpDoc/$TRAVIS_TAG" "gh-pages" + ./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "Pico 1.0 API Documentation ($TRAVIS_TAG)" || exit 1 + ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "$TRAVIS_TAG" "phpDoc/$TRAVIS_TAG" "gh-pages" || exit 1 ) - composer install --no-dev --optimize-autoloader - tar -czf "pico-release-$TRAVIS_TAG.tar.gz" README.md LICENSE CONTRIBUTING.md CHANGELOG.md composer.json composer.lock config content-sample lib plugins themes vendor .htaccess index.php diff --git a/build/deploy-phpdoc.sh b/build/deploy-phpdoc.sh index 4c13044..bede6f0 100755 --- a/build/deploy-phpdoc.sh +++ b/build/deploy-phpdoc.sh @@ -31,7 +31,7 @@ elif [[ "$SOURCE_REF" == *" @ "* ]]; then SOURCE_REF_BRANCH="${SOURCE_REF% @ *}" SOURCE_REF_COMMIT="${SOURCE_REF##* @ }" - if ! git check-ref-format "heads/$SOURCE_REF_BRANCH" || ! git rev-parse --verify "$SOURCE_REF_COMMIT"; then + if ! git check-ref-format "heads/$SOURCE_REF_BRANCH" || ! git rev-parse --verify "$SOURCE_REF_COMMIT" > /dev/null; then echo "FATAL: $APP_NAME target reference '$SOURCE_REF' is invalid" >&2 exit 1 fi @@ -74,7 +74,7 @@ git commit -m "Update phpDocumentor class docs for $SOURCE_REF" # but it should give a basic protection without disabling concurrent builds completely if [ "$SOURCE_REF_TYPE" == "commit" ]; then # get latest commit - printf '\nRetrieving latest commit of %s:%s' "$GITHUB_SLUG" "$SOURCE_REF_BRANCH" + printf '\nRetrieving latest commit...\n' LATEST_COMMIT="$(wget -O- "https://api.github.com/repos/$GITHUB_SLUG/git/refs/heads/$SOURCE_REF_BRANCH" 2> /dev/null | php -r " \$json = json_decode(stream_get_contents(STDIN), true); if (\$json !== null) { @@ -88,7 +88,7 @@ if [ "$SOURCE_REF_TYPE" == "commit" ]; then # compare target reference against the latest commit if [ "$LATEST_COMMIT" != "$SOURCE_REF_COMMIT" ]; then - echo "WARNING: $APP_NAME target reference '$SOURCE_REF' doesn't match the latest commit '$LATEST_COMMIT'" >&2 + echo "WARNING: $APP_NAME source reference '$SOURCE_REF' doesn't match the latest commit '$LATEST_COMMIT'" >&2 exit 0 fi fi From 137b2ba3a6d335f2159e91dd276bc4e080dd0904 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 25 Nov 2015 23:35:42 +0100 Subject: [PATCH 25/42] phpDocs auto deployment: Fix deployment of branches with slashes --- .travis.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.travis.yml b/.travis.yml index 25c939c..3273b4e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,14 +27,16 @@ after_success: [ "$TRAVIS_PHP_VERSION" != "5.3" ] && echo "Skipping phpDoc deployment because this is not on the required runtime" && exit [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]] && echo "Skipping phpDoc deployment because this branch is not permitted to deploy" && exit [ "$TRAVIS_SECURE_ENV_VARS" != "true" ] && echo "Skipping phpDoc deployment because this is no environment with write access to the repository" && exit - ./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_BRANCH" "Pico 1.0 API Documentation ($TRAVIS_BRANCH)" || exit 1 - ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_BRANCH" "$TRAVIS_BRANCH @ $TRAVIS_COMMIT" "phpDoc/$TRAVIS_BRANCH" "gh-pages" || exit 1 + PHPDOC_ID="${TRAVIS_BRANCH//\//_}" + ./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" "Pico 1.0 API Documentation ($TRAVIS_BRANCH)" || exit 1 + ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" "$TRAVIS_BRANCH @ $TRAVIS_COMMIT" "phpDoc/$PHPDOC_ID" "gh-pages" || exit 1 before_deploy: - | [ "$DEPLOY_PHPDOC_TAGS" == "true" ] && ( - ./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "Pico 1.0 API Documentation ($TRAVIS_TAG)" || exit 1 - ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-$TRAVIS_TAG" "$TRAVIS_TAG" "phpDoc/$TRAVIS_TAG" "gh-pages" || exit 1 + PHPDOC_ID="${TRAVIS_BRANCH//\//_}" + ./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" "Pico 1.0 API Documentation ($TRAVIS_TAG)" || exit 1 + ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" "$TRAVIS_TAG" "phpDoc/$PHPDOC_ID" "gh-pages" || exit 1 ) - composer install --no-dev --optimize-autoloader - tar -czf "pico-release-$TRAVIS_TAG.tar.gz" README.md LICENSE CONTRIBUTING.md CHANGELOG.md composer.json composer.lock config content-sample lib plugins themes vendor .htaccess index.php From 3ac53d2b4cb0a041e1d9f0296e5e903af83665bd Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 25 Nov 2015 23:44:11 +0100 Subject: [PATCH 26/42] phpDocs auto deployment: Improve title of class docs for branches --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 3273b4e..bdd1e82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,7 +28,7 @@ after_success: [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]] && echo "Skipping phpDoc deployment because this branch is not permitted to deploy" && exit [ "$TRAVIS_SECURE_ENV_VARS" != "true" ] && echo "Skipping phpDoc deployment because this is no environment with write access to the repository" && exit PHPDOC_ID="${TRAVIS_BRANCH//\//_}" - ./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" "Pico 1.0 API Documentation ($TRAVIS_BRANCH)" || exit 1 + ./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" "Pico 1.0 API Documentation ($TRAVIS_BRANCH branch)" || exit 1 ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" "$TRAVIS_BRANCH @ $TRAVIS_COMMIT" "phpDoc/$PHPDOC_ID" "gh-pages" || exit 1 before_deploy: From 2306010ba79670807bb754433e5098ccb8a596ad Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Wed, 25 Nov 2015 23:53:58 +0100 Subject: [PATCH 27/42] phpDocs auto deployment: Fix phpDocs generation phpDocumentor acts very strange when relative paths are involved... --- build/generate-phpdoc.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/generate-phpdoc.sh b/build/generate-phpdoc.sh index bd11e7e..c2fe334 100755 --- a/build/generate-phpdoc.sh +++ b/build/generate-phpdoc.sh @@ -15,9 +15,9 @@ echo # generate phpdoc phpdoc -d "$PHPDOC_SOURCE_DIR" \ - -i 'build/*' \ - -i 'vendor/*' \ - -i 'plugins/*' -f 'plugins/DummyPlugin.php' \ + -i "$PHPDOC_SOURCE_DIR/build/" \ + -i "$PHPDOC_SOURCE_DIR/vendor/" \ + -i "$PHPDOC_SOURCE_DIR/plugins/" -f "$PHPDOC_SOURCE_DIR/plugins/DummyPlugin.php" \ -t "$PHPDOC_TARGET_DIR" \ --title "$PHPDOC_TITLE" From 17dbc4cf186c926625d179ed5611430fc2a265d6 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 26 Nov 2015 00:29:14 +0100 Subject: [PATCH 28/42] phpDocs auto deployment: Cleanup --- .travis.yml | 17 +++-------------- build/deploy-phpdoc-branch.sh | 28 ++++++++++++++++++++++++++++ build/deploy-phpdoc-release.sh | 15 +++++++++++++++ build/deploy-phpdoc.sh | 28 ++++++++++++++++------------ 4 files changed, 62 insertions(+), 26 deletions(-) create mode 100755 build/deploy-phpdoc-branch.sh create mode 100755 build/deploy-phpdoc-release.sh diff --git a/.travis.yml b/.travis.yml index bdd1e82..8e87356 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,27 +17,16 @@ install: - composer install before_script: - - export PATH="$TRAVIS_BUILD_DIR/vendor/bin:$PATH" + - export PATH="$TRAVIS_BUILD_DIR/build:$TRAVIS_BUILD_DIR/vendor/bin:$PATH" script: - find . -not \( -path './vendor' -prune \) -type f -name '*.php' -print0 | xargs -0 -I file php -l file > /dev/null after_success: - - | - [ "$TRAVIS_PHP_VERSION" != "5.3" ] && echo "Skipping phpDoc deployment because this is not on the required runtime" && exit - [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]] && echo "Skipping phpDoc deployment because this branch is not permitted to deploy" && exit - [ "$TRAVIS_SECURE_ENV_VARS" != "true" ] && echo "Skipping phpDoc deployment because this is no environment with write access to the repository" && exit - PHPDOC_ID="${TRAVIS_BRANCH//\//_}" - ./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" "Pico 1.0 API Documentation ($TRAVIS_BRANCH branch)" || exit 1 - ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" "$TRAVIS_BRANCH @ $TRAVIS_COMMIT" "phpDoc/$PHPDOC_ID" "gh-pages" || exit 1 + - deploy-phpdoc-branch.sh before_deploy: - - | - [ "$DEPLOY_PHPDOC_TAGS" == "true" ] && ( - PHPDOC_ID="${TRAVIS_BRANCH//\//_}" - ./build/generate-phpdoc.sh "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" "Pico 1.0 API Documentation ($TRAVIS_TAG)" || exit 1 - ./build/deploy-phpdoc.sh "$TRAVIS_REPO_SLUG" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" "$TRAVIS_TAG" "phpDoc/$PHPDOC_ID" "gh-pages" || exit 1 - ) + - deploy-phpdoc-release.sh - composer install --no-dev --optimize-autoloader - tar -czf "pico-release-$TRAVIS_TAG.tar.gz" README.md LICENSE CONTRIBUTING.md CHANGELOG.md composer.json composer.lock config content-sample lib plugins themes vendor .htaccess index.php diff --git a/build/deploy-phpdoc-branch.sh b/build/deploy-phpdoc-branch.sh new file mode 100755 index 0000000..2a401a4 --- /dev/null +++ b/build/deploy-phpdoc-branch.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +if [ "$TRAVIS_PHP_VERSION" != "5.3" ]; then + echo "Skipping phpDoc deployment because this is not on the required runtime" + exit +fi + +if [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]]; then + echo "Skipping phpDoc deployment because this branch is not permitted to deploy" + exit +fi + +if [ "$TRAVIS_SECURE_ENV_VARS" != "true" ]; then + echo "Skipping phpDoc deployment because this is no environment with write access to the repository" + exit +fi + +PHPDOC_ID="${TRAVIS_BRANCH//\//_}" + +generate-phpdoc.sh \ + "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ + "Pico 1.0 API Documentation ($TRAVIS_BRANCH branch)" +[ $? -eq 0 ] || exit 1 + +deploy-phpdoc.sh \ + "$TRAVIS_REPO_SLUG" "$TRAVIS_BRANCH @ $TRAVIS_COMMIT" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ + "$TRAVIS_REPO_SLUG" "gh-pages" "phpDoc/$PHPDOC_ID" +[ $? -eq 0 ] || exit 1 diff --git a/build/deploy-phpdoc-release.sh b/build/deploy-phpdoc-release.sh new file mode 100755 index 0000000..6604ba6 --- /dev/null +++ b/build/deploy-phpdoc-release.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +[ "$DEPLOY_PHPDOC_RELEASES" == "true" ] || exit + +PHPDOC_ID="${TRAVIS_BRANCH//\//_}" + +generate-phpdoc.sh \ + "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ + "Pico 1.0 API Documentation ($TRAVIS_TAG)" +[ $? -eq 0 ] || exit 1 + +deploy-phpdoc.sh \ + "$TRAVIS_REPO_SLUG" "$TRAVIS_TAG" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ + "$TRAVIS_REPO_SLUG" "gh-pages" "phpDoc/$PHPDOC_ID" +[ $? -eq 0 ] || exit 1 diff --git a/build/deploy-phpdoc.sh b/build/deploy-phpdoc.sh index bede6f0..85dcddb 100755 --- a/build/deploy-phpdoc.sh +++ b/build/deploy-phpdoc.sh @@ -1,25 +1,29 @@ #!/usr/bin/env bash +set -e + +# base variables APP_NAME="$(basename "$0")" BASE_PWD="$PWD" -set -e # environment variables # GITHUB_OAUTH_TOKEN GitHub authentication token, see https://github.com/settings/tokens # parameters -GITHUB_SLUG="$1" # GitHub repo (e.g. picocms/Pico) -SOURCE_DIR="$2" # absolute source path -SOURCE_REF="$3" # source reference (either [branch]@[commit], [branch] or [tag]) -TARGET_DIR="$4" # relative target path +SOURCE_REPO_SLUG="$1" # source GitHub repo (e.g. picocms/Pico) +SOURCE_REF="$2" # source reference (either [branch]@[commit], [branch] or [tag]) +SOURCE_DIR="$3" # absolute source path +TARGET_REPO_SLUG="$4" # target GitHub repo (e.g. picocms/Pico) TARGET_BRANCH="$5" # target branch (e.g. gh-pages) +TARGET_DIR="$6" # relative target path # print parameters echo "Deploying phpDocs..." -printf 'GITHUB_SLUG="%s"\n' "$GITHUB_SLUG" -printf 'SOURCE_DIR="%s"\n' "$SOURCE_DIR" +printf 'SOURCE_REPO_SLUG="%s"\n' "$SOURCE_REPO_SLUG" printf 'SOURCE_REF="%s"\n' "$SOURCE_REF" -printf 'TARGET_DIR="%s"\n' "$TARGET_DIR" +printf 'SOURCE_DIR="%s"\n' "$SOURCE_DIR" +printf 'TARGET_REPO_SLUG="%s"\n' "$TARGET_REPO_SLUG" printf 'TARGET_BRANCH="%s"\n' "$TARGET_BRANCH" +printf 'TARGET_DIR="%s"\n' "$TARGET_DIR" echo # evaluate target reference @@ -46,7 +50,7 @@ fi # clone repo printf 'Cloning repo...\n' GIT_DIR="$SOURCE_DIR.git" -git clone --branch="$TARGET_BRANCH" "https://github.com/$GITHUB_SLUG.git" "$GIT_DIR" +git clone --branch="$TARGET_BRANCH" "https://github.com/$TARGET_REPO_SLUG.git" "$GIT_DIR" # setup git cd "$GIT_DIR" @@ -67,7 +71,7 @@ cp -R "$SOURCE_DIR" "$TARGET_DIR" # commit changes printf '\nCommiting changes...\n' git add --all "$TARGET_DIR" -git commit -m "Update phpDocumentor class docs for $SOURCE_REF" +git commit --message="Update phpDocumentor class docs for $SOURCE_REF" # very simple race condition protection for concurrent Travis builds # this is no definite protection (race conditions are still possible during `git push`), @@ -75,7 +79,7 @@ git commit -m "Update phpDocumentor class docs for $SOURCE_REF" if [ "$SOURCE_REF_TYPE" == "commit" ]; then # get latest commit printf '\nRetrieving latest commit...\n' - LATEST_COMMIT="$(wget -O- "https://api.github.com/repos/$GITHUB_SLUG/git/refs/heads/$SOURCE_REF_BRANCH" 2> /dev/null | php -r " + LATEST_COMMIT="$(wget -O- "https://api.github.com/repos/$SOURCE_REPO_SLUG/git/refs/heads/$SOURCE_REF_BRANCH" 2> /dev/null | php -r " \$json = json_decode(stream_get_contents(STDIN), true); if (\$json !== null) { if (isset(\$json['ref']) && (\$json['ref'] === 'refs/heads/$SOURCE_REF_BRANCH')) { @@ -95,6 +99,6 @@ fi # push changes printf '\nPushing changes...\n' -git push "https://github.com/$GITHUB_SLUG.git" "$TARGET_BRANCH:$TARGET_BRANCH" +git push "https://github.com/$TARGET_REPO_SLUG.git" "$TARGET_BRANCH:$TARGET_BRANCH" echo From 5af160c31d6a725520121f27375bc61c2afda954 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 26 Nov 2015 01:13:37 +0100 Subject: [PATCH 29/42] phpDocs auto deployment: Use $GITHUB_OAUTH_TOKEN to determine latest commit --- build/deploy-phpdoc.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/build/deploy-phpdoc.sh b/build/deploy-phpdoc.sh index 85dcddb..57b5c6b 100755 --- a/build/deploy-phpdoc.sh +++ b/build/deploy-phpdoc.sh @@ -77,9 +77,17 @@ git commit --message="Update phpDocumentor class docs for $SOURCE_REF" # this is no definite protection (race conditions are still possible during `git push`), # but it should give a basic protection without disabling concurrent builds completely if [ "$SOURCE_REF_TYPE" == "commit" ]; then - # get latest commit + # load branch data via GitHub APIv3 printf '\nRetrieving latest commit...\n' - LATEST_COMMIT="$(wget -O- "https://api.github.com/repos/$SOURCE_REPO_SLUG/git/refs/heads/$SOURCE_REF_BRANCH" 2> /dev/null | php -r " + LATEST_COMMIT_URL="https://api.github.com/repos/$SOURCE_REPO_SLUG/git/refs/heads/$SOURCE_REF_BRANCH" + if [ -n "$GITHUB_OAUTH_TOKEN" ]; then + LATEST_COMMIT_RESPONSE="$(wget -O- --header="Authorization: token $GITHUB_OAUTH_TOKEN" "$LATEST_COMMIT_URL" 2> /dev/null)" + else + LATEST_COMMIT_RESPONSE="$(wget -O- "$LATEST_COMMIT_URL" 2> /dev/null)" + fi + + # evaluate JSON response + LATEST_COMMIT="$(echo "$LATEST_COMMIT_RESPONSE" | php -r " \$json = json_decode(stream_get_contents(STDIN), true); if (\$json !== null) { if (isset(\$json['ref']) && (\$json['ref'] === 'refs/heads/$SOURCE_REF_BRANCH')) { From 6e0b2aab34abdcca40639d244fd51f748e7422c1 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 26 Nov 2015 01:35:35 +0100 Subject: [PATCH 30/42] phpDocs auto deployment: Disable for pull requests with a safe environment Pull requests with a safe environment are primarly local branches --- build/deploy-phpdoc-branch.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build/deploy-phpdoc-branch.sh b/build/deploy-phpdoc-branch.sh index 2a401a4..0d4335a 100755 --- a/build/deploy-phpdoc-branch.sh +++ b/build/deploy-phpdoc-branch.sh @@ -15,6 +15,11 @@ if [ "$TRAVIS_SECURE_ENV_VARS" != "true" ]; then exit fi +if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + echo "Skipping phpDoc deployment because this pull request (#$TRAVIS_PULL_REQUEST) is not permitted to deploy" + exit +fi + PHPDOC_ID="${TRAVIS_BRANCH//\//_}" generate-phpdoc.sh \ From 45dcf32fa7ab64b1c722a74079ab80cff38c0f34 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 26 Nov 2015 02:15:34 +0100 Subject: [PATCH 31/42] phpDocs auto deployment: Support pull requests in a safe environment --- build/deploy-phpdoc-branch.sh | 22 +++++++++++++++------- build/deploy-phpdoc-release.sh | 6 ++++-- build/deploy-phpdoc.sh | 29 +++++++++++++---------------- 3 files changed, 32 insertions(+), 25 deletions(-) diff --git a/build/deploy-phpdoc-branch.sh b/build/deploy-phpdoc-branch.sh index 0d4335a..1b3e11e 100755 --- a/build/deploy-phpdoc-branch.sh +++ b/build/deploy-phpdoc-branch.sh @@ -15,19 +15,27 @@ if [ "$TRAVIS_SECURE_ENV_VARS" != "true" ]; then exit fi -if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - echo "Skipping phpDoc deployment because this pull request (#$TRAVIS_PULL_REQUEST) is not permitted to deploy" - exit -fi - PHPDOC_ID="${TRAVIS_BRANCH//\//_}" +PHPDOC_REF="heads/$TRAVIS_BRANCH" +PHPDOC_REF_TEXT="$TRAVIS_BRANCH branch" + +if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + PHPDOC_ID="pull_$TRAVIS_PULL_REQUEST" + PHPDOC_REF="pull/$TRAVIS_PULL_REQUEST/head" + PHPDOC_REF_TEXT="pull request #$TRAVIS_PULL_REQUEST" + + if [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"#$TRAVIS_PULL_REQUEST",* ]]; then + echo "Skipping phpDoc deployment because this pull request (#$TRAVIS_PULL_REQUEST) is not permitted to deploy" + exit + fi +fi generate-phpdoc.sh \ "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ - "Pico 1.0 API Documentation ($TRAVIS_BRANCH branch)" + "Pico 1.0 API Documentation ($PHPDOC_REF_TEXT)" [ $? -eq 0 ] || exit 1 deploy-phpdoc.sh \ - "$TRAVIS_REPO_SLUG" "$TRAVIS_BRANCH @ $TRAVIS_COMMIT" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ + "$TRAVIS_REPO_SLUG" "$PHPDOC_REF @ $TRAVIS_COMMIT" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ "$TRAVIS_REPO_SLUG" "gh-pages" "phpDoc/$PHPDOC_ID" [ $? -eq 0 ] || exit 1 diff --git a/build/deploy-phpdoc-release.sh b/build/deploy-phpdoc-release.sh index 6604ba6..f22030c 100755 --- a/build/deploy-phpdoc-release.sh +++ b/build/deploy-phpdoc-release.sh @@ -3,13 +3,15 @@ [ "$DEPLOY_PHPDOC_RELEASES" == "true" ] || exit PHPDOC_ID="${TRAVIS_BRANCH//\//_}" +PHPDOC_REF="tags/$TRAVIS_TAG" +PHPDOC_REF_TEXT="$TRAVIS_TAG" generate-phpdoc.sh \ "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ - "Pico 1.0 API Documentation ($TRAVIS_TAG)" + "Pico 1.0 API Documentation ($PHPDOC_REF_TEXT)" [ $? -eq 0 ] || exit 1 deploy-phpdoc.sh \ - "$TRAVIS_REPO_SLUG" "$TRAVIS_TAG" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ + "$TRAVIS_REPO_SLUG" "$PHPDOC_REF" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ "$TRAVIS_REPO_SLUG" "gh-pages" "phpDoc/$PHPDOC_ID" [ $? -eq 0 ] || exit 1 diff --git a/build/deploy-phpdoc.sh b/build/deploy-phpdoc.sh index 57b5c6b..26d06b8 100755 --- a/build/deploy-phpdoc.sh +++ b/build/deploy-phpdoc.sh @@ -10,7 +10,8 @@ BASE_PWD="$PWD" # parameters SOURCE_REPO_SLUG="$1" # source GitHub repo (e.g. picocms/Pico) -SOURCE_REF="$2" # source reference (either [branch]@[commit], [branch] or [tag]) +SOURCE_REF="$2" # source reference (either "[ref] @ [commit]" or "[ref]", + # [ref] can be e.g. heads/master or tags/v1.0.0) SOURCE_DIR="$3" # absolute source path TARGET_REPO_SLUG="$4" # target GitHub repo (e.g. picocms/Pico) TARGET_BRANCH="$5" # target branch (e.g. gh-pages) @@ -26,24 +27,20 @@ printf 'TARGET_BRANCH="%s"\n' "$TARGET_BRANCH" printf 'TARGET_DIR="%s"\n' "$TARGET_DIR" echo -# evaluate target reference -if git check-ref-format "tags/$SOURCE_REF"; then - SOURCE_REF_TYPE="tag" - SOURCE_REF_TAG="$SOURCE_REF" -elif [[ "$SOURCE_REF" == *" @ "* ]]; then +# evaluate source reference +if [[ "$SOURCE_REF" == *" @ "* ]]; then SOURCE_REF_TYPE="commit" - SOURCE_REF_BRANCH="${SOURCE_REF% @ *}" + SOURCE_REF_HEAD="${SOURCE_REF% @ *}" SOURCE_REF_COMMIT="${SOURCE_REF##* @ }" - if ! git check-ref-format "heads/$SOURCE_REF_BRANCH" || ! git rev-parse --verify "$SOURCE_REF_COMMIT" > /dev/null; then - echo "FATAL: $APP_NAME target reference '$SOURCE_REF' is invalid" >&2 + if ! git check-ref-format "$SOURCE_REF_HEAD" || ! git rev-parse --verify "$SOURCE_REF_COMMIT" > /dev/null; then + echo "FATAL: $APP_NAME source reference '$SOURCE_REF' is invalid" >&2 exit 1 fi -elif git check-ref-format "heads/$SOURCE_REF"; then - SOURCE_REF_TYPE="branch" - SOURCE_REF_BRANCH="$SOURCE_REF" +elif git check-ref-format "$SOURCE_REF"; then + SOURCE_REF_TYPE="ref" else - echo "FATAL: $APP_NAME target reference '$SOURCE_REF' is invalid" >&2 + echo "FATAL: $APP_NAME source reference '$SOURCE_REF' is invalid" >&2 exit 1 fi @@ -79,7 +76,7 @@ git commit --message="Update phpDocumentor class docs for $SOURCE_REF" if [ "$SOURCE_REF_TYPE" == "commit" ]; then # load branch data via GitHub APIv3 printf '\nRetrieving latest commit...\n' - LATEST_COMMIT_URL="https://api.github.com/repos/$SOURCE_REPO_SLUG/git/refs/heads/$SOURCE_REF_BRANCH" + LATEST_COMMIT_URL="https://api.github.com/repos/$SOURCE_REPO_SLUG/git/refs/$SOURCE_REF_HEAD" if [ -n "$GITHUB_OAUTH_TOKEN" ]; then LATEST_COMMIT_RESPONSE="$(wget -O- --header="Authorization: token $GITHUB_OAUTH_TOKEN" "$LATEST_COMMIT_URL" 2> /dev/null)" else @@ -90,7 +87,7 @@ if [ "$SOURCE_REF_TYPE" == "commit" ]; then LATEST_COMMIT="$(echo "$LATEST_COMMIT_RESPONSE" | php -r " \$json = json_decode(stream_get_contents(STDIN), true); if (\$json !== null) { - if (isset(\$json['ref']) && (\$json['ref'] === 'refs/heads/$SOURCE_REF_BRANCH')) { + if (isset(\$json['ref']) && (\$json['ref'] === 'refs/$SOURCE_REF_HEAD')) { if (isset(\$json['object']) && isset(\$json['object']['sha'])) { echo \$json['object']['sha']; } @@ -98,7 +95,7 @@ if [ "$SOURCE_REF_TYPE" == "commit" ]; then } ")" - # compare target reference against the latest commit + # compare source reference against the latest commit if [ "$LATEST_COMMIT" != "$SOURCE_REF_COMMIT" ]; then echo "WARNING: $APP_NAME source reference '$SOURCE_REF' doesn't match the latest commit '$LATEST_COMMIT'" >&2 exit 0 From 8005efdbbb28ada3e5c8aa903ba430024c4ff928 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 26 Nov 2015 02:38:29 +0100 Subject: [PATCH 32/42] phpDocs auto deployment: Remove latest commit check for pull requests See https://developer.github.com/v3/pulls/#get-a-single-pull-request > Each time the pull request receives new commits, GitHub creates a merge > commit to *test* whether the pull request can be automatically merged into > the base branch. (This *test* commit is not added to the base branch or the > head branch.) The attribute holds the SHA of the *test* > merge commit; however, this attribute is deprecated and is scheduled for > removal in the next version of the API. holds the SHA of the merge commit and not of the latest commit of the head branch, therefore the comparison fails. We could theoretically compare it against this attribute, but as of its deprecation, this is a pretty bad idea. Thus we remove the latest commit check for pull requests. --- build/deploy-phpdoc-branch.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/build/deploy-phpdoc-branch.sh b/build/deploy-phpdoc-branch.sh index 1b3e11e..b3d4b2f 100755 --- a/build/deploy-phpdoc-branch.sh +++ b/build/deploy-phpdoc-branch.sh @@ -6,7 +6,7 @@ if [ "$TRAVIS_PHP_VERSION" != "5.3" ]; then fi if [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]]; then - echo "Skipping phpDoc deployment because this branch is not permitted to deploy" + echo "Skipping phpDoc deployment because this branch ($TRAVIS_BRANCH) is not permitted to deploy" exit fi @@ -16,7 +16,7 @@ if [ "$TRAVIS_SECURE_ENV_VARS" != "true" ]; then fi PHPDOC_ID="${TRAVIS_BRANCH//\//_}" -PHPDOC_REF="heads/$TRAVIS_BRANCH" +PHPDOC_REF="heads/$TRAVIS_BRANCH @ $TRAVIS_COMMIT" PHPDOC_REF_TEXT="$TRAVIS_BRANCH branch" if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then @@ -36,6 +36,6 @@ generate-phpdoc.sh \ [ $? -eq 0 ] || exit 1 deploy-phpdoc.sh \ - "$TRAVIS_REPO_SLUG" "$PHPDOC_REF @ $TRAVIS_COMMIT" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ + "$TRAVIS_REPO_SLUG" "$PHPDOC_REF" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ "$TRAVIS_REPO_SLUG" "gh-pages" "phpDoc/$PHPDOC_ID" [ $? -eq 0 ] || exit 1 From 54305c4d33b88533f55da6364e5881d285bee7fb Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Thu, 26 Nov 2015 04:06:34 +0100 Subject: [PATCH 33/42] phpDocs auto deployment: Remove pull requests support We can deploy phpDocs in safe environments only, but "safe environment" is equivalent to "pull a local branch", therefore we can simply use that local branch to deploy the phpDocs. There's no need for a explicit pull request support. --- build/deploy-phpdoc-branch.sh | 21 ++++----------------- build/deploy-phpdoc-release.sh | 6 ++---- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/build/deploy-phpdoc-branch.sh b/build/deploy-phpdoc-branch.sh index b3d4b2f..f08063d 100755 --- a/build/deploy-phpdoc-branch.sh +++ b/build/deploy-phpdoc-branch.sh @@ -10,32 +10,19 @@ if [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]]; then exit fi -if [ "$TRAVIS_SECURE_ENV_VARS" != "true" ]; then - echo "Skipping phpDoc deployment because this is no environment with write access to the repository" +if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + echo "Skipping phpDoc deployment because this pull request (#$TRAVIS_PULL_REQUEST) is not permitted to deploy" exit fi PHPDOC_ID="${TRAVIS_BRANCH//\//_}" -PHPDOC_REF="heads/$TRAVIS_BRANCH @ $TRAVIS_COMMIT" -PHPDOC_REF_TEXT="$TRAVIS_BRANCH branch" - -if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - PHPDOC_ID="pull_$TRAVIS_PULL_REQUEST" - PHPDOC_REF="pull/$TRAVIS_PULL_REQUEST/head" - PHPDOC_REF_TEXT="pull request #$TRAVIS_PULL_REQUEST" - - if [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"#$TRAVIS_PULL_REQUEST",* ]]; then - echo "Skipping phpDoc deployment because this pull request (#$TRAVIS_PULL_REQUEST) is not permitted to deploy" - exit - fi -fi generate-phpdoc.sh \ "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ - "Pico 1.0 API Documentation ($PHPDOC_REF_TEXT)" + "Pico 1.0 API Documentation ($TRAVIS_BRANCH branch)" [ $? -eq 0 ] || exit 1 deploy-phpdoc.sh \ - "$TRAVIS_REPO_SLUG" "$PHPDOC_REF" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ + "$TRAVIS_REPO_SLUG" "heads/$TRAVIS_BRANCH @ $TRAVIS_COMMIT" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ "$TRAVIS_REPO_SLUG" "gh-pages" "phpDoc/$PHPDOC_ID" [ $? -eq 0 ] || exit 1 diff --git a/build/deploy-phpdoc-release.sh b/build/deploy-phpdoc-release.sh index f22030c..721f3a4 100755 --- a/build/deploy-phpdoc-release.sh +++ b/build/deploy-phpdoc-release.sh @@ -3,15 +3,13 @@ [ "$DEPLOY_PHPDOC_RELEASES" == "true" ] || exit PHPDOC_ID="${TRAVIS_BRANCH//\//_}" -PHPDOC_REF="tags/$TRAVIS_TAG" -PHPDOC_REF_TEXT="$TRAVIS_TAG" generate-phpdoc.sh \ "$TRAVIS_BUILD_DIR" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ - "Pico 1.0 API Documentation ($PHPDOC_REF_TEXT)" + "Pico 1.0 API Documentation ($TRAVIS_TAG)" [ $? -eq 0 ] || exit 1 deploy-phpdoc.sh \ - "$TRAVIS_REPO_SLUG" "$PHPDOC_REF" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ + "$TRAVIS_REPO_SLUG" "tags/$TRAVIS_TAG" "$TRAVIS_BUILD_DIR/build/phpdoc-$PHPDOC_ID" \ "$TRAVIS_REPO_SLUG" "gh-pages" "phpDoc/$PHPDOC_ID" [ $? -eq 0 ] || exit 1 From 0dcb49d8ac91f224cab611df2a68e99a589eeb26 Mon Sep 17 00:00:00 2001 From: theshka Date: Fri, 27 Nov 2015 10:31:17 -0600 Subject: [PATCH 34/42] Consolidate Build & Release section. --- CONTRIBUTING.md | 45 ++++++--------------------------------------- 1 file changed, 6 insertions(+), 39 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index aa812cb..3d19e57 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -113,12 +113,9 @@ Build & Release process > This is work in progress. Please refer to [#268](https://github.com/picocms/Pico/issues/268) for details. -Defined below is a specification to which the Build and Release process of Pico should follow. We use [travis-ci](https://travis-ci.com) to automate the process, and each commit to `master` should be deployable. Once a `feature/branch` or the `master` branch have reached a point where the need for a version increase is necessary, move through these phases to generate a Pico release. +We're using [Travis CI](https://travis-ci.com) to automate the build & release process of Pico. It generates and deploys [phpDoc](http://phpdoc.org) class docs for new releases and on every commit to the `master` branch. Travis also prepares new releases by generating Pico's pre-built packages and uploading them to GitHub. -### Commit phase - -- Make/Commit/Merge changes -- Use a formatted commit message with contents of `CHANGELOG.md` since last release. +It is important that each commit to `master` is deployable. Once a `feature/branch` or the `master` branch have reached a point where the need for a version increase is necessary, you can trigger this process by pushing a new Git Tag. The tag references a (usually empty) commit which message follows the following template: Example: ``` @@ -129,42 +126,12 @@ Defined below is a specification to which the Build and Release process of Pico * [Security] ... ``` -- Tagging a commit on the `master` branch will trigger an automatic build.. + -- __Please submit pull-requests with a properly formatted commit message and -[SemVer](http://semver.org) increase to avoid the need for manual amendments.__ +After deploying a new release, you will need to amend the release information on GitHub with the release title (taken from changelog), and changelog itself. - -### Analysis phase - -Does the commit pass all `travis-ci` checks? - -- We test PHP 5.3, 5.4, 5.5, 5.6, 7, the nighlty build, and HHVM - -If not, all errors will need to be corrected before the build can complete. - -### Packaging phase - -###### travis-ci -- will run [composer](http://getcomposer.org) locally with `req-dev` dependencies. -- will generate [PhpDocumentor](http://phpdoc.org) class docs automatically -- will run our `deploy-phpdoc.sh` script -- will create a ZIP archive (so vendor/ is included) - -### Release phase - -###### travis-ci -- will remove phpDocumentor from dependencies -- will create new Git release at tag -- will include the properly formatted commit message including the changelog of items since the last release. -- will include ZIP archive in release - -###### Note: -If a properly formatted commit message was not provided, you may have to update release information on GitHub with: -- release title (taken from changelog) -- changelog - -### Announcements +__Note__ - Releases will be available at: [https://github.com/picocms/Pico/releases](https://github.com/picocms/Pico/releases) - Pico will be automatically updated on [Packagist](http://packagist.org/packages/picocms/pico) From 917cd6caf3f361fb524f015e37a8d95acea1dafd Mon Sep 17 00:00:00 2001 From: theshka Date: Fri, 27 Nov 2015 10:36:44 -0600 Subject: [PATCH 35/42] Consolidate Issue Template --- CONTRIBUTING.md | 39 ++++++++------------------------------- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3d19e57..cb3bfde 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,38 +14,15 @@ If you want to report an *issue* with Pico's core, please create a new [Issue](h Before creating a [new Issue on GitHub](https://github.com/picocms/Pico/issues/new), please make sure the problem wasn't reported yet using [GitHubs search engine](https://github.com/picocms/Pico/search?type=Issues). Please describe your issue as clear as possible and always include steps to reproduce the problem. -This is an example of what information to include with your issue. - - Version - - Operating System and version - - Pico Version - - other installed software, plugins, if applicable - - hardware information, if applicable - - Bug Description - - A concise description of what the problem is. Pure description, no narrative or conversational language. - - Severity - - Trivial, Minor, Major, or Catastrophic - - Steps to Reproduce - - Step by step instructions on how to reproduce this bug. - - Do not assume anything, the more detailed your list of instructions, the easier it is for the developer to track down the problem! - - Actual Behavior - - Type what happens when you follow the instructions. This is the manifestation of the bug. - - Expected Behavior - - Type what you expected to happen when you followed the instructions. - - This is important, because you may have misunderstood something or missed a step, - and knowing what you expected to see will help the developer recognize that. - - Troubleshooting/Testing Steps Attempted - - Describe anything you did to try to fix it on your own. - - Workaround - - If you found a way to make the program work in spite of the bug, describe how you did it here. +This is an example of what type of information to include with your issue. +- Pico Version +- Installed plugins, if applicable +- Bug Description +- Steps to Reproduce +- Actual/Expected Behavior +- Troubleshooting/Testing Steps Attempted +- Workarounds? Contributing code ----------------- From 31acaffa67228dae1c022ad4b078b163cc98434f Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Fri, 27 Nov 2015 19:40:26 +0100 Subject: [PATCH 36/42] Add PHP_CodeSniffer --- .travis.yml | 2 +- composer.json | 3 ++- index.php | 4 +++- phpcs.xml | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 phpcs.xml diff --git a/.travis.yml b/.travis.yml index 7815b08..2fb9600 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ before_script: - export PATH="$TRAVIS_BUILD_DIR/build:$TRAVIS_BUILD_DIR/vendor/bin:$PATH" script: - - find . -not \( -path './vendor' -prune \) -type f -name '*.php' -print0 | xargs -0 -I file php -l file > /dev/null + - phpcs --standard=phpcs.xml "$TRAVIS_BUILD_DIR" after_success: - deploy-phpdoc-branch.sh diff --git a/composer.json b/composer.json index 14f174d..5894970 100644 --- a/composer.json +++ b/composer.json @@ -29,7 +29,8 @@ "symfony/yaml" : "^2.3" }, "require-dev" : { - "phpdocumentor/phpdocumentor": "^2.8" + "phpdocumentor/phpdocumentor": "^2.8", + "squizlabs/php_codesniffer": "^2.4" }, "autoload": { "psr-0": { diff --git a/index.php b/index.php index 40b811a..a4e0fb0 100644 --- a/index.php +++ b/index.php @@ -1,4 +1,6 @@ setConfig(array()); +//$pico->setConfig(array()); // run application echo $pico->run(); diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..6e8d640 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,39 @@ + + + + Pico's coding standards mainly base on the PHP-FIG PSR-2 standard, + but without the MissingNamespace sniff. + + + + ^build/ + ^vendor/ + *.min.js + + + + + + + + + + + + + + + + \ No newline at end of file From 2535df7cfe778dfb7993f66a81d3738cce93b84f Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Fri, 27 Nov 2015 19:56:28 +0100 Subject: [PATCH 37/42] Add index.php.dist See https://github.com/picocms/Pico/issues/285#issuecomment-160130798 --- .travis.yml | 1 + index.php | 8 +------- index.php.dist | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 index.php.dist diff --git a/.travis.yml b/.travis.yml index 2fb9600..aa0af02 100644 --- a/.travis.yml +++ b/.travis.yml @@ -29,6 +29,7 @@ before_deploy: - deploy-phpdoc-release.sh - composer install --no-dev --optimize-autoloader - find vendor/ -type d -path 'vendor/*/*/.git' -print0 | xargs -0 rm -rf + - mv index.php.dist index.php - tar -czf "pico-release-$TRAVIS_TAG.tar.gz" README.md LICENSE CONTRIBUTING.md CHANGELOG.md composer.json composer.lock config content-sample lib plugins themes vendor .htaccess index.php deploy: diff --git a/index.php b/index.php index b8fdff6..7e7cdf0 100644 --- a/index.php +++ b/index.php @@ -1,10 +1,4 @@ -run(); From e088f6c6fafef094f04e02db57367c01bf06bfa1 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Fri, 27 Nov 2015 20:31:17 +0100 Subject: [PATCH 38/42] Update phpcs.xml --- phpcs.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/phpcs.xml b/phpcs.xml index 6e8d640..93b9ebb 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -36,4 +36,4 @@ - \ No newline at end of file + From 2eed14103a052b6ff0b39eabb0d0f47d88b1f431 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Fri, 27 Nov 2015 20:36:40 +0100 Subject: [PATCH 39/42] Add @codingStandardsIgnoreFile to index.php.dist The comments of the "instance Pico" section violate PSR-2, but we want to keep them anyway --- index.php.dist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php.dist b/index.php.dist index 73d8330..2186072 100644 --- a/index.php.dist +++ b/index.php.dist @@ -1,4 +1,4 @@ - Date: Sun, 29 Nov 2015 17:00:05 +0100 Subject: [PATCH 40/42] CONTRIBUTING.md: Convert Issues template to continuous text --- CONTRIBUTING.md | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index cb3bfde..945417c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,17 +12,9 @@ Issues If you want to report an *issue* with Pico's core, please create a new [Issue](https://github.com/picocms/Pico/issues) on GitHub. Concerning problems with plugins or themes, please refer to the website of the developer of this plugin or theme. -Before creating a [new Issue on GitHub](https://github.com/picocms/Pico/issues/new), please make sure the problem wasn't reported yet using [GitHubs search engine](https://github.com/picocms/Pico/search?type=Issues). Please describe your issue as clear as possible and always include steps to reproduce the problem. +Before creating a [new Issue on GitHub](https://github.com/picocms/Pico/issues/new), please make sure the problem wasn't reported yet using [GitHubs search engine](https://github.com/picocms/Pico/search?type=Issues). -This is an example of what type of information to include with your issue. - -- Pico Version -- Installed plugins, if applicable -- Bug Description -- Steps to Reproduce -- Actual/Expected Behavior -- Troubleshooting/Testing Steps Attempted -- Workarounds? +Please describe your issue as clear as possible and always include the *Pico version* you're using. Provided that you're using *plugins*, include a list of them. We need information about the *actual and expected behavior* and *steps to reproduce* the problem. What steps have you taken to resolve the problem by yourself (i.e. *your own troubleshooting*)? Contributing code ----------------- From 372979e45b58c63b5fff1bc37e34e3f76b58cfc2 Mon Sep 17 00:00:00 2001 From: Daniel Rudolf Date: Sun, 29 Nov 2015 17:18:46 +0100 Subject: [PATCH 41/42] CONTRIBUTING.md: Update build & release process --- CONTRIBUTING.md | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 945417c..92e8af0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -80,27 +80,18 @@ As soon as development reaches a point where feedback is appreciated, a pull req Build & Release process ----------------------- -> This is work in progress. Please refer to [#268](https://github.com/picocms/Pico/issues/268) for details. +We're using [Travis CI](https://travis-ci.com) to automate the build & release process of Pico. It generates and deploys [phpDoc](http://phpdoc.org) class docs for new releases and on every commit to the `master` branch. Travis also prepares new releases by generating Pico's pre-built packages and uploading them to GitHub. Please refer to [our `.travis.yml`](https://github.com/picocms/Pico/blob/master/.travis.yml) for details. -We're using [Travis CI](https://travis-ci.com) to automate the build & release process of Pico. It generates and deploys [phpDoc](http://phpdoc.org) class docs for new releases and on every commit to the `master` branch. Travis also prepares new releases by generating Pico's pre-built packages and uploading them to GitHub. +As elucidated above, it's important that each commit to `master` is deployable. Once development of a new Pico release is finished, trigger Pico's build & release process by pushing a new Git tag. This tag should reference a (usually empty) commit on `master`, which message should follow the following template: -It is important that each commit to `master` is deployable. Once a `feature/branch` or the `master` branch have reached a point where the need for a version increase is necessary, you can trigger this process by pushing a new Git Tag. The tag references a (usually empty) commit which message follows the following template: +``` +Version 1.0.0 - Example: - ``` - Pico Version 1.0.1 - * [New] ... - * [Changed] ... - * [Removed] ... - * [Security] ... - ``` +* [Security] ... +* [New] ... +* [Changed] ... +* [Fixed] ... +* [Removed] ... +``` - - -After deploying a new release, you will need to amend the release information on GitHub with the release title (taken from changelog), and changelog itself. - -__Note__ -- Releases will be available at: [https://github.com/picocms/Pico/releases](https://github.com/picocms/Pico/releases) - -- Pico will be automatically updated on [Packagist](http://packagist.org/packages/picocms/pico) +Travis CI will draft the new [release on GitHub](https://github.com/picocms/Pico/releases) automatically, but will require you to manually amend the descriptions formatting. The latest Pico version is always available at https://github.com/picocms/Pico/releases/latest, so please make sure to publish this URL rather than version-specific URLs. [Packagist](http://packagist.org/packages/picocms/pico) will be updated automatically. From bef150221b3755e9f0fbe2d8c42bdedfb9691717 Mon Sep 17 00:00:00 2001 From: theshka Date: Sun, 29 Nov 2015 11:11:26 -0600 Subject: [PATCH 42/42] CONTRIBUTING.md: Final tocuhes on Build & Release section. --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 92e8af0..b849472 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,7 +14,7 @@ If you want to report an *issue* with Pico's core, please create a new [Issue](h Before creating a [new Issue on GitHub](https://github.com/picocms/Pico/issues/new), please make sure the problem wasn't reported yet using [GitHubs search engine](https://github.com/picocms/Pico/search?type=Issues). -Please describe your issue as clear as possible and always include the *Pico version* you're using. Provided that you're using *plugins*, include a list of them. We need information about the *actual and expected behavior* and *steps to reproduce* the problem. What steps have you taken to resolve the problem by yourself (i.e. *your own troubleshooting*)? +Please describe your issue as clear as possible and always include the *Pico version* you're using. Provided that you're using *plugins*, include a list of them too. We need information about the *actual and expected behavior*, the *steps to reproduce* the problem, and what steps have you taken to resolve the problem by yourself (i.e. *your own troubleshooting*)? Contributing code ----------------- @@ -82,7 +82,7 @@ Build & Release process We're using [Travis CI](https://travis-ci.com) to automate the build & release process of Pico. It generates and deploys [phpDoc](http://phpdoc.org) class docs for new releases and on every commit to the `master` branch. Travis also prepares new releases by generating Pico's pre-built packages and uploading them to GitHub. Please refer to [our `.travis.yml`](https://github.com/picocms/Pico/blob/master/.travis.yml) for details. -As elucidated above, it's important that each commit to `master` is deployable. Once development of a new Pico release is finished, trigger Pico's build & release process by pushing a new Git tag. This tag should reference a (usually empty) commit on `master`, which message should follow the following template: +As insinuated above, it is important that each commit to `master` is deployable. Once development of a new Pico release is finished, trigger Pico's build & release process by pushing a new Git tag. This tag should reference a (usually empty) commit on `master`, which message should adhere to the following template: ``` Version 1.0.0