rtCamp / wp-plugin-bootstrap

A skeleton wordpress plugin to bootstrap & standardize your development
http://rtcamp.com/
9 stars 7 forks source link

Update svn clone location #19

Closed thrijith closed 5 years ago

thrijith commented 5 years ago

clone svn to a custom location if provided. Only delete /tmp directory.

No change in existing behaviour. If a custom path is not provided.

This will be part of the plugin repo that wants a custom location.

export SVNCLONEPATH="$HOME/wp-svn"
export PLUGINSLUG="hello-dolly"

Script used for testing.

if [ ! -z "$SVNCLONEPATH" ]; then
  mkdir -p "$SVNCLONEPATH"
fi

# svn config
if [ -d "$SVNCLONEPATH" ]; then
  SVNPATH=$SVNCLONEPATH/$PLUGINSLUG;
else
  SVNPATH="/tmp/$PLUGINSLUG"
fi

SVNURL="https://plugins.svn.wordpress.org/$PLUGINSLUG/" # Remote SVN repo on wordpress.org, with no trailing slash

svn co $SVNURL $SVNPATH

if [ -z "$SVNCLONEPATH" ]; then
  echo "Removing temporary directory $SVNPATH"
  rm -fr $SVNPATH/
fi

We won't remove cloned files if a custom location is provided so it will help in reducing the time it takes to clone all tags.