瀏覽代碼

Merge branch 'feature/auto-docs' into enhancement/build-release

theshka 9 年之前
父節點
當前提交
e79388118c
共有 3 個文件被更改,包括 39 次插入2 次删除
  1. 7 2
      .travis.yml
  2. 29 0
      build/deploy-phpdoc.sh
  3. 3 0
      composer.json

+ 7 - 2
.travis.yml

@@ -12,7 +12,13 @@ script:
   - find . -type f -name '*.php' -print0 | xargs -0 -I file php -l file > /dev/null
 
 before_deploy:
-  - composer install
+  # 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
 
 deploy:
@@ -26,4 +32,3 @@ deploy:
     php: 5.3
 
 sudo: false
-

+ 29 - 0
build/deploy-phpdoc.sh

@@ -0,0 +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"
+
+# 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/$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
+
+# 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 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

+ 3 - 0
composer.json

@@ -17,6 +17,9 @@
         "erusev/parsedown-extra": "0.7.*",
         "symfony/yaml" : "2.3"
     },
+    "require-dev" : {
+        "phpdocumentor/phpdocumentor": "^2.8"
+    },
     "autoload": {
         "psr-0": {
             "Pico": "lib/",