commit
6a7494a54d
@ -0,0 +1,77 @@ |
||||
#!/usr/bin/env bash |
||||
set -e |
||||
|
||||
export PATH="$PICO_TOOLS_DIR:$PATH" |
||||
. "$PICO_TOOLS_DIR/functions/parse-version.sh.inc" |
||||
|
||||
# parameters |
||||
ARCHIVE="$1" # release archive file name |
||||
|
||||
if [ -z "$ARCHIVE" ]; then |
||||
echo "Unable to create release archive: No file name specified" >&2 |
||||
exit 1 |
||||
fi |
||||
|
||||
# parse version |
||||
if ! parse_version "$PROJECT_REPO_TAG"; then |
||||
echo "Unable to create release archive: Invalid version '$PROJECT_REPO_TAG'" >&2 |
||||
exit 1 |
||||
fi |
||||
|
||||
# clone repo |
||||
github-clone.sh "$PICO_BUILD_DIR" "https://github.com/$RELEASE_REPO_SLUG.git" "$RELEASE_REPO_BRANCH" |
||||
|
||||
cd "$PICO_BUILD_DIR" |
||||
|
||||
# force Pico version |
||||
echo "Updating composer dependencies..." |
||||
composer require --no-update \ |
||||
"picocms/pico $VERSION_FULL@$VERSION_STABILITY" \ |
||||
"picocms/pico-theme $VERSION_FULL@$VERSION_STABILITY" \ |
||||
"picocms/pico-deprecated $VERSION_FULL@$VERSION_STABILITY" |
||||
echo |
||||
|
||||
# install dependencies |
||||
echo "Running \`composer install\`..." |
||||
composer install --no-suggest --prefer-dist --no-dev --optimize-autoloader |
||||
echo |
||||
|
||||
# prepare release |
||||
echo "Replacing 'index.php'..." |
||||
cp vendor/picocms/pico/index.php.dist index.php |
||||
|
||||
echo "Adding 'config/config.yml.template'..." |
||||
cp vendor/picocms/pico/config/config.yml.template config/config.yml.template |
||||
|
||||
echo "Adding 'README.md', 'CONTRIBUTING.md', 'CHANGELOG.md'..." |
||||
cp vendor/picocms/pico/README.md README.md |
||||
cp vendor/picocms/pico/CONTRIBUTING.md CONTRIBUTING.md |
||||
cp vendor/picocms/pico/CHANGELOG.md CHANGELOG.md |
||||
|
||||
echo "Preparing 'composer.json' for release..." |
||||
composer require --no-update \ |
||||
"picocms/pico ^$VERSION_MILESTONE" \ |
||||
"picocms/pico-theme ^$VERSION_MILESTONE" \ |
||||
"picocms/pico-deprecated ^$VERSION_MILESTONE" |
||||
|
||||
echo "Removing '.git' directory..." |
||||
rm -rf .git |
||||
|
||||
echo "Removing '.git' directories of dependencies..." |
||||
find vendor/ -type d -path 'vendor/*/*/.git' -print0 | xargs -0 rm -rf |
||||
find themes/ -type d -path 'themes/*/.git' -print0 | xargs -0 rm -rf |
||||
find plugins/ -type d -path 'plugins/*/.git' -print0 | xargs -0 rm -rf |
||||
|
||||
echo |
||||
|
||||
# create release archive |
||||
echo "Creating release archive '$ARCHIVE'..." |
||||
|
||||
if [ -e "$ARCHIVE" ]; then |
||||
echo "Unable to create release archive: File exists" >&2 |
||||
exit 1 |
||||
fi |
||||
|
||||
find . -mindepth 1 -maxdepth 1 -printf '%f\0' \ |
||||
| xargs -0 -- tar -czf "$ARCHIVE" -- |
||||
echo |
@ -0,0 +1,44 @@ |
||||
#!/usr/bin/env bash |
||||
set -e |
||||
|
||||
export PATH="$PICO_TOOLS_DIR:$PATH" |
||||
|
||||
# get current Pico milestone |
||||
VERSION="$(php -r "require_once('$PICO_PROJECT_DIR/lib/Pico.php'); echo Pico::VERSION;")" |
||||
MILESTONE="Pico$([[ "$VERSION" =~ ^([0-9]+\.[0-9]+)\. ]] && echo " ${BASH_REMATCH[1]}")" |
||||
|
||||
echo "Deploying $PROJECT_REPO_BRANCH branch ($MILESTONE)..." |
||||
echo |
||||
|
||||
# clone repo |
||||
github-clone.sh "$PICO_DEPLOY_DIR" "https://github.com/$DEPLOY_REPO_SLUG.git" "$DEPLOY_REPO_BRANCH" |
||||
|
||||
cd "$PICO_DEPLOY_DIR" |
||||
|
||||
# setup repo |
||||
github-setup.sh |
||||
|
||||
# generate phpDocs |
||||
generate-phpdoc.sh \ |
||||
"$PICO_PROJECT_DIR/.phpdoc.xml" \ |
||||
"$PICO_DEPLOY_DIR/phpDoc/$PICO_DEPLOYMENT.cache" "$PICO_DEPLOY_DIR/phpDoc/$PICO_DEPLOYMENT" \ |
||||
"$MILESTONE API Documentation ($PROJECT_REPO_BRANCH branch)" |
||||
|
||||
if [ -z "$(git status --porcelain "$PICO_DEPLOY_DIR/phpDoc/$PICO_DEPLOYMENT.cache")" ]; then |
||||
# nothing to do |
||||
exit 0 |
||||
fi |
||||
|
||||
# update phpDoc list |
||||
update-phpdoc-list.sh \ |
||||
"$PICO_DEPLOY_DIR/_data/phpDoc.yml" \ |
||||
"$PICO_DEPLOYMENT" "branch" "<code>$PROJECT_REPO_BRANCH</code> branch" "$(date +%s)" |
||||
|
||||
# commit phpDocs |
||||
github-commit.sh \ |
||||
"Update phpDocumentor class docs for $PROJECT_REPO_BRANCH branch @ $PROJECT_REPO_COMMIT" \ |
||||
"$PICO_DEPLOY_DIR/phpDoc/$PICO_DEPLOYMENT.cache" "$PICO_DEPLOY_DIR/phpDoc/$PICO_DEPLOYMENT" \ |
||||
"$PICO_DEPLOY_DIR/_data/phpDoc.yml" |
||||
|
||||
# deploy phpDocs |
||||
github-deploy.sh "$PROJECT_REPO_SLUG" "heads/$PROJECT_REPO_BRANCH" "$PROJECT_REPO_COMMIT" |
@ -0,0 +1,116 @@ |
||||
#!/usr/bin/env bash |
||||
set -e |
||||
|
||||
DEPLOY_FULL="true" |
||||
if [ "$DEPLOY_PHPDOC_RELEASES" != "true" ]; then |
||||
echo "Skipping phpDoc release deployment because it has been disabled" |
||||
DEPLOY_FULL="false" |
||||
fi |
||||
if [ "$DEPLOY_VERSION_BADGE" != "true" ]; then |
||||
echo "Skipping version badge deployment because it has been disabled" |
||||
DEPLOY_FULL="false" |
||||
fi |
||||
if [ "$DEPLOY_VERSION_FILE" != "true" ]; then |
||||
echo "Skipping version file deployment because it has been disabled" |
||||
DEPLOY_FULL="false" |
||||
fi |
||||
if [ "$DEPLOY_CLOC_STATS" != "true" ]; then |
||||
echo "Skipping cloc statistics deployment because it has been disabled" |
||||
DEPLOY_FULL="false" |
||||
fi |
||||
|
||||
if [ "$DEPLOY_FULL" != "true" ]; then |
||||
if [ "$DEPLOY_PHPDOC_RELEASES" != "true" ] \ |
||||
&& [ "$DEPLOY_VERSION_BADGE" != "true" ] \ |
||||
&& [ "$DEPLOY_VERSION_FILE" != "true" ] \ |
||||
&& [ "$DEPLOY_CLOC_STATS" != "true" ] |
||||
then |
||||
# nothing to do |
||||
exit 0 |
||||
fi |
||||
echo |
||||
fi |
||||
|
||||
export PATH="$PICO_TOOLS_DIR:$PATH" |
||||
. "$PICO_TOOLS_DIR/functions/parse-version.sh.inc" |
||||
|
||||
# parse version |
||||
if ! parse_version "$PROJECT_REPO_TAG"; then |
||||
echo "Invalid version '$PROJECT_REPO_TAG'; aborting..." >&2 |
||||
exit 1 |
||||
fi |
||||
|
||||
echo "Deploying Pico $VERSION_MILESTONE ($VERSION_STABILITY)..." |
||||
printf 'VERSION_FULL="%s"\n' "$VERSION_FULL" |
||||
printf 'VERSION_NAME="%s"\n' "$VERSION_NAME" |
||||
printf 'VERSION_ID="%s"\n' "$VERSION_ID" |
||||
echo |
||||
|
||||
# clone repo |
||||
github-clone.sh "$PICO_DEPLOY_DIR" "https://github.com/$DEPLOY_REPO_SLUG.git" "$DEPLOY_REPO_BRANCH" |
||||
|
||||
cd "$PICO_DEPLOY_DIR" |
||||
|
||||
# setup repo |
||||
github-setup.sh |
||||
|
||||
# generate phpDocs |
||||
if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then |
||||
# generate phpDocs |
||||
generate-phpdoc.sh \ |
||||
"$PICO_PROJECT_DIR/.phpdoc.xml" \ |
||||
"-" "$PICO_DEPLOY_DIR/phpDoc/$PICO_DEPLOYMENT" \ |
||||
"Pico $VERSION_MILESTONE API Documentation (v$VERSION_FULL)" |
||||
|
||||
if [ -n "$(git status --porcelain "$PICO_DEPLOY_DIR/phpDoc/$PICO_DEPLOYMENT")" ]; then |
||||
# update phpDoc list |
||||
update-phpdoc-list.sh \ |
||||
"$PICO_DEPLOY_DIR/_data/phpDoc.yml" \ |
||||
"$PICO_DEPLOYMENT" "version" "Pico $VERSION_FULL" "$(date +%s)" |
||||
|
||||
# commit phpDocs |
||||
github-commit.sh \ |
||||
"Update phpDocumentor class docs for v$VERSION_FULL" \ |
||||
"$PICO_DEPLOY_DIR/phpDoc/$PICO_DEPLOYMENT" "$PICO_DEPLOY_DIR/_data/phpDoc.yml" |
||||
fi |
||||
fi |
||||
|
||||
# don't update version badge, version file and cloc statistics for pre-releases |
||||
if [ "$VERSION_STABILITY" == "stable" ]; then |
||||
# update version badge |
||||
if [ "$DEPLOY_VERSION_BADGE" == "true" ]; then |
||||
generate-badge.sh \ |
||||
"$PICO_DEPLOY_DIR/badges/pico-version.svg" \ |
||||
"release" "$VERSION_FULL" "blue" |
||||
|
||||
# commit version badge |
||||
github-commit.sh \ |
||||
"Update version badge for v$VERSION_FULL" \ |
||||
"$PICO_DEPLOY_DIR/badges/pico-version.svg" |
||||
fi |
||||
|
||||
# update version file |
||||
if [ "$DEPLOY_VERSION_FILE" == "true" ]; then |
||||
update-version-file.sh \ |
||||
"$PICO_DEPLOY_DIR/_data/version.yml" \ |
||||
"$VERSION_FULL" |
||||
|
||||
# commit version file |
||||
github-commit.sh \ |
||||
"Update version file for v$VERSION_FULL" \ |
||||
"$PICO_DEPLOY_DIR/_data/version.yml" |
||||
fi |
||||
|
||||
# update cloc statistics |
||||
if [ "$DEPLOY_CLOC_STATS" == "true" ]; then |
||||
update-cloc-stats.sh "$PICO_DEPLOY_DIR/_data/cloc.yml" |
||||
|
||||
# commit cloc statistics |
||||
github-commit.sh \ |
||||
"Update cloc statistics for v$VERSION_FULL" \ |
||||
"$PICO_DEPLOY_DIR/_data/cloc.yml" |
||||
fi |
||||
fi |
||||
|
||||
# deploy |
||||
github-deploy.sh "$PROJECT_REPO_SLUG" "tags/$PROJECT_REPO_TAG" "$PROJECT_REPO_COMMIT" |
@ -0,0 +1,6 @@ |
||||
#!/usr/bin/env bash |
||||
if [ -n "$PROJECT_REPO_TAG" ]; then |
||||
exec "$(dirname "$0")/deploy-release.sh" |
||||
else |
||||
exec "$(dirname "$0")/deploy-branch.sh" |
||||
fi |
@ -0,0 +1,54 @@ |
||||
#!/usr/bin/env bash |
||||
set -e |
||||
|
||||
# setup build system |
||||
echo "Installing build dependencies..." |
||||
|
||||
case "$1" in |
||||
"--deploy") |
||||
echo "Synchronizing package index files..." |
||||
sudo apt-get update |
||||
|
||||
echo "Installing packages..." |
||||
sudo apt-get install -y cloc |
||||
;; |
||||
esac |
||||
|
||||
echo |
||||
|
||||
# setup composer |
||||
echo "Setup Composer..." |
||||
|
||||
# let composer use our GITHUB_OAUTH_TOKEN |
||||
if [ -n "$GITHUB_OAUTH_TOKEN" ]; then |
||||
composer config --global github-oauth.github.com "$GITHUB_OAUTH_TOKEN" |
||||
fi |
||||
|
||||
# set COMPOSER_ROOT_VERSION when necessary |
||||
if [ -z "$COMPOSER_ROOT_VERSION" ] && [ -n "$PROJECT_REPO_BRANCH" ]; then |
||||
PICO_VERSION_PATTERN="$(php -r " |
||||
\$json = json_decode(file_get_contents('$PICO_PROJECT_DIR/composer.json'), true); |
||||
if (\$json !== null) { |
||||
if (isset(\$json['extra']['branch-alias']['dev-$PROJECT_REPO_BRANCH'])) { |
||||
echo 'dev-$PROJECT_REPO_BRANCH'; |
||||
} |
||||
} |
||||
")" |
||||
|
||||
if [ -z "$PICO_VERSION_PATTERN" ]; then |
||||
PICO_VERSION_PATTERN="$(php -r " |
||||
require_once('$PICO_PROJECT_DIR/lib/Pico.php'); |
||||
echo preg_replace('/\.[0-9]+-dev$/', '.x-dev', Pico::VERSION); |
||||
")" |
||||
fi |
||||
|
||||
if [ -n "$PICO_VERSION_PATTERN" ]; then |
||||
export COMPOSER_ROOT_VERSION="$PICO_VERSION_PATTERN" |
||||
fi |
||||
fi |
||||
|
||||
echo |
||||
|
||||
# install dependencies |
||||
echo "Running \`composer install\`$([ -n "$COMPOSER_ROOT_VERSION" ] && echo -n " ($COMPOSER_ROOT_VERSION)")..." |
||||
composer install --no-suggest |
@ -0,0 +1,48 @@ |
||||
<!-- |
||||
|
||||
Developer Certificate of Origin |
||||
=============================== |
||||
|
||||
By contributing to Pico, you accept and agree to the following terms and conditions (the *Developer Certificate of Origin*) for your present and future contributions submitted to Pico. Please refer to the *Developer Certificate of Origin* section in Pico's [`CONTRIBUTING.md`](https://github.com/picocms/Pico/blob/master/CONTRIBUTING.md#developer-certificate-of-origin) for details. |
||||
|
||||
``` |
||||
Developer Certificate of Origin |
||||
Version 1.1 |
||||
|
||||
Copyright (C) 2004, 2006 The Linux Foundation and its contributors. |
||||
1 Letterman Drive |
||||
Suite D4700 |
||||
San Francisco, CA, 94129 |
||||
|
||||
Everyone is permitted to copy and distribute verbatim copies of this |
||||
license document, but changing it is not allowed. |
||||
|
||||
|
||||
Developer's Certificate of Origin 1.1 |
||||
|
||||
By making a contribution to this project, I certify that: |
||||
|
||||
(a) The contribution was created in whole or in part by me and I |
||||
have the right to submit it under the open source license |
||||
indicated in the file; or |
||||
|
||||
(b) The contribution is based upon previous work that, to the best |
||||
of my knowledge, is covered under an appropriate open source |
||||
license and I have the right under that license to submit that |
||||
work with modifications, whether created in whole or in part |
||||
by me, under the same open source license (unless I am |
||||
permitted to submit under a different license), as indicated |
||||
in the file; or |
||||
|
||||
(c) The contribution was provided directly to me by some other |
||||
person who certified (a), (b) or (c) and I have not modified |
||||
it. |
||||
|
||||
(d) I understand and agree that this project and the contribution |
||||
are public and that a record of the contribution (including all |
||||
personal information I submit with it, including my sign-off) is |
||||
maintained indefinitely and may be redistributed consistent with |
||||
this project or the open source license(s) involved. |
||||
``` |
||||
|
||||
--> |
@ -1,42 +0,0 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
RELEASE="$1" |
||||
ARCHIVE="pico-release.tar.gz" |
||||
[ -n "$RELEASE" ] && ARCHIVE="pico-release-$RELEASE.tar.gz" |
||||
|
||||
# install dependencies |
||||
echo "Running \`composer install\`..." |
||||
composer install --no-dev --optimize-autoloader |
||||
[ $? -eq 0 ] || exit 1 |
||||
echo |
||||
|
||||
# remove .git dirs |
||||
echo "Removing '.git' directories of dependencies..." |
||||
find vendor/ -type d -path 'vendor/*/*/.git' -print0 | xargs -0 rm -rf |
||||
echo |
||||
|
||||
# create release archive |
||||
echo "Creating release archive '$ARCHIVE'..." |
||||
|
||||
if [ -e "$ARCHIVE" ]; then |
||||
echo "Unable to create archive: File exists" >&2 |
||||
exit 1 |
||||
fi |
||||
|
||||
INDEX_BACKUP="$(mktemp -u)" |
||||
mv index.php "$INDEX_BACKUP" |
||||
mv index.php.dist index.php |
||||
|
||||
tar -czf "$ARCHIVE" \ |
||||
README.md LICENSE.md CONTRIBUTING.md CHANGELOG.md \ |
||||
composer.json composer.lock \ |
||||
config content-sample lib plugins themes vendor \ |
||||
.htaccess index.php |
||||
EXIT=$? |
||||
|
||||
mv index.php index.php.dist |
||||
mv "$INDEX_BACKUP" index.php |
||||
|
||||
echo |
||||
|
||||
[ $EXIT -eq 0 ] || exit 1 |
@ -1,62 +0,0 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
if [ "$TRAVIS_PHP_VERSION" != "5.3" ]; then |
||||
echo "Skipping branch deployment because this is not on the required runtime" |
||||
exit 0 |
||||
fi |
||||
|
||||
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then |
||||
echo "Skipping branch deployment because this pull request (#$TRAVIS_PULL_REQUEST) is not permitted to deploy" |
||||
exit 0 |
||||
fi |
||||
|
||||
if [[ ",$DEPLOY_PHPDOC_BRANCHES," != *,"$TRAVIS_BRANCH",* ]]; then |
||||
echo "Skipping phpDoc branch deployment because this branch ($TRAVIS_BRANCH) is not permitted to deploy" |
||||
exit 0 |
||||
fi |
||||
|
||||
DEPLOYMENT_ID="${TRAVIS_BRANCH//\//_}" |
||||
DEPLOYMENT_DIR="$TRAVIS_BUILD_DIR/_build/deploy-$DEPLOYMENT_ID.git" |
||||
|
||||
[ -n "$DEPLOY_REPO_SLUG" ] || export DEPLOY_REPO_SLUG="$TRAVIS_REPO_SLUG" |
||||
[ -n "$DEPLOY_REPO_BRANCH" ] || export DEPLOY_REPO_BRANCH="gh-pages" |
||||
|
||||
# clone repo |
||||
github-clone.sh "$DEPLOYMENT_DIR" "https://github.com/$DEPLOY_REPO_SLUG.git" "$DEPLOY_REPO_BRANCH" |
||||
[ $? -eq 0 ] || exit 1 |
||||
|
||||
cd "$DEPLOYMENT_DIR" |
||||
|
||||
# setup repo |
||||
github-setup.sh |
||||
[ $? -eq 0 ] || exit 1 |
||||
|
||||
# generate phpDocs |
||||
generate-phpdoc.sh \ |
||||
"$TRAVIS_BUILD_DIR/.phpdoc.xml" \ |
||||
"$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" \ |
||||
"Pico 1.0 API Documentation ($TRAVIS_BRANCH branch)" |
||||
[ $? -eq 0 ] || exit 1 |
||||
[ -n "$(git status --porcelain "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache")" ] || exit 0 |
||||
|
||||
# update phpDoc list |
||||
update-phpdoc-list.sh \ |
||||
"$DEPLOYMENT_DIR/_data/phpDoc.yml" \ |
||||
"$TRAVIS_BRANCH" "branch" "<code>$TRAVIS_BRANCH</code> branch" "$(date +%s)" |
||||
[ $? -eq 0 ] || exit 1 |
||||
|
||||
# commit phpDocs |
||||
echo "Committing changes..." |
||||
git add \ |
||||
"$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" \ |
||||
"$DEPLOYMENT_DIR/_data/phpDoc.yml" |
||||
git commit \ |
||||
--message="Update phpDocumentor class docs for $TRAVIS_BRANCH branch @ $TRAVIS_COMMIT" \ |
||||
"$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID.cache" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" \ |
||||
"$DEPLOYMENT_DIR/_data/phpDoc.yml" |
||||
[ $? -eq 0 ] || exit 1 |
||||
echo |
||||
|
||||
# deploy phpDocs |
||||
github-deploy.sh "$TRAVIS_REPO_SLUG" "heads/$TRAVIS_BRANCH" "$TRAVIS_COMMIT" |
||||
[ $? -eq 0 ] || exit 1 |
@ -1,94 +0,0 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
if [ "$DEPLOY_PHPDOC_RELEASES" != "true" ]; then |
||||
echo "Skipping phpDoc release deployment because it has been disabled" |
||||
fi |
||||
if [ "$DEPLOY_VERSION_BADGE" != "true" ]; then |
||||
echo "Skipping version badge deployment because it has been disabled" |
||||
fi |
||||
if [ "$DEPLOY_VERSION_FILE" != "true" ]; then |
||||
echo "Skipping version file deployment because it has been disabled" |
||||
fi |
||||
if [ "$DEPLOY_PHPDOC_RELEASES" != "true" ] || [ "$DEPLOY_VERSION_BADGE" != "true" ] || [ "$DEPLOY_VERSION_FILE" != "true" ]; then |
||||
[ "$DEPLOY_PHPDOC_RELEASES" != "true" ] && [ "$DEPLOY_VERSION_BADGE" != "true" ] && [ "$DEPLOY_VERSION_FILE" != "true" ] && exit 0 || echo |
||||
fi |
||||
|
||||
DEPLOYMENT_ID="${TRAVIS_BRANCH//\//_}" |
||||
DEPLOYMENT_DIR="$TRAVIS_BUILD_DIR/_build/deploy-$DEPLOYMENT_ID.git" |
||||
|
||||
[ -n "$DEPLOY_REPO_SLUG" ] || export DEPLOY_REPO_SLUG="$TRAVIS_REPO_SLUG" |
||||
[ -n "$DEPLOY_REPO_BRANCH" ] || export DEPLOY_REPO_BRANCH="gh-pages" |
||||
|
||||
# clone repo |
||||
github-clone.sh "$DEPLOYMENT_DIR" "https://github.com/$DEPLOY_REPO_SLUG.git" "$DEPLOY_REPO_BRANCH" |
||||
[ $? -eq 0 ] || exit 1 |
||||
|
||||
cd "$DEPLOYMENT_DIR" |
||||
|
||||
# setup repo |
||||
github-setup.sh |
||||
[ $? -eq 0 ] || exit 1 |
||||
|
||||
# generate phpDocs |
||||
if [ "$DEPLOY_PHPDOC_RELEASES" == "true" ]; then |
||||
generate-phpdoc.sh \ |
||||
"$TRAVIS_BUILD_DIR/.phpdoc.xml" \ |
||||
"-" "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" \ |
||||
"Pico 1.0 API Documentation ($TRAVIS_TAG)" |
||||
[ $? -eq 0 ] || exit 1 |
||||
|
||||
if [ -n "$(git status --porcelain "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID")" ]; then |
||||
# update phpDoc list |
||||
update-phpdoc-list.sh \ |
||||
"$DEPLOYMENT_DIR/_data/phpDoc.yml" \ |
||||
"$TRAVIS_TAG" "version" "Pico ${TRAVIS_TAG#v}" "$(date +%s)" |
||||
[ $? -eq 0 ] || exit 1 |
||||
|
||||
# commit phpDocs |
||||
echo "Committing phpDoc changes..." |
||||
git add "$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" "$DEPLOYMENT_DIR/_data/phpDoc.yml" |
||||
git commit \ |
||||
--message="Update phpDocumentor class docs for $TRAVIS_TAG" \ |
||||
"$DEPLOYMENT_DIR/phpDoc/$DEPLOYMENT_ID" "$DEPLOYMENT_DIR/_data/phpDoc.yml" |
||||
[ $? -eq 0 ] || exit 1 |
||||
echo |
||||
fi |
||||
fi |
||||
|
||||
# update version badge |
||||
if [ "$DEPLOY_VERSION_BADGE" == "true" ]; then |
||||
generate-badge.sh \ |
||||
"$DEPLOYMENT_DIR/badges/pico-version.svg" \ |
||||
"release" "$TRAVIS_TAG" "blue" |
||||
[ $? -eq 0 ] || exit 1 |
||||
|
||||
# commit version badge |
||||
echo "Committing version badge..." |
||||
git add "$DEPLOYMENT_DIR/badges/pico-version.svg" |
||||
git commit \ |
||||
--message="Update version badge for $TRAVIS_TAG" \ |
||||
"$DEPLOYMENT_DIR/badges/pico-version.svg" |
||||
[ $? -eq 0 ] || exit 1 |
||||
echo |
||||
fi |
||||
|
||||
# update version file |
||||
if [ "$DEPLOY_VERSION_FILE" == "true" ]; then |
||||
update-version-file.sh \ |
||||
"$DEPLOYMENT_DIR/_data/version.yml" \ |
||||
"${TRAVIS_TAG#v}" |
||||
[ $? -eq 0 ] || exit 1 |
||||
|
||||
# commit version file |
||||
echo "Committing version file..." |
||||
git add "$DEPLOYMENT_DIR/_data/version.yml" |
||||
git commit \ |
||||
--message="Update version file for $TRAVIS_TAG" \ |
||||
"$DEPLOYMENT_DIR/_data/version.yml" |
||||
[ $? -eq 0 ] || exit 1 |
||||
echo |
||||
fi |
||||
|
||||
# deploy |
||||
github-deploy.sh "$TRAVIS_REPO_SLUG" "tags/$TRAVIS_TAG" "$TRAVIS_COMMIT" |
||||
[ $? -eq 0 ] || exit 1 |
@ -1,55 +0,0 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
## |
||||
# Downloads a custom badge from shields.io |
||||
# |
||||
# All credit goes to the awesome guys at shields.io! |
||||
# |
||||
# @see http://shields.io/ |
||||
# |
||||
# @author Daniel Rudolf |
||||
# @link http://picocms.org |
||||
# @license http://opensource.org/licenses/MIT |
||||
# |
||||
|
||||
set -e |
||||
|
||||
# parameters |
||||
BADGE_FILE_PATH="$1" # target file path |
||||
BADGE_SUBJECT="$2" # subject (left half) of the badge |
||||
BADGE_STATUS="$3" # status (right half) of the badge |
||||
BADGE_COLOR="$4" # color of the badge |
||||
|
||||
# print parameters |
||||
echo "Generating badge..." |
||||
printf 'BADGE_FILE_PATH="%s"\n' "$BADGE_FILE_PATH" |
||||
printf 'BADGE_SUBJECT="%s"\n' "$BADGE_SUBJECT" |
||||
printf 'BADGE_STATUS="%s"\n' "$BADGE_STATUS" |
||||
printf 'BADGE_COLOR="%s"\n' "$BADGE_COLOR" |
||||
echo |
||||
|
||||
# download badge from shields.io |
||||
printf 'Downloading badge...\n' |
||||
TMP_BADGE="$(mktemp -u)" |
||||
|
||||
curl --location --output "$TMP_BADGE" \ |
||||
"https://img.shields.io/badge/$BADGE_SUBJECT-$BADGE_STATUS-$BADGE_COLOR.svg" |
||||
|
||||
# validate badge |
||||
if [ ! -f "$TMP_BADGE" ] || [ ! -s "$TMP_BADGE" ]; then |
||||
echo "Unable to generate badge; skipping..." >&2 |
||||
exit 1 |
||||
fi |
||||
|
||||
# MIME type image/svg+xml isn't supported at the moment |
||||
# |
||||
#TMP_BADGE_MIME="$(file --mime-type "$TMP_BADGE" | cut -d ' ' -f 2)" |
||||
#if [ "$TMP_BADGE_MIME" != "image/svg+xml" ]; then |
||||
# echo "Generated badge should be of type 'image/svg+xml', '$TMP_BADGE_MIME' given; aborting...\n" >&2 |
||||
# exit 1 |
||||
#fi |
||||
|
||||
# deploy badge |
||||
mv "$TMP_BADGE" "$BADGE_FILE_PATH" |
||||
|
||||
echo |
@ -1,57 +0,0 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
## |
||||
# Generates phpDoc class documentation |
||||
# |
||||
# @author Daniel Rudolf |
||||
# @link http://picocms.org |
||||
# @license http://opensource.org/licenses/MIT |
||||
# |
||||
|
||||
set -e |
||||
|
||||
# parameters |
||||
PHPDOC_CONFIG="$1" # phpDoc config file |
||||
PHPDOC_CACHE_DIR="$2" # phpDoc cache dir |
||||
PHPDOC_TARGET_DIR="$3" # phpDoc output dir |
||||
PHPDOC_TITLE="$4" # API docs title |
||||
|
||||
# print parameters |
||||
echo "Generating phpDocs..." |
||||
printf 'PHPDOC_CONFIG="%s"\n' "$PHPDOC_CONFIG" |
||||
printf 'PHPDOC_CACHE_DIR="%s"\n' "$PHPDOC_CACHE_DIR" |
||||
printf 'PHPDOC_TARGET_DIR="%s"\n' "$PHPDOC_TARGET_DIR" |
||||
printf 'PHPDOC_TITLE="%s"\n' "$PHPDOC_TITLE" |
||||
echo |
||||
|
||||
# update a separate phpDoc cache |
||||
if [ "$PHPDOC_CACHE_DIR" != "-" ]; then |
||||
# parse phpDoc files (i.e. update cache) |
||||
printf "Update phpDoc cache...\n" |
||||
phpdoc project:parse --config "$PHPDOC_CONFIG" \ |
||||
--target "$PHPDOC_CACHE_DIR" |
||||
|
||||
# check for changes |
||||
printf '\nCheck for phpDoc cache changes...\n' |
||||
if [ -z "$(git status --porcelain "$PHPDOC_CACHE_DIR")" ]; then |
||||
printf 'No changes detected; skipping phpDocs renewal...\n\n' |
||||
exit 0 |
||||
fi |
||||
|
||||
# NOTE: actually the following command should be `phpdoc project:transform` |
||||
# instead of `phpdoc project:run`, but the command seems to be broken... |
||||
echo |
||||
else |
||||
# create temporary cache files in PHPDOC_TARGET_DIR |
||||
PHPDOC_CACHE_DIR="$PHPDOC_TARGET_DIR" |
||||
fi |
||||
|
||||
# transform phpDoc files (i.e. rewrite API docs) |
||||
printf 'Rewrite phpDocs...\n' |
||||
rm -rf "$PHPDOC_TARGET_DIR" |
||||
phpdoc project:run --config "$PHPDOC_CONFIG" \ |
||||
--cache-folder "$PHPDOC_CACHE_DIR" \ |
||||
--target "$PHPDOC_TARGET_DIR" \ |
||||
--title "$PHPDOC_TITLE" |
||||
|
||||
echo |
@ -1,29 +0,0 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
## |
||||
# Clones a Git repo |
||||
# |
||||
# @author Daniel Rudolf |
||||
# @link http://picocms.org |
||||
# @license http://opensource.org/licenses/MIT |
||||
# |
||||
|
||||
set -e |
||||
|
||||
# parameters |
||||
CLONE_TARGET_DIR="$1" # target directory |
||||
CLONE_REPO_URL="$2" # URL of the git repo to clone |
||||
CLONE_REPO_BRANCH="$3" # optional branch to checkout |
||||
|
||||
# print parameters |
||||
echo "Cloning repo..." |
||||
printf 'CLONE_TARGET_DIR="%s"\n' "$CLONE_TARGET_DIR" |
||||
printf 'CLONE_REPO_URL="%s"\n' "$CLONE_REPO_URL" |
||||
printf 'CLONE_REPO_BRANCH="%s"\n' "$CLONE_REPO_BRANCH" |
||||
echo |
||||
|
||||
# clone repo |
||||
[ -n "$CLONE_REPO_BRANCH" ] || CLONE_REPO_BRANCH="master" |
||||
git clone --branch="$CLONE_REPO_BRANCH" "$CLONE_REPO_URL" "$CLONE_TARGET_DIR" |
||||
|
||||
echo |
@ -1,70 +0,0 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
## |
||||
# Pushes commits to a GitHub repo |
||||
# |
||||
# @author Daniel Rudolf |
||||
# @link http://picocms.org |
||||
# @license http://opensource.org/licenses/MIT |
||||
# |
||||
|
||||
set -e |
||||
|
||||
# parameters |
||||
CHECK_REPO_SLUG="$1" # optional GitHub repo (e.g. picocms/Pico) to check |
||||
# its latest commit as basic race condition protection |
||||
CHECK_REMOTE_REF="$2" # optional remote Git reference (e.g. heads/master) |
||||
CHECK_LOCAL_COMMIT="$3" # optional local commit SHA1 |
||||
|
||||
# print parameters |
||||
echo "Deploying repo..." |
||||
printf 'CHECK_REPO_SLUG="%s"\n' "$CHECK_REPO_SLUG" |
||||
printf 'CHECK_REMOTE_REF="%s"\n' "$CHECK_REMOTE_REF" |
||||
printf 'CHECK_LOCAL_COMMIT="%s"\n' "$CHECK_LOCAL_COMMIT" |
||||
echo |
||||
|
||||
# check for changes |
||||
if [ -z "$(git log --oneline '@{upstream}..')" ]; then |
||||
printf 'Nothing to deploy; skipping...\n\n' |
||||
exit 0 |
||||
fi |
||||
|
||||
# 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 [ -n "$CHECK_REPO_SLUG" ] && [ -n "$CHECK_REMOTE_REF" ] && [ -n "$CHECK_LOCAL_COMMIT" ]; then |
||||
# retrieve information using GitHub APIv3 |
||||
printf 'Checking latest commit...\n' |
||||
CHECK_API_URL="https://api.github.com/repos/$CHECK_REPO_SLUG/git/refs/$CHECK_REMOTE_REF" |
||||
if [ -n "$GITHUB_OAUTH_TOKEN" ]; then |
||||
CHECK_API_RESPONSE="$(wget -O- --header="Authorization: token $GITHUB_OAUTH_TOKEN" "$CHECK_API_URL" 2> /dev/null)" |
||||
else |
||||
CHECK_API_RESPONSE="$(wget -O- "$CHECK_API_URL" 2> /dev/null)" |
||||
fi |
||||
|
||||
# evaluate JSON response |
||||
CHECK_REMOTE_COMMIT="$(echo "$CHECK_API_RESPONSE" | php -r " |
||||
\$json = json_decode(stream_get_contents(STDIN), true); |
||||
if (\$json !== null) { |
||||
if (isset(\$json['ref']) && (\$json['ref'] === 'refs/$CHECK_REMOTE_REF')) { |
||||
if (isset(\$json['object']) && isset(\$json['object']['sha'])) { |
||||
echo \$json['object']['sha']; |
||||
} |
||||
} |
||||
} |
||||
")" |
||||
|
||||
# compare source reference against the latest commit |
||||
if [ "$CHECK_REMOTE_COMMIT" != "$CHECK_LOCAL_COMMIT" ]; then |
||||
echo "Latest local commit '$CHECK_LOCAL_COMMIT' doesn't match latest remote commit '$CHECK_REMOTE_COMMIT'; aborting..." >&2 |
||||
exit 1 |
||||
fi |
||||
|
||||
echo |
||||
fi |
||||
|
||||
# push changes |
||||
printf 'Pushing changes...\n' |
||||
git push |
||||
|
||||
echo |
@ -1,37 +0,0 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
## |
||||
# Prepares a GitHub repo for deployment |
||||
# |
||||
# @author Daniel Rudolf |
||||
# @link http://picocms.org |
||||
# @license http://opensource.org/licenses/MIT |
||||
# |
||||
|
||||
set -e |
||||
|
||||
# environment variables |
||||
# GITHUB_OAUTH_TOKEN GitHub authentication token, see https://github.com/settings/tokens |
||||
|
||||
# print "parameters" (we don't have any) |
||||
echo "Setup repo..." |
||||
echo |
||||
|
||||
# check for git repo |
||||
if ! git rev-parse --git-dir > /dev/null 2>&1; then |
||||
echo "Not a git repo; aborting..." >&2 |
||||
exit 1 |
||||
fi |
||||
|
||||
# setup git |
||||
printf 'Preparing repo...\n' |
||||
git config push.default simple |
||||
git config user.name "Travis CI" |
||||
git config user.email "travis-ci@picocms.org" |
||||
|
||||
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 |
||||
|
||||
echo |
@ -1,78 +0,0 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
## |
||||
# Updates the phpDoc list |
||||
# |
||||
# @author Daniel Rudolf |
||||
# @link http://picocms.org |
||||
# @license http://opensource.org/licenses/MIT |
||||
# |
||||
|
||||
set -e |
||||
|
||||
# parameters |
||||
LIST_FILE_PATH="$1" # target file path |
||||
LIST_ID="$2" # phpDoc ID |
||||
LIST_TYPE="$3" # phpDoc type |
||||
LIST_TITLE="$4" # phpDoc title |
||||
LIST_LAST_UPDATE="$5" # phpDoc last update |
||||
|
||||
# print parameters |
||||
echo "Updating phpDoc list..." |
||||
printf 'LIST_FILE_PATH="%s"\n' "$LIST_FILE_PATH" |
||||
printf 'LIST_ID="%s"\n' "$LIST_ID" |
||||
printf 'LIST_TYPE="%s"\n' "$LIST_TYPE" |
||||
printf 'LIST_TITLE="%s"\n' "$LIST_TITLE" |
||||
printf 'LIST_LAST_UPDATE="%s"\n' "$LIST_LAST_UPDATE" |
||||
echo |
||||
|
||||
# create temporary file |
||||
printf 'Creating temporary file...\n' |
||||
LIST_TMP_FILE="$(mktemp)" |
||||
[ -n "$LIST_TMP_FILE" ] || exit 1 |
||||
|
||||
exec 3> "$LIST_TMP_FILE" |
||||
|
||||
# walk through phpDoc list |
||||
printf 'Walking through phpDoc list...\n' |
||||
|
||||
DO_REPLACE="no" |
||||
DID_REPLACE="no" |
||||
while IFS='' read -r LINE || [[ -n "$LINE" ]]; do |
||||
if [ "$DO_REPLACE" == "yes" ]; then |
||||
# skip lines until next entry is reached |
||||
[ "${LINE:0:2}" == " " ] && continue |
||||
DO_REPLACE="no" |
||||
|
||||
elif [ "$LINE" == "- id: $LIST_ID" ]; then |
||||
# update existing entry |
||||
printf 'Updating existing entry...\n' |
||||
printf -- '- id: %s\n' "$LIST_ID" >&3 |
||||
printf -- ' type: %s\n' "$LIST_TYPE" >&3 |
||||
printf -- ' title: %s\n' "$LIST_TITLE" >&3 |
||||
printf -- ' last_update: %s\n' "$LIST_LAST_UPDATE" >&3 |
||||
|
||||
DO_REPLACE="yes" |
||||
DID_REPLACE="yes" |
||||
continue |
||||
fi |
||||
|
||||
echo "$LINE" >&3 |
||||
done < "$LIST_FILE_PATH" |
||||
|
||||
# add new entry |
||||
if [ "$DID_REPLACE" == "no" ]; then |
||||
printf 'Adding new entry...\n' |
||||
printf -- '- id: %s\n' "$LIST_ID" >&3 |
||||
printf -- ' type: %s\n' "$LIST_TYPE" >&3 |
||||
printf -- ' title: %s\n' "$LIST_TITLE" >&3 |
||||
printf -- ' last_update: %s\n' "$LIST_LAST_UPDATE" >&3 |
||||
fi |
||||
|
||||
exec 3>&- |
||||
|
||||
# move temporary file |
||||
printf 'Replacing phpDoc list...\n' |
||||
mv "$LIST_TMP_FILE" "$LIST_FILE_PATH" |
||||
|
||||
echo |
@ -1,57 +0,0 @@ |
||||
#!/usr/bin/env bash |
||||
|
||||
## |
||||
# Updates the version file |
||||
# |
||||
# @author Daniel Rudolf |
||||
# @link http://picocms.org |
||||
# @license http://opensource.org/licenses/MIT |
||||
# |
||||
|
||||
set -e |
||||
|
||||
# parameters |
||||
VERSION_FILE_PATH="$1" # target file path |
||||
VERSION_FULL="$2" # full version string (e.g. 1.0.0-beta.1+7b4ad7f) |
||||
|
||||
# print parameters |
||||
echo "Generating version file..." |
||||
printf 'VERSION_FILE_PATH="%s"\n' "$VERSION_FILE_PATH" |
||||
printf 'VERSION_FULL="%s"\n' "$VERSION_FULL" |
||||
echo |
||||
|
||||
# evaluate version constraint (see http://semver.org/) |
||||
printf 'Evaluating version constraint...\n' |
||||
if [[ "$VERSION_FULL" =~ ^([0-9]+)\.([0-9]{1,2})\.([0-9]{1,2})(-([0-9A-Za-z\.\-]+))?(\+([0-9A-Za-z\.\-]+))?$ ]]; then |
||||
VERSION_MAJOR="${BASH_REMATCH[1]}" |
||||
VERSION_MINOR="${BASH_REMATCH[2]}" |
||||
VERSION_PATCH="${BASH_REMATCH[3]}" |
||||
VERSION_SUFFIX="${BASH_REMATCH[5]}" |
||||
VERSION_BUILD="${BASH_REMATCH[7]}" |
||||
|
||||
VERSION_MILESTONE="$VERSION_MAJOR.$VERSION_MINOR" |
||||
VERSION_NAME="$VERSION_MAJOR.$VERSION_MINOR.$VERSION_PATCH" |
||||
VERSION_ID="$VERSION_MAJOR$(printf '%02d' "$VERSION_MINOR")$(printf '%02d' "$VERSION_PATCH")" |
||||
else |
||||
echo "Invalid version constraint; skipping..." >&2 |
||||
exit 1 |
||||
fi |
||||
|
||||
# generate version file |
||||
printf 'Updating version file...\n' |
||||
echo -n "" > "$VERSION_FILE_PATH" |
||||
exec 3> "$VERSION_FILE_PATH" |
||||
|
||||
printf 'full: %s\n' "$VERSION_FULL" >&3 |
||||
printf 'name: %s\n' "$VERSION_NAME" >&3 |
||||
printf 'milestone: %s\n' "$VERSION_MILESTONE" >&3 |
||||
printf 'id: %d\n' "$VERSION_ID" >&3 |
||||
printf 'major: %d\n' "$VERSION_MAJOR" >&3 |
||||
printf 'minor: %d\n' "$VERSION_MINOR" >&3 |
||||
printf 'patch: %d\n' "$VERSION_PATCH" >&3 |
||||
printf 'suffix: %s\n' "$VERSION_SUFFIX" >&3 |
||||
printf 'build: %s\n' "$VERSION_BUILD" >&3 |
||||
|
||||
exec 3>&- |
||||
|
||||
echo |
@ -0,0 +1,2 @@ |
||||
# This directory is meant to be empty |
||||
* |
@ -0,0 +1,3 @@ |
||||
# This directory is meant to be empty, except for config.yml.template |
||||
* |
||||
!config.yml.template |
@ -1,58 +0,0 @@ |
||||
<?php |
||||
/** |
||||
* Pico configuration |
||||
* |
||||
* This is the configuration file for {@link Pico}. It comes loaded with the |
||||
* default values, which can be found in {@link Pico::getConfig()} (see |
||||
* {@path "lib/Pico.php"}). |
||||
* |
||||
* To override any of the default settings below, copy this file to |
||||
* {@path "config/config.php"}, uncomment the line, then make and |
||||
* save your changes. |
||||
* |
||||
* @author Gilbert Pellegrom |
||||
* @link http://picocms.org |
||||
* @license http://opensource.org/licenses/MIT The MIT License |
||||
* @version 1.0 |
||||
*/ |
||||
|
||||
/* |
||||
* BASIC |
||||
*/ |
||||
// $config['site_title'] = 'Pico'; // Site title |
||||
// $config['base_url'] = ''; // Override base URL (e.g. http://example.com) |
||||
// $config['rewrite_url'] = null; // A boolean indicating forced URL rewriting |
||||
|
||||
/* |
||||
* THEME |
||||
*/ |
||||
// $config['theme'] = 'default'; // Set the theme (defaults to "default") |
||||
// $config['twig_config'] = array( // Twig settings |
||||
// 'cache' => false, // To enable Twig caching change this to a path to a writable directory |
||||
// 'autoescape' => false, // Auto-escape Twig vars |
||||
// 'debug' => false // Enable Twig debug |
||||
// ); |
||||
|
||||
/* |
||||
* CONTENT |
||||
*/ |
||||
// $config['date_format'] = '%D %T'; // Set the PHP date format as described here: http://php.net/manual/en/function.strftime.php |
||||
// $config['pages_order_by'] = 'alpha'; // Order pages by "alpha" or "date" |
||||
// $config['pages_order'] = 'asc'; // Order pages "asc" or "desc" |
||||
// $config['content_dir'] = 'content-sample/'; // Content directory |
||||
// $config['content_ext'] = '.md'; // File extension of content files to serve |
||||
|
||||
/* |
||||
* TIMEZONE |
||||
*/ |
||||
// $config['timezone'] = 'UTC'; // Timezone may be required by your php install |
||||
|
||||
/* |
||||
* PLUGINS |
||||
*/ |
||||
// $config['DummyPlugin.enabled'] = false; // Force DummyPlugin to be disabled |
||||
|
||||
/* |
||||
* CUSTOM |
||||
*/ |
||||
// $config['custom_setting'] = 'Hello'; // Can be accessed by {{ config.custom_setting }} in a theme |
@ -0,0 +1,50 @@ |
||||
## |
||||
# Basic |
||||
# |
||||
site_title: Pico # The title of your website |
||||
base_url: ~ # Pico will try to guess its base URL, if this fails, override it here |
||||
# Example: http://example.com/pico/ |
||||
rewrite_url: ~ # A boolean (true or false) indicating whether URL rewriting is forced |
||||
timezone: UTC # Your PHP installation might require you to manually specify a timezone |
||||
|
||||
## |
||||
# Theme |
||||
# |
||||
theme: default # The name of your custom theme |
||||
theme_url: ~ # Pico will try to guess the URL to the themes dir of your installation |
||||
# If this fails, override it here. Example: http://example.com/pico/themes/ |
||||
theme_config: |
||||
widescreen: false # Default theme: Use more horicontal space (i.e. make the site container wider) |
||||
twig_config: |
||||
cache: false # Enable Twig template caching by specifying a path to a writable directory |
||||
autoescape: false # Let Twig escape variables by default |
||||
debug: false # Enable Twig's debugging mode |
||||
|
||||
## |
||||
# Content |
||||
# |
||||
date_format: %D %T # Pico's default date format |
||||
# See http://php.net/manual/en/function.strftime.php for more info |
||||
pages_order_by_meta: author # Sort pages by meta value "author" (set "pages_order_by" to "meta") |
||||
pages_order_by: alpha # Change how Pico sorts pages ("alpha" for alphabetical order, "date", or "meta") |
||||
pages_order: asc # Sort pages in ascending ("asc") or descending ("desc") order |
||||
content_dir: content/ # The path to Pico's content directory |
||||
content_ext: .md # The file extension of your Markdown files |
||||
content_config: |
||||
extra: true # Use the Parsedown Extra parser to support extended markup |
||||
# See https://michelf.ca/projects/php-markdown/extra/ for more info |
||||
breaks: false # A boolean indicating whether breaks in the markup should be reflected in the |
||||
# parsed contents of the page |
||||
escape: false # Escape HTML markup in your content files; don't confuse this with some sort of |
||||
# safe mode, enabling this doesn't allow you to process untrusted user input! |
||||
auto_urls: true # Automatically link URLs found in your markup |
||||
|
||||
## |
||||
# Plugins |
||||
# |
||||
DummyPlugin.enabled: false # Force the plugin "DummyPlugin" to be disabled |
||||
|
||||
## |
||||
# Custom |
||||
# |
||||
my_custom_setting: Hello World! # You can access custom settings in themes using {{ config.my_custom_setting }} |
@ -0,0 +1,12 @@ |
||||
--- |
||||
social: |
||||
- title: Visit us on GitHub |
||||
url: https://github.com/picocms/Pico |
||||
icon: octocat |
||||
- title: Join us on Freenode IRC Webchat |
||||
url: https://webchat.freenode.net/?channels=%23picocms |
||||
icon: chat |
||||
- title: Help us by creating/collecting bounties and pledging to fundraisers |
||||
url: https://www.bountysource.com/teams/picocms |
||||
icon: dollar |
||||
--- |
@ -0,0 +1,2 @@ |
||||
# This directory is meant to be empty |
||||
* |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,3 @@ |
||||
# This directory is meant to be empty, except for DummyPlugin.php |
||||
* |
||||
!DummyPlugin.php |
@ -1,437 +0,0 @@ |
||||
<?php |
||||
|
||||
/** |
||||
* Serve features of Pico deprecated since v1.0 |
||||
* |
||||
* This plugin exists for backward compatibility and is disabled by default. |
||||
* It gets automatically enabled when a plugin which doesn't implement |
||||
* {@link PicoPluginInterface} is loaded. This plugin triggers deprecated |
||||
* events and automatically enables {@link PicoParsePagesContent} and |
||||
* {@link PicoExcerpt}. These plugins heavily impact Pico's performance! You |
||||
* can disable this plugin by calling {@link PicoDeprecated::setEnabled()}. |
||||
* |
||||
* The following deprecated events are triggered by this plugin: |
||||
* |
||||
* | Event | ... triggers the deprecated event | |
||||
* | ------------------- | --------------------------------------------------------- | |
||||
* | onPluginsLoaded | plugins_loaded() | |
||||
* | onConfigLoaded | config_loaded($config) | |
||||
* | onRequestUrl | request_url($url) | |
||||
* | onContentLoading | before_load_content($file) | |
||||
* | onContentLoaded | after_load_content($file, $rawContent) | |
||||
* | on404ContentLoading | before_404_load_content($file) | |
||||
* | on404ContentLoaded | after_404_load_content($file, $rawContent) | |
||||
* | onMetaHeaders | before_read_file_meta($headers) | |
||||
* | onMetaParsed | file_meta($meta) | |
||||
* | onContentParsing | before_parse_content($rawContent) | |
||||
* | onContentParsed | after_parse_content($content) | |
||||
* | onContentParsed | content_parsed($content) | |
||||
* | onSinglePageLoaded | get_page_data($pages, $meta) | |
||||
* | onPagesLoaded | get_pages($pages, $currentPage, $previousPage, $nextPage) | |
||||
* | onTwigRegistration | before_twig_register() | |
||||
* | onPageRendering | before_render($twigVariables, $twig, $templateName) | |
||||
* | onPageRendered | after_render($output) | |
||||
* |
||||
* Since Pico 1.0 the config is stored in {@path "config/config.php"}. This |
||||
* plugin tries to read {@path "config.php"} in Pico's root dir and overwrites |
||||
* all settings previously specified in {@path "config/config.php"}. |
||||
* |
||||
* @author Daniel Rudolf |
||||
* @link http://picocms.org |
||||
* @license http://opensource.org/licenses/MIT The MIT License |
||||
* @version 1.0 |
||||
*/ |
||||
class PicoDeprecated extends AbstractPicoPlugin |
||||
{ |
||||
/** |
||||
* This plugin is disabled by default |
||||
* |
||||
* @see AbstractPicoPlugin::$enabled |
||||
*/ |
||||
protected $enabled = false; |
||||
|
||||
/** |
||||
* The requested file |
||||
* |
||||
* @see PicoDeprecated::getRequestFile() |
||||
* @var string|null |
||||
*/ |
||||
protected $requestFile; |
||||
|
||||
/** |
||||
* Enables this plugin on demand and triggers the deprecated event |
||||
* plugins_loaded() |
||||
* |
||||
* @see DummyPlugin::onPluginsLoaded() |
||||
*/ |
||||
public function onPluginsLoaded(array &$plugins) |
||||
{ |
||||
if (!empty($plugins)) { |
||||
foreach ($plugins as $plugin) { |
||||
if (!is_a($plugin, 'PicoPluginInterface')) { |
||||
// the plugin doesn't implement PicoPluginInterface; it uses deprecated events |
||||
// enable PicoDeprecated if it hasn't be explicitly enabled/disabled yet |
||||
if (!$this->isStatusChanged()) { |
||||
$this->setEnabled(true, true, true); |
||||
} |
||||
break; |
||||
} |
||||
} |
||||
} else { |
||||
// no plugins were found, so it actually isn't necessary to call deprecated events |
||||
// anyway, this plugin also ensures compatibility apart from events used by old plugins, |
||||
// so enable PicoDeprecated if it hasn't be explicitly enabled/disabled yet |
||||
if (!$this->isStatusChanged()) { |
||||
$this->setEnabled(true, true, true); |
||||
} |
||||
} |
||||
|
||||
if ($this->isEnabled()) { |
||||
$this->triggerEvent('plugins_loaded'); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Triggers the deprecated event config_loaded($config) |
||||
* |
||||
* This method also defines deprecated constants, reads the `config.php` |
||||
* in Pico's root dir, enables the plugins {@link PicoParsePagesContent} |
||||
* and {@link PicoExcerpt} and makes `$config` globally accessible (the |
||||
* latter was removed with Pico 0.9 and was added again as deprecated |
||||
* feature with Pico 1.0) |
||||
* |
||||
* @see PicoDeprecated::defineConstants() |
||||
* @see PicoDeprecated::loadRootDirConfig() |
||||
* @see PicoDeprecated::enablePlugins() |
||||
* @see DummyPlugin::onConfigLoaded() |
||||
* @param array &$config array of config variables |
||||
* @return void |
||||
*/ |
||||
public function onConfigLoaded(array &$config) |
||||
{ |
||||
$this->defineConstants(); |
||||
$this->loadRootDirConfig($config); |
||||
$this->enablePlugins(); |
||||
$GLOBALS['config'] = &$config; |
||||
|
||||
$this->triggerEvent('config_loaded', array(&$config)); |
||||
} |
||||
|
||||
/** |
||||
* Defines deprecated constants |
||||
* |
||||
* `ROOT_DIR`, `LIB_DIR`, `PLUGINS_DIR`, `THEMES_DIR` and `CONTENT_EXT` |
||||
* are deprecated since v1.0, `CONTENT_DIR` existed just in v0.9, |
||||
* `CONFIG_DIR` just for a short time between v0.9 and v1.0 and |
||||
* `CACHE_DIR` was dropped with v1.0 without a replacement. |
||||
* |
||||
* @see PicoDeprecated::onConfigLoaded() |
||||
* @return void |
||||
*/ |
||||
protected function defineConstants() |
||||
{ |
||||
if (!defined('ROOT_DIR')) { |
||||
define('ROOT_DIR', $this->getRootDir()); |
||||
} |
||||
if (!defined('CONFIG_DIR')) { |
||||
define('CONFIG_DIR', $this->getConfigDir()); |
||||
} |
||||
if (!defined('LIB_DIR')) { |
||||
$picoReflector = new ReflectionClass('Pico'); |
||||
define('LIB_DIR', dirname($picoReflector->getFileName()) . '/'); |
||||
} |
||||
if (!defined('PLUGINS_DIR')) { |
||||
define('PLUGINS_DIR', $this->getPluginsDir()); |
||||
} |
||||
if (!defined('THEMES_DIR')) { |
||||
define('THEMES_DIR', $this->getThemesDir()); |
||||
} |
||||
if (!defined('CONTENT_DIR')) { |
||||
define('CONTENT_DIR', $this->getConfig('content_dir')); |
||||
} |
||||
if (!defined('CONTENT_EXT')) { |
||||
define('CONTENT_EXT', $this->getConfig('content_ext')); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Read config.php in Pico's root dir |
||||
* |
||||
* @see PicoDeprecated::onConfigLoaded() |
||||
* @see Pico::loadConfig() |
||||
* @param array &$realConfig array of config variables |
||||
* @return void |
||||
*/ |
||||
protected function loadRootDirConfig(array &$realConfig) |
||||
{ |
||||
if (file_exists($this->getRootDir() . 'config.php')) { |
||||
// config.php in Pico::$rootDir is deprecated |
||||
// use config.php in Pico::$configDir instead |
||||
$config = null; |
||||
require($this->getRootDir() . 'config.php'); |
||||
|
||||
if (is_array($config)) { |
||||
if (isset($config['base_url'])) { |
||||
$config['base_url'] = rtrim($config['base_url'], '/') . '/'; |
||||
} |
||||
if (isset($config['content_dir'])) { |
||||
$config['content_dir'] = rtrim($config['content_dir'], '/\\') . '/'; |
||||
} |
||||
|
||||
$realConfig = $config + $realConfig; |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Enables the plugins PicoParsePagesContent and PicoExcerpt |
||||
* |
||||
* @see PicoParsePagesContent |
||||
* @see PicoExcerpt |
||||
* @return void |
||||
*/ |
||||
protected function enablePlugins() |
||||
{ |
||||
// enable PicoParsePagesContent and PicoExcerpt |
||||
// we can't enable them during onPluginsLoaded because we can't know |
||||
// if the user disabled us (PicoDeprecated) manually in the config |
||||
$plugins = $this->getPlugins(); |
||||
if (isset($plugins['PicoParsePagesContent'])) { |
||||
// parse all pages content if this plugin hasn't |
||||
// be explicitly enabled/disabled yet |
||||
if (!$plugins['PicoParsePagesContent']->isStatusChanged()) { |
||||
$plugins['PicoParsePagesContent']->setEnabled(true, true, true); |
||||
} |
||||
} |
||||
if (isset($plugins['PicoExcerpt'])) { |
||||
// enable excerpt plugin if it hasn't be explicitly enabled/disabled yet |
||||
if (!$plugins['PicoExcerpt']->isStatusChanged()) { |
||||
$plugins['PicoExcerpt']->setEnabled(true, true, true); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Triggers the deprecated event request_url($url) |
||||
* |
||||
* @see DummyPlugin::onRequestUrl() |
||||
*/ |
||||
public function onRequestUrl(&$url) |
||||
{ |
||||
$this->triggerEvent('request_url', array(&$url)); |
||||
} |
||||
|
||||
/** |
||||
* Sets PicoDeprecated::$requestFile to trigger the deprecated |
||||
* events after_load_content() and after_404_load_content() |
||||
* |
||||
* @see PicoDeprecated::onContentLoaded() |
||||
* @see PicoDeprecated::on404ContentLoaded() |
||||
* @see DummyPlugin::onRequestFile() |
||||
*/ |
||||
public function onRequestFile(&$file) |
||||
{ |
||||
$this->requestFile = &$file; |
||||
} |
||||
|
||||
/** |
||||
* Triggers the deprecated before_load_content($file) |
||||
* |
||||
* @see DummyPlugin::onContentLoading() |
||||
*/ |
||||
public function onContentLoading(&$file) |
||||
{ |
||||
$this->triggerEvent('before_load_content', array(&$file)); |
||||
} |
||||
|
||||
/** |
||||
* Triggers the deprecated event after_load_content($file, $rawContent) |
||||
* |
||||
* @see DummyPlugin::onContentLoaded() |
||||
*/ |
||||
public function onContentLoaded(&$rawContent) |
||||
{ |
||||
$this->triggerEvent('after_load_content', array(&$this->requestFile, &$rawContent)); |
||||
} |
||||
|
||||
/** |
||||
* Triggers the deprecated before_404_load_content($file) |
||||
* |
||||
* @see DummyPlugin::on404ContentLoading() |
||||
*/ |
||||
public function on404ContentLoading(&$file) |
||||
{ |
||||
$this->triggerEvent('before_404_load_content', array(&$file)); |
||||
} |
||||
|
||||
/** |
||||
* Triggers the deprecated event after_404_load_content($file, $rawContent) |
||||
* |
||||
* @see DummyPlugin::on404ContentLoaded() |
||||
*/ |
||||
public function on404ContentLoaded(&$rawContent) |
||||
{ |
||||
$this->triggerEvent('after_404_load_content', array(&$this->requestFile, &$rawContent)); |
||||
} |
||||
|
||||
/** |
||||
* Triggers the deprecated event before_read_file_meta($headers) |
||||
* |
||||
* @see DummyPlugin::onMetaHeaders() |
||||
*/ |
||||
public function onMetaHeaders(array &$headers) |
||||
{ |
||||
$this->triggerEvent('before_read_file_meta', array(&$headers)); |
||||
} |
||||
|
||||
/** |
||||
* Triggers the deprecated event file_meta($meta) |
||||
* |
||||
* @see DummyPlugin::onMetaParsed() |
||||
*/ |
||||
public function onMetaParsed(array &$meta) |
||||
{ |
||||
$this->triggerEvent('file_meta', array(&$meta)); |
||||
} |
||||
|
||||
/** |
||||
* Triggers the deprecated event before_parse_content($rawContent) |
||||
* |
||||
* @see DummyPlugin::onContentParsing() |
||||
*/ |
||||
public function onContentParsing(&$rawContent) |
||||
{ |
||||
$this->triggerEvent('before_parse_content', array(&$rawContent)); |
||||
} |
||||
|
||||
/** |
||||
* Triggers the deprecated events after_parse_content($content) and |
||||
* content_parsed($content) |
||||
* |
||||
* @see DummyPlugin::onContentParsed() |
||||
*/ |
||||
public function onContentParsed(&$content) |
||||
{ |
||||
$this->triggerEvent('after_parse_content', array(&$content)); |
||||
|
||||
// deprecated since v0.8 |
||||
$this->triggerEvent('content_parsed', array(&$content)); |
||||
} |
||||
|
||||
/** |
||||
* Triggers the deprecated event get_page_data($pages, $meta) |
||||
* |
||||
* @see DummyPlugin::onSinglePageLoaded() |
||||
*/ |
||||
public function onSinglePageLoaded(array &$pageData) |
||||
{ |
||||
$this->triggerEvent('get_page_data', array(&$pageData, $pageData['meta'])); |
||||
} |
||||
|
||||
/** |
||||
* Triggers the deprecated event |
||||
* get_pages($pages, $currentPage, $previousPage, $nextPage) |
||||
* |
||||
* Please note that the `get_pages()` event gets `$pages` passed without a |
||||
* array index. The index is rebuild later using either the `id` array key |
||||
* or is derived from the `url` array key. Duplicates are prevented by |
||||
* adding `~dup` when necessary. |
||||
* |
||||
* @see DummyPlugin::onPagesLoaded() |
||||
*/ |
||||
public function onPagesLoaded( |
||||
array &$pages, |
||||
array &$currentPage = null, |
||||
array &$previousPage = null, |
||||
array &$nextPage = null |
||||
) { |
||||
// remove keys of pages array |
||||
$plainPages = array(); |
||||
foreach ($pages as &$pageData) { |
||||
$plainPages[] = &$pageData; |
||||
} |
||||
unset($pageData); |
||||
|
||||
$this->triggerEvent('get_pages', array(&$plainPages, &$currentPage, &$previousPage, &$nextPage)); |
||||
|
||||
// re-index pages array |
||||
$pages = array(); |
||||
foreach ($plainPages as &$pageData) { |
||||
if (!isset($pageData['id'])) { |
||||
$urlPrefixLength = strlen($this->getBaseUrl()) + intval(!$this->isUrlRewritingEnabled()); |
||||
$pageData['id'] = substr($pageData['url'], $urlPrefixLength); |
||||
} |
||||
|
||||
// prevent duplicates |
||||
$id = $pageData['id']; |
||||
for ($i = 1; isset($pages[$id]); $i++) { |
||||
$id = $pageData['id'] . '~dup' . $i; |
||||
} |
||||
|
||||
$pages[$id] = &$pageData; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Triggers the deprecated event before_twig_register() |
||||
* |
||||
* @see DummyPlugin::onTwigRegistration() |
||||
*/ |
||||
public function onTwigRegistration() |
||||
{ |
||||
$this->triggerEvent('before_twig_register'); |
||||
} |
||||
|
||||
/** |
||||
* Triggers the deprecated event before_render($twigVariables, $twig, $templateName) |
||||
* |
||||
* Please note that the `before_render()` event gets `$templateName` passed |
||||
* without its file extension. The file extension is later added again. |
||||
* |
||||
* @see DummyPlugin::onPageRendering() |
||||
*/ |
||||
public function onPageRendering(Twig_Environment &$twig, array &$twigVariables, &$templateName) |
||||
{ |
||||
// template name contains file extension since Pico 1.0 |
||||
$fileExtension = ''; |
||||
if (($fileExtensionPos = strrpos($templateName, '.')) !== false) { |
||||
$fileExtension = substr($templateName, $fileExtensionPos); |
||||
$templateName = substr($templateName, 0, $fileExtensionPos); |
||||
} |
||||
|
||||
$this->triggerEvent('before_render', array(&$twigVariables, &$twig, &$templateName)); |
||||
|
||||
// add original file extension |
||||
$templateName = $templateName . $fileExtension; |
||||
} |
||||
|
||||
/** |
||||
* Triggers the deprecated event after_render($output) |
||||
* |
||||
* @see DummyPlugin::onPageRendered() |
||||
*/ |
||||
public function onPageRendered(&$output) |
||||
{ |
||||
$this->triggerEvent('after_render', array(&$output)); |
||||
} |
||||
|
||||
/** |
||||
* Triggers a deprecated event on all plugins |
||||
* |
||||
* Deprecated events are also triggered on plugins which implement |
||||
* {@link PicoPluginInterface}. Please note that the methods are called |
||||
* directly and not through {@link PicoPluginInterface::handleEvent()}. |
||||
* |
||||
* @param string $eventName event to trigger |
||||
* @param array $params parameters to pass |
||||
* @return void |
||||
*/ |
||||
protected function triggerEvent($eventName, array $params = array()) |
||||
{ |
||||
foreach ($this->getPlugins() as $plugin) { |
||||
if (method_exists($plugin, $eventName)) { |
||||
call_user_func_array(array($plugin, $eventName), $params); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,40 +0,0 @@ |
||||
<?php |
||||
|
||||
/** |
||||
* Parses the contents of all pages |
||||
* |
||||
* This plugin exists for backward compatibility and is disabled by default. |
||||
* It gets automatically enabled when {@link PicoDeprecated} is enabled. You |
||||
* can avoid this by calling {@link PicoParsePagesContent::setEnabled()}. |
||||
* |
||||
* This plugin heavily impacts Pico's performance, you should avoid to enable |
||||
* it whenever possible! If you must parse the contents of a page, do this |
||||
* selectively and only for pages you really need to. |
||||
* |
||||
* @author Daniel Rudolf |
||||
* @link http://picocms.org |
||||
* @license http://opensource.org/licenses/MIT The MIT License |
||||
* @version 1.0 |
||||
*/ |
||||
class PicoParsePagesContent extends AbstractPicoPlugin |
||||
{ |
||||
/** |
||||
* This plugin is disabled by default |
||||
* |
||||
* @see AbstractPicoPlugin::$enabled |
||||
*/ |
||||
protected $enabled = false; |
||||
|
||||
/** |
||||
* Parses the contents of all pages |
||||
* |
||||
* @see DummyPlugin::onSinglePageLoaded() |
||||
*/ |
||||
public function onSinglePageLoaded(array &$pageData) |
||||
{ |
||||
if (!isset($pageData['content'])) { |
||||
$pageData['content'] = $this->prepareFileContent($pageData['raw_content'], $pageData['meta']); |
||||
$pageData['content'] = $this->parseFileContent($pageData['content']); |
||||
} |
||||
} |
||||
} |
@ -1,81 +0,0 @@ |
||||
<?php |
||||
|
||||
/** |
||||
* Creates a excerpt for the contents of each page (as of Pico v0.9 and older) |
||||
* |
||||
* This plugin exists for backward compatibility and is disabled by default. |
||||
* It gets automatically enabled when {@link PicoDeprecated} is enabled. You |
||||
* can avoid this by calling {@link PicoExcerpt::setEnabled()}. |
||||
* |
||||
* This plugin doesn't do its job very well and depends on |
||||
* {@link PicoParsePagesContent}, what heavily impacts Pico's performance. You |
||||
* should either use the Description meta header field or write something own. |
||||
* Best solution seems to be a filter for twig, see e.g. |
||||
* {@link https://gist.github.com/james2doyle/6629712}. |
||||
* |
||||
* @author Daniel Rudolf |
||||
* @link http://picocms.org |
||||
* @license http://opensource.org/licenses/MIT The MIT License |
||||
* @version 1.0 |
||||
*/ |
||||
class PicoExcerpt extends AbstractPicoPlugin |
||||
{ |
||||
/** |
||||
* This plugin is disabled by default |
||||
* |
||||
* @see AbstractPicoPlugin::$enabled |
||||
*/ |
||||
protected $enabled = false; |
||||
|
||||
/** |
||||
* This plugin depends on PicoParsePagesContent |
||||
* |
||||
* @see PicoParsePagesContent |
||||
* @see AbstractPicoPlugin::$dependsOn |
||||
*/ |
||||
protected $dependsOn = array('PicoParsePagesContent'); |
||||
|
||||
/** |
||||
* Adds the default excerpt length of 50 words to the config |
||||
* |
||||
* @see DummyPlugin::onConfigLoaded() |
||||
*/ |
||||
public function onConfigLoaded(array &$config) |
||||
{ |
||||
if (!isset($config['excerpt_length'])) { |
||||
$config['excerpt_length'] = 50; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Creates a excerpt for the contents of each page |
||||
* |
||||
* @see PicoExcerpt::createExcerpt() |
||||
* @see DummyPlugin::onSinglePageLoaded() |
||||
*/ |
||||
public function onSinglePageLoaded(array &$pageData) |
||||
{ |
||||
if (!isset($pageData['excerpt'])) { |
||||
$pageData['excerpt'] = $this->createExcerpt( |
||||
strip_tags($pageData['content']), |
||||
$this->getConfig('excerpt_length') |
||||
); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* Helper function to create a excerpt of a string |
||||
* |
||||
* @param string $string the string to create a excerpt from |
||||
* @param int $wordLimit the maximum number of words the excerpt should be long |
||||
* @return string excerpt of $string |
||||
*/ |
||||
protected function createExcerpt($string, $wordLimit) |
||||
{ |
||||
$words = explode(' ', $string); |
||||
if (count($words) > $wordLimit) { |
||||
return trim(implode(' ', array_slice($words, 0, $wordLimit))) . '…'; |
||||
} |
||||
return $string; |
||||
} |
||||
} |
@ -0,0 +1,2 @@ |
||||
# This directory is meant to be empty |
||||
* |
@ -1,22 +0,0 @@ |
||||
Icon fonts generator |
||||
|
||||
## Fontello |
||||
|
||||
Copyright (C) 2011 by Vitaly Puzrin |
||||
|
||||
Author: Vitaly Puzrin |
||||
License: The MIT License <https://github.com/fontello/fontello/blob/master/LICENSE> |
||||
Homepage: http://fontello.com/ |
||||
|
||||
|
||||
|
||||
Font license info |
||||
|
||||
## Font Awesome |
||||
|
||||
Copyright (C) 2012 by Dave Gandy |
||||
|
||||
Author: Dave Gandy |
||||
License: SIL OFL 1.1 <http://scripts.sil.org/OFL> |
||||
Homepage: http://fortawesome.github.com/Font-Awesome/ |
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,56 +0,0 @@ |
||||
<!DOCTYPE html> |
||||
<html lang="en" class="no-js"> |
||||
<head> |
||||
<meta charset="utf-8" /> |
||||
|
||||
<title>{% if meta.title %}{{ meta.title }} | {% endif %}{{ site_title }}</title> |
||||
{% if meta.description %} |
||||
<meta name="description" content="{{ meta.description|striptags }}"> |
||||
{% endif %}{% if meta.robots %} |
||||
<meta name="robots" content="{{ meta.robots }}"> |
||||
{% endif %} |
||||
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:400,700" type="text/css" /> |
||||
<link rel="stylesheet" href="{{ theme_url }}/style.css" type="text/css" /> |
||||
<link rel="stylesheet" href="{{ theme_url }}/fontello.css" type="text/css" /> |
||||
|
||||
<script src="{{ theme_url }}/scripts/modernizr-2.6.1.min.js"></script> |
||||
</head> |
||||
<body> |
||||
|
||||
<header id="header"> |
||||
<div class="inner clearfix"> |
||||
<h1><a href="{{ "index"|link }}" id="logo">{{ site_title }}</a></h1> |
||||
<nav> |
||||
<ul> |
||||
{% for page in pages if page.title %} |
||||
<li{% if page.id == current_page.id %} class="active"{% endif %}> |
||||
<a href="{{ page.url }}">{{ page.title }}</a> |
||||
</li> |
||||
{% endfor %} |
||||
</ul> |
||||
</nav> |
||||
</div> |
||||
</header> |
||||
|
||||
<section id="content"> |
||||
<div class="inner"> |
||||
{{ content }} |
||||
</div> |
||||
</section> |
||||
|
||||
<footer id="footer"> |
||||
<div class="inner"> |
||||
<div class="social"> |
||||
{% for social in meta.social %} |
||||
<a href="{{ social.url }}" title="{{ social.title }}"><span class="icon-{{ social.icon }}"></span></a> |
||||
{% endfor %} |
||||
</div> |
||||
<a href="http://picocms.org/">Pico</a> was made by <a href="http://gilbert.pellegrom.me">Gilbert Pellegrom</a> |
||||
and is maintained by <a href="https://github.com/picocms/Pico/graphs/contributors">The Pico Community</a>. |
||||
Released under the <a href="https://github.com/picocms/Pico/blob/master/LICENSE.md">MIT license</a>. |
||||
</div> |
||||
</footer> |
||||
|
||||
</body> |
||||
</html> |
Before Width: | Height: | Size: 1.4 KiB |
File diff suppressed because one or more lines are too long
@ -1,332 +0,0 @@ |
||||
/*=================================*/ |
||||
/* Pico Default Theme |
||||
/* By: Gilbert Pellegrom |
||||
/* http: //dev7studios.com |
||||
/*=================================*/ |
||||
|
||||
/* Reset Styles |
||||
/*---------------------------------------------*/ |
||||
html, body, div, span, applet, object, iframe, |
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre, |
||||
a, abbr, acronym, address, big, cite, code, |
||||
del, dfn, em, font, img, ins, kbd, q, s, samp, |
||||
small, strike, strong, sub, sup, tt, var, |
||||
dl, dt, dd, ol, ul, li, |
||||
fieldset, form, label, legend, |
||||
table, caption, tbody, tfoot, thead, tr, th, td { |
||||
margin: 0; |
||||
padding: 0; |
||||
border: 0; |
||||
outline: 0; |
||||
font-weight: inherit; |
||||
font-style: inherit; |
||||
font-size: 100%; |
||||
font-family: inherit; |
||||
vertical-align: baseline; |
||||
} |
||||
|
||||
body { |
||||
line-height: 1; |
||||
color: black; |
||||
background: white; |
||||
} |
||||
|
||||
table { |
||||
border-collapse: collapse; |
||||
border-spacing: 0; |
||||
} |
||||
|
||||
caption, th, td { |
||||
text-align: left; |
||||
font-weight: normal; |
||||
} |
||||
|
||||
blockquote:before, blockquote:after, |
||||
q:before, q:after { |
||||
content: ""; |
||||
} |
||||
|
||||
blockquote, q { |
||||
quotes: "" ""; |
||||
} |
||||
|
||||
/* HTML5 tags */ |
||||
header, section, footer, |
||||
aside, nav, article, figure { |
||||
display: block; |
||||
} |
||||
|
||||
/* hand cursor on clickable input elements */ |
||||
label, input[type=button], input[type=submit], button { |
||||
cursor: pointer; |
||||
} |
||||
|
||||
/* make buttons play nice in IE: |
||||
www.viget.com/inspire/styling-the-button-element-in-internet-explorer/ */ |
||||
button { |
||||
width: auto; |
||||
overflow: visible; |
||||
} |
||||
|
||||
/* Sharper Thumbnails */ |
||||
img { |
||||
-ms-interpolation-mode: bicubic; |
||||
} |
||||
|
||||
/* Input Styles |
||||
/*---------------------------------------------*/ |
||||
input, |
||||
textarea, |
||||
select { |
||||
padding: 5px; |
||||
font: 400 1em Verdana, Sans-serif; |
||||
color: #666; |
||||
background: #fff; |
||||
border: 1px solid #999999; |
||||
margin: 0 0 1em 0; |
||||
} |
||||
|
||||
input:focus, |
||||
textarea:focus, |
||||
select:focus { |
||||
color: #000; |
||||
background: #fff; |
||||
border: 1px solid #666666; |
||||
} |
||||
|
||||
/* Main Styles |
||||
/*---------------------------------------------*/ |
||||
html { height: 100%; } |
||||
|
||||
body { |
||||
font: 14px/1.8em 'Open Sans', Helvetica, Arial, Helvetica, sans-serif; |
||||
color: #444; |
||||
background: #fff; |
||||
-webkit-font-smoothing: antialiased; |
||||
display: flex; |
||||
flex-direction: column; |
||||
height: 100%; |
||||
} |
||||
|
||||
a, a:visited { |
||||
color: #2EAE9B; |
||||
text-decoration: none; |
||||
-webkit-transition: all 0.2s linear; |
||||
-moz-transition: all 0.2s linear; |
||||
-ms-transition: all 0.2s linear; |
||||
-o-transition: all 0.2s linear; |
||||
transition: all 0.2s linear; |
||||
} |
||||
|
||||
a:hover, a:active { |
||||
color: #000; |
||||
text-decoration: none; |
||||
} |
||||
|
||||
h1, h2, h3, h4, h5, h6 { |
||||
color: #000; |
||||
line-height: 1.2em; |
||||
margin-bottom: 0.6em; |
||||
} |
||||
|
||||
h1 { |
||||
font-size: 2em; |
||||
} |
||||
|
||||
h2 { |
||||
font-size: 1.7em; |
||||
} |
||||
|
||||
h3 { |
||||
font-size: 1.5em; |
||||
margin-top: 2em; |
||||
} |
||||
|
||||
p, table, ol, ul, pre, blockquote, dl { |
||||
margin-bottom: 1em; |
||||
} |
||||
|
||||
ol, ul { |
||||
padding-left: 30px; |
||||
} |
||||
|
||||
b, strong { |
||||
font-weight: bold; |
||||
} |
||||
|
||||
i, em { |
||||
font-style: italic; |
||||
} |
||||
|
||||
u { |
||||
text-decoration: underline; |
||||
} |
||||
|
||||
abbr, acronym { |
||||
cursor: help; |
||||
border-bottom: 0.1em dotted; |
||||
} |
||||
|
||||
td, td img { |
||||
vertical-align: top; |
||||
} |
||||
|
||||
td, th { |
||||
border: solid 1px #999; |
||||
padding: 0.25em 0.5em; |
||||
} |
||||
|
||||
th { |
||||
font-weight: bold; |
||||
text-align: center; |
||||
background: #eee; |
||||
} |
||||
|
||||
sub { |
||||
vertical-align: sub; |
||||
font-size: smaller; |
||||
} |
||||
|
||||
sup { |
||||
vertical-align: super; |
||||
font-size: smaller; |
||||
} |
||||
|
||||
code { |
||||
font-family: Courier, "Courier New", Monaco, Tahoma; |
||||
background: #eee; |
||||
color: #333; |
||||
padding: 0px 2px; |
||||
} |
||||
|
||||
pre { |
||||
background: #eee; |
||||
padding: 20px; |
||||
overflow: auto; |
||||
} |
||||
|
||||
blockquote { |
||||
font-style: italic; |
||||
margin-left: 15px; |
||||
padding-left: 10px; |
||||
border-left: 5px solid #dddddd; |
||||
} |
||||
|
||||
dd { |
||||
margin-left: 2em; |
||||
} |
||||
|
||||
/* Structure Styles |
||||
/*---------------------------------------------*/ |
||||
.inner { |
||||
width: 100%; |
||||
max-width: 850px; |
||||
margin: 0 auto; |
||||
} |
||||
|
||||
#header { |
||||
background: #2EAE9B; |
||||
padding: 60px 0; |
||||
margin-bottom: 80px; |
||||
color: #afe1da; |
||||
} |
||||
#header a { |
||||
color: #afe1da; |
||||
} |
||||
#header h1 a, |
||||
#header a:hover, |
||||
#header .active a { |
||||
color: #fff; |
||||
} |
||||
#header h1 { |
||||
font-weight: bold; |
||||
margin: 0; |
||||
float: left; |
||||
} |
||||
#header nav { |
||||
float: right; |
||||
list-style: none; |
||||
margin: 0; |
||||
padding: 0; |
||||
} |
||||
#header nav a { |
||||
font-weight: bold; |
||||
margin-left: 20px; |
||||
} |
||||
#header ul { |
||||
list-style: none; |
||||
} |
||||
#header li { |
||||
display: inline-block; |
||||
float: left; |
||||
} |
||||
#content { flex: 1 1 auto; } |
||||
#footer { |
||||
background: #707070; |
||||
padding: 60px 0; |
||||
margin-top: 80px; |
||||
color: #C0C0C0; |
||||
} |
||||
#footer .social { |
||||
float: right; |
||||
margin: 0 0 0.5em 1em; |
||||
font-size: 200%; |
||||
} |
||||
#footer a { color: #ddd; } |
||||
#footer a:hover { color: #fff; } |
||||
|
||||
/* Misc Styles |
||||
/*---------------------------------------------*/ |
||||
.clearfix:before, |
||||
.clearfix:after { |
||||
content: " "; |
||||
display: table; |
||||
} |
||||
.clearfix:after { |
||||
clear: both; |
||||
} |
||||
.clearfix { |
||||
*zoom: 1; |
||||
} |
||||
|
||||
/* Media Queries |
||||
/*---------------------------------------------*/ |
||||
|
||||
/* Small Devices, Tablets */ |
||||
@media only screen and (max-width : 768px) { |
||||
.inner { |
||||
width: 85%; |
||||
} |
||||
.inner img { |
||||
width:100%; |
||||
} |
||||
#header { |
||||
margin-bottom: 40px; |
||||
padding: 30px 0; |
||||
} |
||||
#header h1 { |
||||
float: none; |
||||
} |
||||
#header nav { |
||||
float: none; |
||||
width: 100%; |
||||
} |
||||
#header nav ul { |
||||
padding: 0; |
||||
} |
||||
#header nav li { |
||||
display: block; |
||||
float: left; |
||||
width: 50%; |
||||
text-align: center; |
||||
} |
||||
#header nav li a { |
||||
display: block; |
||||
margin: 0; |
||||
padding: 10px 0; |
||||
} |
||||
#footer { |
||||
margin-top: 40px; |
||||
padding: 30px 0; |
||||
} |
||||
} |
Loading…
Reference in new issue