Skip to content

Instantly share code, notes, and snippets.

@BFTrick
Last active December 19, 2015 01:29
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BFTrick/5876275 to your computer and use it in GitHub Desktop.
Save BFTrick/5876275 to your computer and use it in GitHub Desktop.
A shell script to download the latest WooThemes updates from GitHub
##
# pull down all woothemes repos from github
# https://gist.github.com/BFTrick/5876275
##
echo "Hi there! Grab a cup of coffee. I'll pull down the latest updates from Github"
# declare where our repository folder is located
repositoryLocation="repos"
# declare where our test site is located
testSiteLocation="test-site"
# declare our different repos
declare -a singlePlugins=("woocommerce" "wooslider" "woocommerce-pre-orders" "woocommerce-subscriptions" "woocommerce-product-feeds" "see-you-later" "groups-woocommerce" "woocommerce-product-vendors" "woocommerce-points-and-rewards" "woodojo" "woocommerce-gateway-stripe" "woocommerce-product-addons" "woocommerce-composite-products" "woocommerce-product-bundles" "woocommerce-product-csv-import-suite" "woocommerce-shipping-fedex" "woocommerce-table-rate-shipping" "woocommerce-software-add-on" "woocommerce-gateway-usa-epay" "woocommerce-xero" )
declare -a groupedPlugins=("WC-Payment-Gateways" "WC-Shipping-Methods" "woocommerce-plugins" "wooslider-extensions" "WC-Widgets")
declare -a groupedThemes=("all-themes")
# okay, let's move to the repository directory
cd $repositoryLocation
# loop through the single plugins and update them
echo "Updating individual plugin repos"
for i in "${singlePlugins[@]}"
do
cd $i
echo "Updating "$i
git checkout -q master
git fetch
git fetch --tags
# if we're pulling down woocommerce we should checkout the latest tag
if [ $i == "woocommerce" ]
then
latestTag=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "checking out "${latestTag}
git checkout -q ${latestTag}
else
git pull origin master
fi
cd ../
cp -Rf $i ../$testSiteLocation/wp-content/plugins
done
echo "Done updating individual plugin repos"
# loop through the grouped plugins and update them
echo "Updating grouped plugin repos"
for i in "${groupedPlugins[@]}"
do
cd $i
echo "Updating "$i
git pull
cd ../
cp -Rf $i/. ../$testSiteLocation/wp-content/plugins
done
echo "Done updating grouped plugin repos"
# loop through the grouped themes and update them
echo "Updating grouped theme repos"
for i in "${groupedThemes[@]}"
do
cd $i
echo "Updating "$i
git pull
cd ../
cp -Rf $i/. ../$testSiteLocation/wp-content/themes
done
echo "Done updating grouped plugin repos"
# okay, let's move back to the main directory
echo "All done. You're ready to work!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment