public
Description: Git mirror of the CMS Made Simple 2.0 rewrite
Homepage: http://cmsmadesimple.org
Clone URL: git://github.com/tedkulp/cmsmadesimple-2-0.git
Search Repo:
cmsmadesimple-2-0 / svn-propset
100755 98 lines (82 sloc) 3.328 kb
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
#! /bin/bash
 
#CMS - CMS Made Simple
#(c)2004 by Leendert Meyer <leen.meyer@home.nl>
#This project's homepage is: http://cmsmadesimple.sf.net
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 
D="$(dirname $0)"
[ "$D" = "." ] && D="$(pwd)"
 
VERSION="${0##*/} Version 0.1"
 
USAGE="Usage: ${0##*/} -f|--force | -n|no-commit | -t|--test | -h|--help | -u|--user | -v|--version | -U|--usage [path]"
 
HELP="This script sets predefined properties for predefined mime-types in a svn repository:
 
text files -> svn:eol-style native
executables -> svn:executable
.png files -> svn:mime-type image/png
.gif files -> svn:mime-type image/gif
.jpg files -> svn:mime-type image/jpeg
.jpeg files -> svn:mime-type image/jpeg
 
What mime-types text-files and executables consist of is defined in the find-mime script.
"
 
ARGS=""
TEST=""
COMMIT="no"
while [ $# -gt 0 ]; do
case $1 in
    -f|--force)
    ARGS="$ARGS $1"
    shift
    ;;
    -t|--test)
    ARGS="$ARGS $1"
    TEST="echo"
    shift
    ;;
    -n|--commit)
    COMMIT="yes"
    shift
    ;;
    -u|--user)
    USERNAME="$2"
    shift 2
    ;;
    -U|--usage)
      echo "$USAGE"
    exit 1
    ;;
    -v|--version)
      echo "$VERSION"
    exit 1
    ;;
    -h|--help)
      echo "$VERSION"
    echo
    echo "$USAGE"
    echo
    echo "$HELP"
    exit 1
    ;;
  esac
done
 
find "${1-.}" -type f -name \*.php | xargs -i $D/svn-propset-file $ARGS svn:keywords Id {}
[ "$COMMIT" = "yes" ] && $TEST svn commit ${USERNAME+--username "$USERNAME" }-m "Added Id keyword to text files"
 
$D/find-mime --text "${1-.}" | xargs -i $D/svn-propset-file $ARGS svn:eol-style native {}
[ "$COMMIT" = "yes" ] && $TEST svn commit ${USERNAME+--username "$USERNAME" }-m "Set properties of text files to svn:eol-style native"
 
$D/find-mime --exec "${1-.}" | xargs -i $D/svn-propset-file $ARGS svn:executable '' {}
[ "$COMMIT" = "yes" ] && $TEST svn commit ${USERNAME+--username "$USERNAME" }-m "Set properties of executables to svn:executable"
 
$D/find-mime --bin "${1-.}" | grep '\.png$' | xargs -i $D/svn-propset-file $ARGS svn:mime-type 'image/png' {}
[ "$COMMIT" = "yes" ] && $TEST svn commit ${USERNAME+--username "$USERNAME" }-m "Set properties of .png files to svn:mime-type image/png"
 
$D/find-mime --bin "${1-.}" | grep '\.gif$' | xargs -i $D/svn-propset-file $ARGS svn:mime-type 'image/gif' {}
[ "$COMMIT" = "yes" ] && $TEST svn commit ${USERNAME+--username "$USERNAME" }-m "Set properties of .gif files to svn:mime-type image/gif"
 
$D/find-mime --bin "${1-.}" | grep '\.jpe?g$' | xargs -i $D/svn-propset-file $ARGS svn:mime-type 'image/jpeg' {}
[ "$COMMIT" = "yes" ] && $TEST svn commit ${USERNAME+--username "$USERNAME" }-m "Set properties of .jpeg and .jpg files to svn:mime-type image/jpeg"