2727# 22. Delete temporary local SVN checkout.
2828
2929echo
30- echo " WordPress Plugin SVN Deploy v4.0 .0"
30+ echo " WordPress Plugin SVN Deploy v4.1 .0"
3131echo
3232echo " Let's collect some information first. There are six questions."
3333echo
@@ -51,15 +51,15 @@ default_assetsdir=".wordpress-org"
5151
5252echo " Q2. Your local plugin root directory (the Git repo)."
5353printf " ($default_plugindir ): "
54- read -e input
55- input=" ${input%/ } " # Strip trailing slash
54+ read -e input
55+ input=" ${input%/ } " # Strip trailing slash
5656PLUGINDIR=" ${input:- $default_plugindir } " # Populate with default if empty
5757echo
5858
5959# Check directory exists.
6060if [ ! -d " $PLUGINDIR " ]; then
61- echo " Directory $PLUGINDIR not found. Aborting."
62- exit 1;
61+ echo " Directory $PLUGINDIR not found. Aborting."
62+ exit 1
6363fi
6464
6565echo " Q3. Your local repository directory for SVN assets."
8282
8383# Check main plugin file exists.
8484if [ ! -f " $PLUGINDIR /$MAINFILE " ]; then
85- echo " Plugin file $PLUGINDIR /$MAINFILE not found. Aborting."
86- exit 1;
85+ echo " Plugin file $PLUGINDIR /$MAINFILE not found. Aborting."
86+ exit 1
8787fi
8888
8989echo " Checking version in main plugin file matches version in readme.txt file..."
@@ -99,7 +99,7 @@ if [ "$READMEVERSION" = "trunk" ]; then
9999 echo " Version in readme.txt & $MAINFILE don't match, but Stable tag is trunk. Let's continue..."
100100elif [ " $PLUGINVERSION " != " $READMEVERSION " ]; then
101101 echo " Version in readme.txt & $MAINFILE don't match. Exiting...."
102- exit 1;
102+ exit 1
103103elif [ " $PLUGINVERSION " = " $READMEVERSION " ]; then
104104 echo " Versions match in readme.txt and $MAINFILE . Let's continue..."
105105fi
@@ -109,14 +109,14 @@ echo
109109echo " Q5. Path to a local directory where a temporary SVN checkout can be made."
110110printf " Don't add trunk ($default_svnpath ): "
111111read -e input
112- input=" ${input%/ } " # Strip trailing slash
112+ input=" ${input%/ } " # Strip trailing slash
113113SVNPATH=" ${input:- $default_svnpath } " # Populate with default if empty
114114echo
115115
116116echo " Q6. Remote SVN repo on WordPress.org."
117117printf " ($default_svnurl ): "
118118read -e input
119- input=" ${input%/ } " # Strip trailing slash
119+ input=" ${input%/ } " # Strip trailing slash
120120SVNURL=" ${input:- $default_svnurl } " # Populate with default if empty
121121echo
122122
@@ -141,7 +141,10 @@ PROCEED="${input:-y}"
141141echo
142142
143143# Allow user cancellation
144- if [ $( echo " $PROCEED " | tr [:upper:] [:lower:]) != " y" ]; then echo " Aborting..." ; exit 1; fi
144+ if [ $( echo " $PROCEED " | tr [:upper:] [:lower:]) != " y" ]; then
145+ echo " Aborting..."
146+ exit 1
147+ fi
145148
146149# Let's begin...
147150echo " .........................................."
@@ -158,12 +161,11 @@ cd $PLUGINDIR
158161
159162# Check for git tag (may need to allow for leading "v"?)
160163# if git show-ref --tags --quiet --verify -- "refs/tags/$PLUGINVERSION"
161- if git show-ref --tags --quiet --verify -- " refs/tags/$PLUGINVERSION "
162- then
163- echo " Git tag $PLUGINVERSION does exist. Let's continue..."
164- else
165- echo " $PLUGINVERSION does not exist as a git tag. Aborting." ;
166- exit 1;
164+ if git show-ref --tags --quiet --verify -- " refs/tags/$PLUGINVERSION " ; then
165+ echo " Git tag $PLUGINVERSION does exist. Let's continue..."
166+ else
167+ echo " $PLUGINVERSION does not exist as a git tag. Aborting."
168+ exit 1
167169fi
168170
169171echo
@@ -177,7 +179,7 @@ echo "Ignoring GitHub specific files"
177179# Use local .svnignore if present
178180if [ -f " .svnignore" ]; then
179181 echo " Using local .svnignore"
180- SVNIGNORE=$( < .svnignore )
182+ SVNIGNORE=$( < .svnignore)
181183else
182184 echo " Using default .svnignore"
183185 SVNIGNORE=" README.md
@@ -195,22 +197,20 @@ echo "Exporting the HEAD of master from git to the trunk of SVN"
195197git checkout-index -a -f --prefix=$SVNPATH /trunk/
196198
197199# If submodule exist, recursively check out their indexes
198- if [ -f " .gitmodules" ]
199- then
200- echo " Exporting the HEAD of each submodule from git to the trunk of SVN"
201- git submodule init
202- git submodule update
203- git config -f .gitmodules --get-regexp ' ^submodule\..*\.path$' |
204- while read path_key path
205- do
206- # url_key=$(echo $path_key | sed 's/\.path/.url/')
207- # url=$(git config -f .gitmodules --get "$url_key")
208- # git submodule add $url $path
209- echo " This is the submodule path: $path "
210- echo " The following line is the command to checkout the submodule."
211- echo " git submodule foreach --recursive 'git checkout-index -a -f --prefix=$SVNPATH /trunk/$path /'"
212- git submodule foreach --recursive ' git checkout-index -a -f --prefix=$SVNPATH/trunk/$path/'
213- done
200+ if [ -f " .gitmodules" ]; then
201+ echo " Exporting the HEAD of each submodule from git to the trunk of SVN"
202+ git submodule init
203+ git submodule update
204+ git config -f .gitmodules --get-regexp ' ^submodule\..*\.path$' |
205+ while read path_key path; do
206+ # url_key=$(echo $path_key | sed 's/\.path/.url/')
207+ # url=$(git config -f .gitmodules --get "$url_key")
208+ # git submodule add $url $path
209+ echo " This is the submodule path: $path "
210+ echo " The following line is the command to checkout the submodule."
211+ echo " git submodule foreach --recursive 'git checkout-index -a -f --prefix=$SVNPATH /trunk/$path /'"
212+ git submodule foreach --recursive ' git checkout-index -a -f --prefix=$SVNPATH/trunk/$path/'
213+ done
214214fi
215215
216216echo
@@ -257,8 +257,7 @@ if [ -n "$(ls -A tags/$PLUGINVERSION 2>/dev/null)" ]; then
257257 svn copy trunk/readme.txt tags/$PLUGINVERSION
258258fi
259259svn copy --quiet trunk/ tags/$PLUGINVERSION /
260- # Remove assets and trunk directories from tag directory
261- svn delete --force --quiet $SVNPATH /tags/$PLUGINVERSION /assets
260+ # Remove trunk directories from tag directory
262261svn delete --force --quiet $SVNPATH /tags/$PLUGINVERSION /trunk
263262svn update --quiet --accept working $SVNPATH /tags/$PLUGINVERSION
264263# svn resolve --accept working $SVNPATH/tags/$PLUGINVERSION/*
0 commit comments