-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #139 from Codeinwp/development
Improved UI of the builder. Added compatibility with the new options in the pro version. Added new travis stack. Added optin for tracking.
- Loading branch information
Showing
35 changed files
with
2,586 additions
and
1,120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
.idea | ||
node_modules | ||
logs | ||
|
||
dist | ||
artifact | ||
vendor | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#!/bin/bash | ||
|
||
# We run this just one time, for a first job from the buid and just at once after_deploy hook. | ||
if ! [ $AFTER_DEPLOY_RUN ] && [ "$TRAVIS_PHP_VERSION" == "7.0" ]; then | ||
|
||
# Flag the run in order to not be trigged again on the next after_deploy. | ||
export AFTER_DEPLOY_RUN=1; | ||
echo " Started deploy script. "; | ||
|
||
# Setup git username and email. | ||
|
||
git config user.name "selul" | ||
git config user.email ${GITHUB_EMAIL} | ||
|
||
# Send changelog changes to git. | ||
git checkout $MASTER_BRANCH | ||
git add -v . | ||
|
||
# We use [skip ci] in message to prevent this commit to trigger the build. | ||
git commit -a -m "[AUTO][skip ci] Updating changelog for v"$THEMEISLE_VERSION | ||
git push --quiet "https://${GITHUB_TOKEN}@github.com/$UPSTREAM_REPO.git" HEAD:$MASTER_BRANCH | ||
|
||
# Tag the new release. | ||
git tag -a "v$THEMEISLE_VERSION" -m "[AUTO] Release of $THEMEISLE_VERSION "; | ||
git push --quiet "https://${GITHUB_TOKEN}@github.com/$UPSTREAM_REPO.git" --tags ; | ||
sleep 5; | ||
|
||
# Sends the api call for creating the release. | ||
# We use this as the travis release provider does not offer any way | ||
# to set the body of the release. | ||
API_JSON='{"tag_name": "v'$THEMEISLE_VERSION'","target_commitish": "'$MASTER_BRANCH'","name": "v'$THEMEISLE_VERSION'","body": "'$CHANGES'","draft": false,"prerelease": false}'; | ||
curl -s --data "$API_JSON" "https://api.github.com/repos/$UPSTREAM_REPO/releases?access_token="$GITHUB_TOKEN > /dev/null; | ||
|
||
# Send update to the store | ||
STORE_JSON='{"version": "'$THEMEISLE_VERSION'","id": "'$THEMEISLE_ID'","body": "'$CHANGES'"}'; | ||
curl -s -H "Content-Type: application/json" -H "x-themeisle-auth: $THEMEISLE_AUTH" --data "$STORE_JSON" "$STORE_URL/wp-json/ti-endpoint/v1/update_changelog_new/" > /dev/null | ||
|
||
# Send data to demo server. | ||
grunt sftp | ||
|
||
# Upload to Wordpress SVN | ||
if [ ! -z "$WP_ORG_PASSWORD" ]; then | ||
|
||
svn co -q "http://svn.wp-plugins.org/$THEMEISLE_REPO" svn | ||
|
||
# Copy new content to svn trunk. | ||
rsync -r -p dist/* svn/trunk | ||
|
||
# Create new SVN tag. | ||
mkdir -p svn/tags/$THEMEISLE_VERSION | ||
rsync -r -p dist/* svn/tags/$THEMEISLE_VERSION | ||
|
||
# Add new files to SVN | ||
svn stat svn | grep '^?' | awk '{print $2}' | xargs -I x svn add x@ | ||
# Remove deleted files from SVN | ||
svn stat svn | grep '^!' | awk '{print $2}' | xargs -I x svn rm --force x@ | ||
|
||
svn stat svn | ||
|
||
# Commit to SVN | ||
svn ci --no-auth-cache --username $WPORG_USER --password $WPORG_PASS svn -m "Release v$THEMEISLE_VERSION" | ||
|
||
fi | ||
|
||
fi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# We run this on PR or on push to MASTER_BRANCH. | ||
if [ "$TRAVIS_PULL_REQUEST" != "false" ] || ( [ "$TRAVIS_EVENT_TYPE" == "push" ] && [ "$TRAVIS_REPO_SLUG" == "$UPSTREAM_REPO" ] && [ "$TRAVIS_BRANCH" == "$MASTER_BRANCH" ] ) ; then | ||
|
||
. $HOME/.nvm/nvm.sh | ||
nvm install stable | ||
nvm use stable | ||
|
||
npm install | ||
npm install grunt-cli -g | ||
|
||
phpenv local 5.6 | ||
|
||
composer selfupdate 1.0.0 --no-interaction | ||
composer install --no-interaction | ||
phpenv local --unset | ||
|
||
fi; | ||
# We dont install PHPCS if is not a PR. | ||
if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then | ||
|
||
# Install PHPCS. | ||
pear install pear/PHP_CodeSniffer | ||
|
||
# Install WPCS standards. | ||
git clone -b master --depth 1 https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git $HOME/wordpress-coding-standards | ||
phpenv rehash | ||
phpcs --config-set installed_paths $HOME/wordpress-coding-standards | ||
phpenv rehash | ||
|
||
# Install wordpress for testing. | ||
bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION | ||
export PATH="$HOME/.composer/vendor/bin:$PATH" | ||
|
||
# Use phpunit 5.7 as WP dont support 6. | ||
if [[ ${TRAVIS_PHP_VERSION:0:2} == "7." ]]; then | ||
composer global require "phpunit/phpunit=5.7.*" ; | ||
fi; | ||
fi; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
#!/usr/bin/env bash | ||
|
||
|
||
if [ $# -lt 3 ]; then | ||
echo "usage: $0 <db-name> <db-user> <db-pass> [db-host] [wp-version] [force download]" | ||
exit 1 | ||
fi | ||
|
||
DB_NAME=$1 | ||
DB_USER=$2 | ||
DB_PASS=$3 | ||
DB_HOST=${4-localhost} | ||
WP_VERSION=${5-latest} | ||
FORCE=${6-false} | ||
|
||
WP_TESTS_DIR=${WP_TESTS_DIR-/tmp/wordpress-tests-lib} | ||
WP_CORE_DIR=${WP_CORE_DIR-/tmp/wordpress/} | ||
|
||
download() { | ||
if [ `which curl` ]; then | ||
curl -s "$1" > "$2"; | ||
elif [ `which wget` ]; then | ||
wget -nv -O "$2" "$1" | ||
fi | ||
} | ||
|
||
if [[ $WP_VERSION =~ [0-9]+\.[0-9]+(\.[0-9]+)? ]]; then | ||
WP_TESTS_TAG="tags/$WP_VERSION" | ||
else | ||
# http serves a single offer, whereas https serves multiple. we only want one | ||
download http://api.wordpress.org/core/version-check/1.7/ /tmp/wp-latest.json | ||
grep '[0-9]+\.[0-9]+(\.[0-9]+)?' /tmp/wp-latest.json | ||
LATEST_VERSION=$(grep -o '"version":"[^"]*' /tmp/wp-latest.json | sed 's/"version":"//') | ||
if [[ -z "$LATEST_VERSION" ]]; then | ||
echo "Latest WordPress version could not be found" | ||
exit 1 | ||
fi | ||
WP_TESTS_TAG="tags/$LATEST_VERSION" | ||
fi | ||
|
||
if [[ $WP_TESTS_TAG == *"beta"* ]] | ||
then | ||
WP_TESTS_TAG="trunk" | ||
fi | ||
|
||
set -ex | ||
|
||
install_wp() { | ||
if [ $FORCE == 'true' ]; then | ||
rm -Rf $WP_CORE_DIR | ||
fi | ||
|
||
if [ -d $WP_CORE_DIR ]; then | ||
return; | ||
fi | ||
|
||
mkdir -p $WP_CORE_DIR | ||
|
||
if [ $WP_VERSION == 'latest' ]; then | ||
local ARCHIVE_NAME='latest' | ||
else | ||
local ARCHIVE_NAME="wordpress-$WP_VERSION" | ||
fi | ||
|
||
download https://wordpress.org/${ARCHIVE_NAME}.tar.gz /tmp/wordpress.tar.gz | ||
tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C $WP_CORE_DIR | ||
|
||
download https://raw.github.com/markoheijnen/wp-mysqli/master/db.php $WP_CORE_DIR/wp-content/db.php | ||
} | ||
|
||
install_test_suite() { | ||
if [ $FORCE == 'true' ]; then | ||
rm -Rf $WP_TESTS_DIR | ||
fi | ||
|
||
# portable in-place argument for both GNU sed and Mac OSX sed | ||
if [[ $(uname -s) == 'Darwin' ]]; then | ||
local ioption='-i .bak' | ||
else | ||
local ioption='-i' | ||
fi | ||
|
||
# set up testing suite if it doesn't yet exist | ||
if [ ! -d $WP_TESTS_DIR ]; then | ||
# set up testing suite | ||
mkdir -p $WP_TESTS_DIR | ||
svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/includes/ $WP_TESTS_DIR/includes | ||
svn co --quiet https://develop.svn.wordpress.org/${WP_TESTS_TAG}/tests/phpunit/data/ $WP_TESTS_DIR/data | ||
fi | ||
|
||
cd $WP_TESTS_DIR | ||
|
||
if [ ! -f wp-tests-config.php ]; then | ||
download https://develop.svn.wordpress.org/${WP_TESTS_TAG}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php | ||
sed $ioption "s:dirname( __FILE__ ) . '/src/':'$WP_CORE_DIR':" "$WP_TESTS_DIR"/wp-tests-config.php | ||
sed $ioption "s/youremptytestdbnamehere/$DB_NAME/" "$WP_TESTS_DIR"/wp-tests-config.php | ||
sed $ioption "s/yourusernamehere/$DB_USER/" "$WP_TESTS_DIR"/wp-tests-config.php | ||
sed $ioption "s/yourpasswordhere/$DB_PASS/" "$WP_TESTS_DIR"/wp-tests-config.php | ||
sed $ioption "s|localhost|${DB_HOST}|" "$WP_TESTS_DIR"/wp-tests-config.php | ||
fi | ||
|
||
} | ||
|
||
install_db() { | ||
# parse DB_HOST for port or socket references | ||
local PARTS=(${DB_HOST//\:/ }) | ||
local DB_HOSTNAME=${PARTS[0]}; | ||
local DB_SOCK_OR_PORT=${PARTS[1]}; | ||
local EXTRA="" | ||
|
||
if ! [ -z $DB_HOSTNAME ] ; then | ||
if [ $(echo $DB_SOCK_OR_PORT | grep -e '^[0-9]\{1,\}$') ]; then | ||
EXTRA=" --host=$DB_HOSTNAME --port=$DB_SOCK_OR_PORT --protocol=tcp" | ||
elif ! [ -z $DB_SOCK_OR_PORT ] ; then | ||
EXTRA=" --socket=$DB_SOCK_OR_PORT" | ||
elif ! [ -z $DB_HOSTNAME ] ; then | ||
EXTRA=" --host=$DB_HOSTNAME --protocol=tcp" | ||
fi | ||
fi | ||
|
||
# create database | ||
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"$EXTRA | ||
} | ||
|
||
install_wp | ||
install_test_suite | ||
install_db |
Oops, something went wrong.