Skip to content
This repository was archived by the owner on May 10, 2023. It is now read-only.

Commit 214e53b

Browse files
authored
Merge develop into master (#45)
* linting (#44) * don't delete `assets` directory
1 parent bdf7f42 commit 214e53b

File tree

1 file changed

+35
-36
lines changed

1 file changed

+35
-36
lines changed

deploy.sh

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# 22. Delete temporary local SVN checkout.
2828

2929
echo
30-
echo "WordPress Plugin SVN Deploy v4.0.0"
30+
echo "WordPress Plugin SVN Deploy v4.1.0"
3131
echo
3232
echo "Let's collect some information first. There are six questions."
3333
echo
@@ -51,15 +51,15 @@ default_assetsdir=".wordpress-org"
5151

5252
echo "Q2. Your local plugin root directory (the Git repo)."
5353
printf "($default_plugindir): "
54-
read -e input
55-
input="${input%/}" # Strip trailing slash
54+
read -e input
55+
input="${input%/}" # Strip trailing slash
5656
PLUGINDIR="${input:-$default_plugindir}" # Populate with default if empty
5757
echo
5858

5959
# Check directory exists.
6060
if [ ! -d "$PLUGINDIR" ]; then
61-
echo "Directory $PLUGINDIR not found. Aborting."
62-
exit 1;
61+
echo "Directory $PLUGINDIR not found. Aborting."
62+
exit 1
6363
fi
6464

6565
echo "Q3. Your local repository directory for SVN assets."
@@ -82,8 +82,8 @@ echo
8282

8383
# Check main plugin file exists.
8484
if [ ! -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
8787
fi
8888

8989
echo "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..."
100100
elif [ "$PLUGINVERSION" != "$READMEVERSION" ]; then
101101
echo "Version in readme.txt & $MAINFILE don't match. Exiting...."
102-
exit 1;
102+
exit 1
103103
elif [ "$PLUGINVERSION" = "$READMEVERSION" ]; then
104104
echo "Versions match in readme.txt and $MAINFILE. Let's continue..."
105105
fi
@@ -109,14 +109,14 @@ echo
109109
echo "Q5. Path to a local directory where a temporary SVN checkout can be made."
110110
printf "Don't add trunk ($default_svnpath): "
111111
read -e input
112-
input="${input%/}" # Strip trailing slash
112+
input="${input%/}" # Strip trailing slash
113113
SVNPATH="${input:-$default_svnpath}" # Populate with default if empty
114114
echo
115115

116116
echo "Q6. Remote SVN repo on WordPress.org."
117117
printf "($default_svnurl): "
118118
read -e input
119-
input="${input%/}" # Strip trailing slash
119+
input="${input%/}" # Strip trailing slash
120120
SVNURL="${input:-$default_svnurl}" # Populate with default if empty
121121
echo
122122

@@ -141,7 +141,10 @@ PROCEED="${input:-y}"
141141
echo
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...
147150
echo ".........................................."
@@ -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
167169
fi
168170

169171
echo
@@ -177,7 +179,7 @@ echo "Ignoring GitHub specific files"
177179
# Use local .svnignore if present
178180
if [ -f ".svnignore" ]; then
179181
echo "Using local .svnignore"
180-
SVNIGNORE=$( <.svnignore )
182+
SVNIGNORE=$(<.svnignore)
181183
else
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"
195197
git 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
214214
fi
215215

216216
echo
@@ -257,8 +257,7 @@ if [ -n "$(ls -A tags/$PLUGINVERSION 2>/dev/null)" ]; then
257257
svn copy trunk/readme.txt tags/$PLUGINVERSION
258258
fi
259259
svn 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
262261
svn delete --force --quiet $SVNPATH/tags/$PLUGINVERSION/trunk
263262
svn update --quiet --accept working $SVNPATH/tags/$PLUGINVERSION
264263
#svn resolve --accept working $SVNPATH/tags/$PLUGINVERSION/*

0 commit comments

Comments
 (0)