sitefuel 0.0.0b → 0.1.0a
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +81 -0
- data/{RELEASE_NOTES → RELEASE_NOTES.rdoc} +0 -0
- data/bin/sitefuel +64 -111
- data/lib/sitefuel/CommandLine.rb +142 -0
- data/lib/sitefuel/Configuration.rb +49 -13
- data/lib/sitefuel/License.rb +292 -0
- data/lib/sitefuel/SiteFuelLogger.rb +34 -5
- data/lib/sitefuel/SiteFuelRuntime.rb +217 -44
- data/lib/sitefuel/extensions/ArrayComparisons.rb +2 -2
- data/lib/sitefuel/extensions/ColumnPrinter.rb +276 -0
- data/lib/sitefuel/extensions/DynamicClassMethods.rb +2 -2
- data/lib/sitefuel/extensions/FileComparison.rb +2 -2
- data/lib/sitefuel/extensions/FileTree.rb +94 -0
- data/lib/sitefuel/extensions/Silently.rb +2 -2
- data/lib/sitefuel/extensions/StringFormatting.rb +52 -8
- data/lib/sitefuel/extensions/SymbolComparison.rb +4 -2
- data/lib/sitefuel/extensions/TerminalInfo.rb +53 -0
- data/lib/sitefuel/external/AbstractExternalProgram.rb +65 -11
- data/lib/sitefuel/external/ExternalProgramTestCase.rb +2 -2
- data/lib/sitefuel/external/GIT.rb +50 -3
- data/lib/sitefuel/external/JPEGTran.rb +2 -2
- data/lib/sitefuel/external/PNGCrush.rb +2 -2
- data/lib/sitefuel/external/SVN.rb +57 -0
- data/lib/sitefuel/processors/AbstractExternalProgramProcessor.rb +17 -4
- data/lib/sitefuel/processors/AbstractProcessor.rb +64 -47
- data/lib/sitefuel/processors/AbstractStringBasedProcessor.rb +20 -3
- data/lib/sitefuel/processors/CSSProcessor.rb +2 -2
- data/lib/sitefuel/processors/Configurable.rb +94 -0
- data/lib/sitefuel/processors/HAMLProcessor.rb +4 -4
- data/lib/sitefuel/processors/HTMLProcessor.rb +2 -2
- data/lib/sitefuel/processors/JavaScriptProcessor.rb +2 -2
- data/lib/sitefuel/processors/PHPProcessor.rb +2 -2
- data/lib/sitefuel/processors/PNGProcessor.rb +2 -2
- data/lib/sitefuel/processors/RHTMLProcessor.rb +2 -2
- data/lib/sitefuel/processors/SASSProcessor.rb +4 -4
- data/test/{test_images → images}/sample_jpg01.jpg +0 -0
- data/test/{test_images → images}/sample_png01.png +0 -0
- data/test/processor_listing.rb +2 -2
- data/test/{test_programs → programs}/versioning.rb +2 -2
- data/test/repositories/git/few_files/deployment.yml +0 -0
- data/test/repositories/git/few_files/index.html +10 -0
- data/test/repositories/git/few_files/style.css +2 -0
- data/test/repositories/svn/testrepo1/README.txt +5 -0
- data/test/repositories/svn/testrepo1/conf/authz +32 -0
- data/test/repositories/svn/testrepo1/conf/passwd +8 -0
- data/test/repositories/svn/testrepo1/conf/svnserve.conf +47 -0
- data/test/repositories/svn/testrepo1/db/current +1 -0
- data/test/repositories/svn/testrepo1/db/format +2 -0
- data/test/repositories/svn/testrepo1/db/fs-type +1 -0
- data/test/repositories/svn/testrepo1/db/fsfs.conf +37 -0
- data/test/repositories/svn/testrepo1/db/min-unpacked-rev +1 -0
- data/test/repositories/svn/testrepo1/db/rep-cache.db +0 -0
- data/test/repositories/svn/testrepo1/db/revprops/0/0 +5 -0
- data/test/repositories/svn/testrepo1/db/revprops/0/1 +13 -0
- data/test/repositories/svn/testrepo1/db/revs/0/0 +11 -0
- data/test/repositories/svn/testrepo1/db/revs/0/1 +0 -0
- data/test/repositories/svn/testrepo1/db/txn-current +1 -0
- data/test/repositories/svn/testrepo1/db/txn-current-lock +0 -0
- data/test/repositories/svn/testrepo1/db/uuid +1 -0
- data/test/repositories/svn/testrepo1/db/write-lock +0 -0
- data/test/repositories/svn/testrepo1/format +1 -0
- data/test/repositories/svn/testrepo1/hooks/post-commit.tmpl +50 -0
- data/test/repositories/svn/testrepo1/hooks/post-lock.tmpl +45 -0
- data/test/repositories/svn/testrepo1/hooks/post-revprop-change.tmpl +57 -0
- data/test/repositories/svn/testrepo1/hooks/post-unlock.tmpl +43 -0
- data/test/repositories/svn/testrepo1/hooks/pre-commit.tmpl +85 -0
- data/test/repositories/svn/testrepo1/hooks/pre-lock.tmpl +71 -0
- data/test/repositories/svn/testrepo1/hooks/pre-revprop-change.tmpl +66 -0
- data/test/repositories/svn/testrepo1/hooks/pre-unlock.tmpl +63 -0
- data/test/repositories/svn/testrepo1/hooks/start-commit.tmpl +68 -0
- data/test/repositories/svn/testrepo1/locks/db-logs.lock +3 -0
- data/test/repositories/svn/testrepo1/locks/db.lock +3 -0
- data/test/sites/simplehtml/deployment.yml +19 -0
- data/test/{test_sites → sites}/simplehtml/index.html +0 -0
- data/test/{test_sites → sites}/simplehtml/style.css +0 -0
- data/test/sites/sitefuelteaser/deployment.yml +13 -0
- data/test/sites/sitefuelteaser/img/hd.png +0 -0
- data/test/sites/sitefuelteaser/img/logo.png +0 -0
- data/test/sites/sitefuelteaser/img/uses-sitefuel.png +0 -0
- data/test/sites/sitefuelteaser/index.html +1 -1
- data/test/sites/sitefuelteaser/master.css +18 -0
- data/test/test_AbstractExternalProgram.rb +5 -5
- data/test/test_AbstractProcessor.rb +4 -4
- data/test/test_AbstractStringBasedProcessor.rb +2 -2
- data/test/test_AllProcessors.rb +4 -4
- data/test/test_ArrayComparisons.rb +4 -4
- data/test/test_CSSProcessor.rb +4 -4
- data/test/test_ColumnPrinter.rb +40 -0
- data/test/test_Configurable.rb +106 -0
- data/test/test_FileComparisons.rb +4 -4
- data/test/test_GIT.rb +41 -0
- data/test/{test_HAMLProcessor.rb.rb → test_HAMLProcessor.rb} +4 -4
- data/test/test_HTMLProcessor.rb +4 -4
- data/test/test_JPEGTran.rb +4 -4
- data/test/test_JavaScriptProcessor.rb +3 -2
- data/test/test_PHPProcessor.rb +4 -4
- data/test/test_PNGCrush.rb +8 -8
- data/test/test_PNGProcessor.rb +5 -5
- data/test/test_RHTMLProcessor.rb +4 -4
- data/test/test_SASSProcessor.rb +4 -4
- data/test/test_SVN.rb +44 -0
- data/test/test_SiteFuelLogging.rb +4 -4
- data/test/test_SiteFuelRuntime.rb +42 -4
- data/test/test_StringFormatting.rb +27 -4
- data/test/test_SymbolComparison.rb +4 -4
- data/test/ts_all.rb +2 -2
- metadata +94 -20
- data/README +0 -86
- data/test/test_sites/simplehtml/deployment.yml +0 -22
@@ -0,0 +1 @@
|
|
1
|
+
0
|
Binary file
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
1
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
97933cf6-d3cf-4d61-9a30-381d1969d740
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
5
|
@@ -0,0 +1,50 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# POST-COMMIT HOOK
|
4
|
+
#
|
5
|
+
# The post-commit hook is invoked after a commit. Subversion runs
|
6
|
+
# this hook by invoking a program (script, executable, binary, etc.)
|
7
|
+
# named 'post-commit' (for which this file is a template) with the
|
8
|
+
# following ordered arguments:
|
9
|
+
#
|
10
|
+
# [1] REPOS-PATH (the path to this repository)
|
11
|
+
# [2] REV (the number of the revision just committed)
|
12
|
+
#
|
13
|
+
# The default working directory for the invocation is undefined, so
|
14
|
+
# the program should set one explicitly if it cares.
|
15
|
+
#
|
16
|
+
# Because the commit has already completed and cannot be undone,
|
17
|
+
# the exit code of the hook program is ignored. The hook program
|
18
|
+
# can use the 'svnlook' utility to help it examine the
|
19
|
+
# newly-committed tree.
|
20
|
+
#
|
21
|
+
# On a Unix system, the normal procedure is to have 'post-commit'
|
22
|
+
# invoke other programs to do the real work, though it may do the
|
23
|
+
# work itself too.
|
24
|
+
#
|
25
|
+
# Note that 'post-commit' must be executable by the user(s) who will
|
26
|
+
# invoke it (typically the user httpd runs as), and that user must
|
27
|
+
# have filesystem-level permission to access the repository.
|
28
|
+
#
|
29
|
+
# On a Windows system, you should name the hook program
|
30
|
+
# 'post-commit.bat' or 'post-commit.exe',
|
31
|
+
# but the basic idea is the same.
|
32
|
+
#
|
33
|
+
# The hook program typically does not inherit the environment of
|
34
|
+
# its parent process. For example, a common problem is for the
|
35
|
+
# PATH environment variable to not be set to its usual value, so
|
36
|
+
# that subprograms fail to launch unless invoked via absolute path.
|
37
|
+
# If you're having unexpected problems with a hook program, the
|
38
|
+
# culprit may be unusual (or missing) environment variables.
|
39
|
+
#
|
40
|
+
# Here is an example hook script, for a Unix /bin/sh interpreter.
|
41
|
+
# For more examples and pre-written hooks, see those in
|
42
|
+
# /usr/share/subversion/hook-scripts, and in the repository at
|
43
|
+
# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
|
44
|
+
# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
|
45
|
+
|
46
|
+
|
47
|
+
REPOS="$1"
|
48
|
+
REV="$2"
|
49
|
+
|
50
|
+
"$REPOS"/hooks/mailer.py commit "$REPOS" $REV "$REPOS"/mailer.conf
|
@@ -0,0 +1,45 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# POST-LOCK HOOK
|
4
|
+
#
|
5
|
+
# The post-lock hook is run after a path is locked. Subversion runs
|
6
|
+
# this hook by invoking a program (script, executable, binary, etc.)
|
7
|
+
# named 'post-lock' (for which this file is a template) with the
|
8
|
+
# following ordered arguments:
|
9
|
+
#
|
10
|
+
# [1] REPOS-PATH (the path to this repository)
|
11
|
+
# [2] USER (the user who created the lock)
|
12
|
+
#
|
13
|
+
# The paths that were just locked are passed to the hook via STDIN (as
|
14
|
+
# of Subversion 1.2, only one path is passed per invocation, but the
|
15
|
+
# plan is to pass all locked paths at once, so the hook program
|
16
|
+
# should be written accordingly).
|
17
|
+
#
|
18
|
+
# The default working directory for the invocation is undefined, so
|
19
|
+
# the program should set one explicitly if it cares.
|
20
|
+
#
|
21
|
+
# Because the lock has already been created and cannot be undone,
|
22
|
+
# the exit code of the hook program is ignored. The hook program
|
23
|
+
# can use the 'svnlook' utility to help it examine the
|
24
|
+
# newly-created lock.
|
25
|
+
#
|
26
|
+
# On a Unix system, the normal procedure is to have 'post-lock'
|
27
|
+
# invoke other programs to do the real work, though it may do the
|
28
|
+
# work itself too.
|
29
|
+
#
|
30
|
+
# Note that 'post-lock' must be executable by the user(s) who will
|
31
|
+
# invoke it (typically the user httpd runs as), and that user must
|
32
|
+
# have filesystem-level permission to access the repository.
|
33
|
+
#
|
34
|
+
# On a Windows system, you should name the hook program
|
35
|
+
# 'post-lock.bat' or 'post-lock.exe',
|
36
|
+
# but the basic idea is the same.
|
37
|
+
#
|
38
|
+
# Here is an example hook script, for a Unix /bin/sh interpreter:
|
39
|
+
|
40
|
+
REPOS="$1"
|
41
|
+
USER="$2"
|
42
|
+
|
43
|
+
# Send email to interested parties, let them know a lock was created:
|
44
|
+
"$REPOS"/hooks/mailer.py lock \
|
45
|
+
"$REPOS" "$USER" "$REPOS"/hooks/mailer.conf
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# POST-REVPROP-CHANGE HOOK
|
4
|
+
#
|
5
|
+
# The post-revprop-change hook is invoked after a revision property
|
6
|
+
# has been added, modified or deleted. Subversion runs this hook by
|
7
|
+
# invoking a program (script, executable, binary, etc.) named
|
8
|
+
# 'post-revprop-change' (for which this file is a template), with the
|
9
|
+
# following ordered arguments:
|
10
|
+
#
|
11
|
+
# [1] REPOS-PATH (the path to this repository)
|
12
|
+
# [2] REV (the revision that was tweaked)
|
13
|
+
# [3] USER (the username of the person tweaking the property)
|
14
|
+
# [4] PROPNAME (the property that was changed)
|
15
|
+
# [5] ACTION (the property was 'A'dded, 'M'odified, or 'D'eleted)
|
16
|
+
#
|
17
|
+
# [STDIN] PROPVAL ** the old property value is passed via STDIN.
|
18
|
+
#
|
19
|
+
# Because the propchange has already completed and cannot be undone,
|
20
|
+
# the exit code of the hook program is ignored. The hook program
|
21
|
+
# can use the 'svnlook' utility to help it examine the
|
22
|
+
# new property value.
|
23
|
+
#
|
24
|
+
# On a Unix system, the normal procedure is to have 'post-revprop-change'
|
25
|
+
# invoke other programs to do the real work, though it may do the
|
26
|
+
# work itself too.
|
27
|
+
#
|
28
|
+
# Note that 'post-revprop-change' must be executable by the user(s) who will
|
29
|
+
# invoke it (typically the user httpd runs as), and that user must
|
30
|
+
# have filesystem-level permission to access the repository.
|
31
|
+
#
|
32
|
+
# On a Windows system, you should name the hook program
|
33
|
+
# 'post-revprop-change.bat' or 'post-revprop-change.exe',
|
34
|
+
# but the basic idea is the same.
|
35
|
+
#
|
36
|
+
# The hook program typically does not inherit the environment of
|
37
|
+
# its parent process. For example, a common problem is for the
|
38
|
+
# PATH environment variable to not be set to its usual value, so
|
39
|
+
# that subprograms fail to launch unless invoked via absolute path.
|
40
|
+
# If you're having unexpected problems with a hook program, the
|
41
|
+
# culprit may be unusual (or missing) environment variables.
|
42
|
+
#
|
43
|
+
# Here is an example hook script, for a Unix /bin/sh interpreter.
|
44
|
+
# For more examples and pre-written hooks, see those in
|
45
|
+
# /usr/share/subversion/hook-scripts, and in the repository at
|
46
|
+
# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
|
47
|
+
# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
|
48
|
+
|
49
|
+
|
50
|
+
REPOS="$1"
|
51
|
+
REV="$2"
|
52
|
+
USER="$3"
|
53
|
+
PROPNAME="$4"
|
54
|
+
ACTION="$5"
|
55
|
+
|
56
|
+
"$REPOS"/hooks/mailer.py propchange2 "$REPOS" $REV \
|
57
|
+
"$USER" "$PROPNAME" "$ACTION" "$REPOS"/hooks/mailer.conf
|
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# POST-UNLOCK HOOK
|
4
|
+
#
|
5
|
+
# The post-unlock hook runs after a path is unlocked. Subversion runs
|
6
|
+
# this hook by invoking a program (script, executable, binary, etc.)
|
7
|
+
# named 'post-unlock' (for which this file is a template) with the
|
8
|
+
# following ordered arguments:
|
9
|
+
#
|
10
|
+
# [1] REPOS-PATH (the path to this repository)
|
11
|
+
# [2] USER (the user who destroyed the lock)
|
12
|
+
#
|
13
|
+
# The paths that were just unlocked are passed to the hook via STDIN
|
14
|
+
# (as of Subversion 1.2, only one path is passed per invocation, but
|
15
|
+
# the plan is to pass all unlocked paths at once, so the hook program
|
16
|
+
# should be written accordingly).
|
17
|
+
#
|
18
|
+
# The default working directory for the invocation is undefined, so
|
19
|
+
# the program should set one explicitly if it cares.
|
20
|
+
#
|
21
|
+
# Because the lock has already been destroyed and cannot be undone,
|
22
|
+
# the exit code of the hook program is ignored.
|
23
|
+
#
|
24
|
+
# On a Unix system, the normal procedure is to have 'post-unlock'
|
25
|
+
# invoke other programs to do the real work, though it may do the
|
26
|
+
# work itself too.
|
27
|
+
#
|
28
|
+
# Note that 'post-unlock' must be executable by the user(s) who will
|
29
|
+
# invoke it (typically the user httpd runs as), and that user must
|
30
|
+
# have filesystem-level permission to access the repository.
|
31
|
+
#
|
32
|
+
# On a Windows system, you should name the hook program
|
33
|
+
# 'post-unlock.bat' or 'post-unlock.exe',
|
34
|
+
# but the basic idea is the same.
|
35
|
+
#
|
36
|
+
# Here is an example hook script, for a Unix /bin/sh interpreter:
|
37
|
+
|
38
|
+
REPOS="$1"
|
39
|
+
USER="$2"
|
40
|
+
|
41
|
+
# Send email to interested parties, let them know a lock was removed:
|
42
|
+
"$REPOS"/hooks/mailer.py unlock \
|
43
|
+
"$REPOS" "$USER" "$REPOS"/hooks/mailer.conf
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# PRE-COMMIT HOOK
|
4
|
+
#
|
5
|
+
# The pre-commit hook is invoked before a Subversion txn is
|
6
|
+
# committed. Subversion runs this hook by invoking a program
|
7
|
+
# (script, executable, binary, etc.) named 'pre-commit' (for which
|
8
|
+
# this file is a template), with the following ordered arguments:
|
9
|
+
#
|
10
|
+
# [1] REPOS-PATH (the path to this repository)
|
11
|
+
# [2] TXN-NAME (the name of the txn about to be committed)
|
12
|
+
#
|
13
|
+
# [STDIN] LOCK-TOKENS ** the lock tokens are passed via STDIN.
|
14
|
+
#
|
15
|
+
# If STDIN contains the line "LOCK-TOKENS:\n" (the "\n" denotes a
|
16
|
+
# single newline), the lines following it are the lock tokens for
|
17
|
+
# this commit. The end of the list is marked by a line containing
|
18
|
+
# only a newline character.
|
19
|
+
#
|
20
|
+
# Each lock token line consists of a URI-escaped path, followed
|
21
|
+
# by the separator character '|', followed by the lock token string,
|
22
|
+
# followed by a newline.
|
23
|
+
#
|
24
|
+
# The default working directory for the invocation is undefined, so
|
25
|
+
# the program should set one explicitly if it cares.
|
26
|
+
#
|
27
|
+
# If the hook program exits with success, the txn is committed; but
|
28
|
+
# if it exits with failure (non-zero), the txn is aborted, no commit
|
29
|
+
# takes place, and STDERR is returned to the client. The hook
|
30
|
+
# program can use the 'svnlook' utility to help it examine the txn.
|
31
|
+
#
|
32
|
+
# On a Unix system, the normal procedure is to have 'pre-commit'
|
33
|
+
# invoke other programs to do the real work, though it may do the
|
34
|
+
# work itself too.
|
35
|
+
#
|
36
|
+
# *** NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT ***
|
37
|
+
# *** FOR REVISION PROPERTIES (like svn:log or svn:author). ***
|
38
|
+
#
|
39
|
+
# This is why we recommend using the read-only 'svnlook' utility.
|
40
|
+
# In the future, Subversion may enforce the rule that pre-commit
|
41
|
+
# hooks should not modify the versioned data in txns, or else come
|
42
|
+
# up with a mechanism to make it safe to do so (by informing the
|
43
|
+
# committing client of the changes). However, right now neither
|
44
|
+
# mechanism is implemented, so hook writers just have to be careful.
|
45
|
+
#
|
46
|
+
# Note that 'pre-commit' must be executable by the user(s) who will
|
47
|
+
# invoke it (typically the user httpd runs as), and that user must
|
48
|
+
# have filesystem-level permission to access the repository.
|
49
|
+
#
|
50
|
+
# On a Windows system, you should name the hook program
|
51
|
+
# 'pre-commit.bat' or 'pre-commit.exe',
|
52
|
+
# but the basic idea is the same.
|
53
|
+
#
|
54
|
+
# The hook program typically does not inherit the environment of
|
55
|
+
# its parent process. For example, a common problem is for the
|
56
|
+
# PATH environment variable to not be set to its usual value, so
|
57
|
+
# that subprograms fail to launch unless invoked via absolute path.
|
58
|
+
# If you're having unexpected problems with a hook program, the
|
59
|
+
# culprit may be unusual (or missing) environment variables.
|
60
|
+
#
|
61
|
+
# Here is an example hook script, for a Unix /bin/sh interpreter.
|
62
|
+
# For more examples and pre-written hooks, see those in
|
63
|
+
# /usr/share/subversion/hook-scripts, and in the repository at
|
64
|
+
# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
|
65
|
+
# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
|
66
|
+
|
67
|
+
|
68
|
+
REPOS="$1"
|
69
|
+
TXN="$2"
|
70
|
+
|
71
|
+
# Make sure that the log message contains some text.
|
72
|
+
SVNLOOK=/usr/bin/svnlook
|
73
|
+
$SVNLOOK log -t "$TXN" "$REPOS" | \
|
74
|
+
grep "[a-zA-Z0-9]" > /dev/null || exit 1
|
75
|
+
|
76
|
+
# Exit on all errors.
|
77
|
+
set -e
|
78
|
+
|
79
|
+
# Check that the author of this commit has the rights to perform
|
80
|
+
# the commit on the files and directories being modified.
|
81
|
+
"$REPOS"/hooks/commit-access-control.pl "$REPOS" $TXN \
|
82
|
+
"$REPOS"/hooks/commit-access-control.cfg
|
83
|
+
|
84
|
+
# All checks passed, so allow the commit.
|
85
|
+
exit 0
|
@@ -0,0 +1,71 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# PRE-LOCK HOOK
|
4
|
+
#
|
5
|
+
# The pre-lock hook is invoked before an exclusive lock is
|
6
|
+
# created. Subversion runs this hook by invoking a program
|
7
|
+
# (script, executable, binary, etc.) named 'pre-lock' (for which
|
8
|
+
# this file is a template), with the following ordered arguments:
|
9
|
+
#
|
10
|
+
# [1] REPOS-PATH (the path to this repository)
|
11
|
+
# [2] PATH (the path in the repository about to be locked)
|
12
|
+
# [3] USER (the user creating the lock)
|
13
|
+
# [4] COMMENT (the comment of the lock)
|
14
|
+
# [5] STEAL-LOCK (1 if the user is trying to steal the lock, else 0)
|
15
|
+
#
|
16
|
+
# If the hook program outputs anything on stdout, the output string will
|
17
|
+
# be used as the lock token for this lock operation. If you choose to use
|
18
|
+
# this feature, you must guarantee the tokens generated are unique across
|
19
|
+
# the repository each time.
|
20
|
+
#
|
21
|
+
# The default working directory for the invocation is undefined, so
|
22
|
+
# the program should set one explicitly if it cares.
|
23
|
+
#
|
24
|
+
# If the hook program exits with success, the lock is created; but
|
25
|
+
# if it exits with failure (non-zero), the lock action is aborted
|
26
|
+
# and STDERR is returned to the client.
|
27
|
+
|
28
|
+
# On a Unix system, the normal procedure is to have 'pre-lock'
|
29
|
+
# invoke other programs to do the real work, though it may do the
|
30
|
+
# work itself too.
|
31
|
+
#
|
32
|
+
# Note that 'pre-lock' must be executable by the user(s) who will
|
33
|
+
# invoke it (typically the user httpd runs as), and that user must
|
34
|
+
# have filesystem-level permission to access the repository.
|
35
|
+
#
|
36
|
+
# On a Windows system, you should name the hook program
|
37
|
+
# 'pre-lock.bat' or 'pre-lock.exe',
|
38
|
+
# but the basic idea is the same.
|
39
|
+
#
|
40
|
+
# Here is an example hook script, for a Unix /bin/sh interpreter:
|
41
|
+
|
42
|
+
REPOS="$1"
|
43
|
+
PATH="$2"
|
44
|
+
USER="$3"
|
45
|
+
|
46
|
+
# If a lock exists and is owned by a different person, don't allow it
|
47
|
+
# to be stolen (e.g., with 'svn lock --force ...').
|
48
|
+
|
49
|
+
# (Maybe this script could send email to the lock owner?)
|
50
|
+
SVNLOOK=/usr/bin/svnlook
|
51
|
+
GREP=/bin/grep
|
52
|
+
SED=/bin/sed
|
53
|
+
|
54
|
+
LOCK_OWNER=`$SVNLOOK lock "$REPOS" "$PATH" | \
|
55
|
+
$GREP '^Owner: ' | $SED 's/Owner: //'`
|
56
|
+
|
57
|
+
# If we get no result from svnlook, there's no lock, allow the lock to
|
58
|
+
# happen:
|
59
|
+
if [ "$LOCK_OWNER" = "" ]; then
|
60
|
+
exit 0
|
61
|
+
fi
|
62
|
+
|
63
|
+
# If the person locking matches the lock's owner, allow the lock to
|
64
|
+
# happen:
|
65
|
+
if [ "$LOCK_OWNER" = "$USER" ]; then
|
66
|
+
exit 0
|
67
|
+
fi
|
68
|
+
|
69
|
+
# Otherwise, we've got an owner mismatch, so return failure:
|
70
|
+
echo "Error: $PATH already locked by ${LOCK_OWNER}." 1>&2
|
71
|
+
exit 1
|
@@ -0,0 +1,66 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
|
3
|
+
# PRE-REVPROP-CHANGE HOOK
|
4
|
+
#
|
5
|
+
# The pre-revprop-change hook is invoked before a revision property
|
6
|
+
# is added, modified or deleted. Subversion runs this hook by invoking
|
7
|
+
# a program (script, executable, binary, etc.) named 'pre-revprop-change'
|
8
|
+
# (for which this file is a template), with the following ordered
|
9
|
+
# arguments:
|
10
|
+
#
|
11
|
+
# [1] REPOS-PATH (the path to this repository)
|
12
|
+
# [2] REVISION (the revision being tweaked)
|
13
|
+
# [3] USER (the username of the person tweaking the property)
|
14
|
+
# [4] PROPNAME (the property being set on the revision)
|
15
|
+
# [5] ACTION (the property is being 'A'dded, 'M'odified, or 'D'eleted)
|
16
|
+
#
|
17
|
+
# [STDIN] PROPVAL ** the new property value is passed via STDIN.
|
18
|
+
#
|
19
|
+
# If the hook program exits with success, the propchange happens; but
|
20
|
+
# if it exits with failure (non-zero), the propchange doesn't happen.
|
21
|
+
# The hook program can use the 'svnlook' utility to examine the
|
22
|
+
# existing value of the revision property.
|
23
|
+
#
|
24
|
+
# WARNING: unlike other hooks, this hook MUST exist for revision
|
25
|
+
# properties to be changed. If the hook does not exist, Subversion
|
26
|
+
# will behave as if the hook were present, but failed. The reason
|
27
|
+
# for this is that revision properties are UNVERSIONED, meaning that
|
28
|
+
# a successful propchange is destructive; the old value is gone
|
29
|
+
# forever. We recommend the hook back up the old value somewhere.
|
30
|
+
#
|
31
|
+
# On a Unix system, the normal procedure is to have 'pre-revprop-change'
|
32
|
+
# invoke other programs to do the real work, though it may do the
|
33
|
+
# work itself too.
|
34
|
+
#
|
35
|
+
# Note that 'pre-revprop-change' must be executable by the user(s) who will
|
36
|
+
# invoke it (typically the user httpd runs as), and that user must
|
37
|
+
# have filesystem-level permission to access the repository.
|
38
|
+
#
|
39
|
+
# On a Windows system, you should name the hook program
|
40
|
+
# 'pre-revprop-change.bat' or 'pre-revprop-change.exe',
|
41
|
+
# but the basic idea is the same.
|
42
|
+
#
|
43
|
+
# The hook program typically does not inherit the environment of
|
44
|
+
# its parent process. For example, a common problem is for the
|
45
|
+
# PATH environment variable to not be set to its usual value, so
|
46
|
+
# that subprograms fail to launch unless invoked via absolute path.
|
47
|
+
# If you're having unexpected problems with a hook program, the
|
48
|
+
# culprit may be unusual (or missing) environment variables.
|
49
|
+
#
|
50
|
+
# Here is an example hook script, for a Unix /bin/sh interpreter.
|
51
|
+
# For more examples and pre-written hooks, see those in
|
52
|
+
# /usr/share/subversion/hook-scripts, and in the repository at
|
53
|
+
# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
|
54
|
+
# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
|
55
|
+
|
56
|
+
|
57
|
+
REPOS="$1"
|
58
|
+
REV="$2"
|
59
|
+
USER="$3"
|
60
|
+
PROPNAME="$4"
|
61
|
+
ACTION="$5"
|
62
|
+
|
63
|
+
if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
|
64
|
+
|
65
|
+
echo "Changing revision properties other than svn:log is prohibited" >&2
|
66
|
+
exit 1
|