Skip to content
Permalink
Browse files

Added project files and wp-cli command

  • Loading branch information...
Kelin Chauhan
Kelin Chauhan committed Sep 3, 2018
1 parent f29005c commit 0a8eabded3a62c743891f813ff1bb6d24dacef4d
Showing with 435 additions and 2 deletions.
  1. +42 −0 .travis.yml
  2. +28 −0 composer.json
  3. +200 −0 composer.lock
  4. +95 −0 deploy.sh
  5. +10 −2 nginx-helper.php
  6. +22 −0 wercker.yml
  7. +38 −0 wp-cli.php
@@ -0,0 +1,42 @@
sudo: required

language: node_js
node_js:
- "0.10"


before_install:
- rm -rf ~/.gnupg


before_script:
- export PLUGIN_DIR=$(pwd)
- ls -l
- sudo rm -rf /etc/mysql/
- sudo apt-get -qq purge mysql* graphviz*
- sudo apt-get -qq autoremove
- sudo apt-get update
- sudo bash -c 'echo -e "[user]\n\tname = abc\n\temail = root@localhost.com" > /home/travis/.gitconfig'
- sudo wget -qO ee rt.cx/ee && sudo bash ee
- source /etc/bash_completion.d/ee_auto.rc
- sudo ee -v
- sudo lsb_release -a
- sudo ee site create wp.localtest.me --wpfc --user=ADMINUSER --email=prabuddha.chakraborty@rtcamp.com --pass=ADMINPASS
- sudo chmod 777 -R /var/www
- sudo nginx -t
- sudo service nginx reload
- cd /var/www/wp.localtest.me/htdocs/wp-content/plugins/ && ls
- wp --allow-root plugin deactivate w3-total-cache
- wp --allow-root plugin delete nginx-helper
- mkdir nginx-helper
- cd $PLUGIN_DIR
- cp -Rf * /var/www/wp.localtest.me/htdocs/wp-content/plugins/nginx-helper/
- cd /var/www/wp.localtest.me/htdocs/
- wp plugin activate --all
- cd $PLUGIN_DIR
- cd tests/functional/
- npm install -g nightwatch
- npm install

script:
- nightwatch
@@ -0,0 +1,28 @@
{
"name": "rtcamp/nginx-helper",
"description": "Cleans nginx's fastcgi/proxy cache or redis-cache whenever a post is edited/published. Also does a few more things.",
"keywords": ["wordpress", "plugin", "nginx", "nginx-helper", "fastcgi", "redis-cache", "redis", "cache"],
"homepage": "https://rtcamp.com/nginx-helper/",
"license": "GPL-2.0+",
"authors": [{
"name": "rtCamp",
"email": "support@rtcamp.com",
"homepage": "https://rtcamp.com"
}],
"minimum-stability": "dev",
"prefer-stable": true,
"type": "wordpress-plugin",
"support": {
"issues": "https://github.com/rtCamp/nginx-helper/issues",
"forum": "https://wordpress.org/support/plugin/nginx-helper",
"wiki": "https://github.com/rtCamp/nginx-helper/wiki",
"source": "https://github.com/rtCamp/nginx-helper/"
},
"require": {
"php": ">=5.3.2",
"composer/installers": "^1.0"
},
"require-dev": {
"wpreadme2markdown/wpreadme2markdown": "*"
}
}

Some generated files are not rendered by default. Learn more.

@@ -0,0 +1,95 @@
#! /bin/bash
# A modification of Dean Clatworthy's deploy script as found here: https://github.com/deanc/wordpress-plugin-git-svn
# The difference is that this script lives in the plugin's git repo & doesn't require an existing SVN repo.

# main config
PLUGINSLUG="nginx-helper"
MAINFILE="nginx-helper.php" # this should be the name of your main php file in the wordpress plugin
#SVNUSER="rtcamp" # your svn username


##### YOU CAN STOP EDITING HERE #####
CURRENTDIR=`pwd`

# git config
GITPATH="$CURRENTDIR/" # this file should be in the base of your git repository

# svn config
SVNPATH="/tmp/$PLUGINSLUG" # path to a temp SVN repo. No trailing slash required and don't add trunk.
SVNURL="https://plugins.svn.wordpress.org/$PLUGINSLUG/" # Remote SVN repo on wordpress.org, with no trailing slash

# Detect svn username based on url
SVNUSER=$(cat ~/.subversion/auth/svn.simple/* | grep -A4 $(echo $SVNURL | awk -F// '{print $2}' | cut -d'/' -f1) | tail -n1)
if [ -z "$SVNUSER" ]
then
SVNUSER="chandrapatel"
fi


# Let's begin...
echo ".........................................."
echo
echo "Preparing to deploy WordPress plugin"
echo
echo ".........................................."
echo

# Check version in readme.txt is the same as plugin file
NEWVERSION1=`grep "^Stable tag" $GITPATH/readme.txt | awk -F' ' '{print $3}'`
echo "readme version: $NEWVERSION1"
#NEWVERSION2=`grep "^Version" $GITPATH/$MAINFILE | awk -F' ' '{print $2}'`
NEWVERSION2=`grep -i "Version" $GITPATH/$MAINFILE | head -n1 | awk -F':' '{print $2}' | awk -F' ' '{print $1}'`
echo "$MAINFILE version: $NEWVERSION2"

if [ "$NEWVERSION1" != "$NEWVERSION2" ]; then echo "Versions don't match. Exiting...."; exit 1; fi

echo "Versions match in readme.txt and PHP file. Let's proceed..."

cd $GITPATH
bash readme.sh $SVNURL
git add README.md
echo -e "Enter a commit message for this new version: \c"
read COMMITMSG
git commit -am "$COMMITMSG"

echo "Tagging new version in git"
git tag -a "$NEWVERSION1" -m "Tagging version $NEWVERSION1"

echo "Pushing latest commit to origin, with tags"
git push origin master
git push origin master --tags

echo
echo "Creating local copy of SVN repo ..."
svn co $SVNURL $SVNPATH

echo "Exporting the HEAD of master from git to the trunk of SVN"
git checkout-index -a -f --prefix=$SVNPATH/trunk/

echo "Ignoring github specific files and deployment script"
svn propset svn:ignore "deploy.sh
readme.sh
README.md
.git
.gitattributes
.gitignore
tests
map.conf
nginx.log" "$SVNPATH/trunk/"

echo "Changing directory to SVN and committing to trunk"
cd $SVNPATH/trunk/
# Add all new files that are not set to be ignored
svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add
svn commit --username=$SVNUSER -m "$COMMITMSG"

echo "Creating new SVN tag & committing it"
cd $SVNPATH
svn copy trunk/ tags/$NEWVERSION1/
cd $SVNPATH/tags/$NEWVERSION1
svn commit --username=$SVNUSER -m "Tagging version $NEWVERSION1"

echo "Removing temporary directory $SVNPATH"
rm -fr $SVNPATH/

echo "*** FIN ***"
@@ -81,10 +81,18 @@ function deactivate_nginx_helper() {
* @since 2.0.0
*/
function run_nginx_helper() {
global $nginx_helper;
global $nginx_helper;
$nginx_helper = new Nginx_Helper();
$nginx_helper->run();
// Load WP-CLI command.
if ( defined( 'WP_CLI' ) && WP_CLI ) {
require_once plugin_dir_path( __FILE__ ) . 'wp-cli.php';
\WP_CLI::add_command( 'nginx-helper', 'Nginx_Helper_WP_CLI_Command' );
}
}
run_nginx_helper();

0 comments on commit 0a8eabd

Please sign in to comment.
You can’t perform that action at this time.