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

Commit 8113015

Browse files
authored
add reading of local .svnignore file over defaults (#37)
add reading of local .svnignore file over defaults
2 parents 861464e + 0755799 commit 8113015

File tree

2 files changed

+29
-9
lines changed

2 files changed

+29
-9
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# WordPress Plugin Directory Deployment Script
22

33
Deploys a WordPress plugin from a local Git repo to the WordPress Plugin Repostiory (SVN).
4-
4+
55
## Steps
66

77
These are the steps that the script takes:
8-
8+
99
1. Asks for plugin slug.
1010
2. Asks for local plugin directory.
1111
3. Checks local plugin directory exists.
@@ -33,9 +33,17 @@ These are the steps that the script takes:
3333
2. Ensure that the shell script is executable. In Mac / Unix, run `chmod +x deploy.sh`.
3434
3. Run the script with `sh deploy.sh`. You can also double-click it in Finder / Explorer to start it.
3535
4. You'll now be guided through a set of questions.
36-
36+
3737
I prefer to keep this script in the root of my projects directory. Each project directory is named as the plugin slug, as is the corresponding GitHub repo. To use, just call the script, enter the plugin slug, confirm or amend default suggestions, and sit back as the code is sent to SVN and git repos including tags. The commit messages here are hard-coded for consistency.
3838

39+
## Extras
40+
41+
You may define your own `.svnignore` file similar to an `svn propset svn:ignore .svnignore` command. This will remove any listed files and/or directories from committing to the Plugins Directory.
42+
43+
NB: you must list files separately, no wildcards.
44+
45+
Reference: https://stackoverflow.com/questions/17298668/svn-ignore-like-gitignore
46+
3947
## Credits
4048

4149
At one point, well over 90% of this script was written by others:
@@ -45,8 +53,8 @@ At one point, well over 90% of this script was written by others:
4553
- **[Patrick Rauland](https://twitter.com/BFTrick)** - [Support for WP assets folder for plugin page banner and screenshots](https://github.com/BFTrick/jotform-integration/blob/master/deploy.sh)
4654
- **[Ben Balter](https://twitter.com/benbalter)** - [Submodules support and plugin slug prompt](https://github.com/benbalter/Github-to-WordPress-Plugin-Directory-Deployment-Script/)
4755
- **[Gary Jones](https://twitter.com/GaryJ)** *(me)* - [Personalisation and commenting out bits not required when using git-flow](https://github.com/GaryJones/wordpress-plugin-git-flow-svn-deploy)
48-
49-
There has been a significant amount of changes since then though.
56+
57+
There has been a significant amount of changes since then though.
5058

5159

5260
## License

deploy.sh

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
# 20. Delete temporary local SVN checkout.
2626

2727
echo
28-
echo "WordPress Plugin SVN Deploy v3.0.0"
28+
echo "WordPress Plugin SVN Deploy v3.1.0"
2929
echo
3030
echo "Let's collect some information first. There are six questions."
3131
echo
@@ -157,12 +157,22 @@ svn checkout $SVNURL $SVNPATH --depth immediates
157157
svn update --quiet $SVNPATH/trunk --set-depth infinity
158158

159159
echo "Ignoring GitHub specific files"
160-
svn propset svn:ignore "README.md
160+
# Use local .svnignore if present
161+
if [ -f ".svnignore" ]; then
162+
echo "Using local .svnignore"
163+
SVNIGNORE=$( <.svnignore )
164+
else
165+
echo "Using default .svnignore"
166+
SVNIGNORE="README.md
161167
Thumbs.db
162-
.github/*
168+
.github
163169
.git
164170
.gitattributes
165-
.gitignore" "$SVNPATH/trunk/"
171+
.gitignore
172+
composer.lock"
173+
fi
174+
175+
svn propset svn:ignore \""$SVNIGNORE"\" "$SVNPATH/trunk/"
166176

167177
echo "Exporting the HEAD of master from git to the trunk of SVN"
168178
git checkout-index -a -f --prefix=$SVNPATH/trunk/
@@ -201,6 +211,8 @@ echo
201211
echo "Changing directory to SVN and committing to trunk."
202212
cd $SVNPATH/trunk/
203213
# Delete all files that should not now be added.
214+
# Use $SVNIGNORE for `rm -rf`. Setting propset svn:ignore seems flaky.
215+
echo "$SVNIGNORE" | awk '{print $0}' | xargs rm -rf
204216
svn status | grep -v "^.[ \t]*\..*" | grep "^\!" | awk '{print $2"@"}' | xargs svn del
205217
# Add all new files that are not set to be ignored
206218
svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2"@"}' | xargs svn add

0 commit comments

Comments
 (0)