forked from jigoshop/jigoshop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update_images.sh
executable file
·50 lines (38 loc) · 1.2 KB
/
update_images.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# main config
PLUGINSLUG="jigoshop"
TMPDIR="/tmp/$PLUGINSLUG"
# svn config
SVNURL="http://plugins.svn.wordpress.org/$PLUGINSLUG" # Remote SVN repo on wordpress.org, with no trailing slash
# Let's begin...
echo " Preparing to update assets in $PLUGINSLUG"
if [ -z "$SVNUSER" ] ; then
echo -n "[SVN] Enter username:"
read SVNUSER
fi
if [ -z "$SVNPASS" ] ; then
echo -n "[SVN] Enter password:"
read SVNPASS
fi
if [ -z "$SVNPASS" ] || [ -z "$SVNUSER" ]; then
echo "Please provide SVN username and password!"
exit 1
fi
echo "Creating local copy of SVN repo ..."
svn co "$SVNURL/assets" $TMPDIR
read -p "Please navigate to $TMPDIR and update images. After you finished press [Enter]."
cd $SVNPATH
echo "Committing assets"
svn status | grep -v "^.[ \t]*\..*" | grep "^?" | awk '{print $2}' | xargs svn add
svn status | grep -v "^.[ \t]*\..*" | grep "^!" | awk '{print $2}' | xargs svn rm
echo "Committing a new version"
svn commit --username=$SVNUSER --password=$SVNPASS -m "Update assets"
echo "Cleaning up"
rm -fr "$TMPDIR/"
echo
echo ".........................................."
echo
echo " Successfully updated assets for $PLUGINSLUG"
echo
echo ".........................................."
echo