pre-commit 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,46 @@
1
+ #!/bin/sh
2
+ #
3
+ # An example hook script to verify what is about to be committed.
4
+ # Called by "git commit" with no arguments. The hook should
5
+ # exit with non-zero status after issuing an appropriate message if
6
+ # it wants to stop the commit.
7
+ #
8
+ # To enable this hook, rename this file to "pre-commit".
9
+
10
+ if git rev-parse --verify HEAD >/dev/null 2>&1
11
+ then
12
+ against=HEAD
13
+ else
14
+ # Initial commit: diff against an empty tree object
15
+ against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
16
+ fi
17
+
18
+ # If you want to allow non-ascii filenames set this variable to true.
19
+ allownonascii=$(git config hooks.allownonascii)
20
+
21
+ # Cross platform projects tend to avoid non-ascii filenames; prevent
22
+ # them from being added to the repository. We exploit the fact that the
23
+ # printable range starts at the space character and ends with tilde.
24
+ if [ "$allownonascii" != "true" ] &&
25
+ # Note that the use of brackets around a tr range is ok here, (it's
26
+ # even required, for portability to Solaris 10's /usr/bin/tr), since
27
+ # the square bracket bytes happen to fall in the designated range.
28
+ test "$(git diff --cached --name-only --diff-filter=A -z $against |
29
+ LC_ALL=C tr -d '[ -~]\0')"
30
+ then
31
+ echo "Error: Attempt to add a non-ascii file name."
32
+ echo
33
+ echo "This can cause problems if you want to work"
34
+ echo "with people on other platforms."
35
+ echo
36
+ echo "To be portable it is advisable to rename the file ..."
37
+ echo
38
+ echo "If you know what you are doing you can disable this"
39
+ echo "check using:"
40
+ echo
41
+ echo " git config hooks.allownonascii true"
42
+ echo
43
+ exit 1
44
+ fi
45
+
46
+ exec git diff-index --check --cached $against --
@@ -0,0 +1,7 @@
1
+ class WhiteSpaceChecker
2
+ WHITESPACE_SCRIPT_PATH = File.join(File.dirname(__FILE__), "whitespace")
3
+
4
+ def self.check
5
+ system("sh #{WHITESPACE_SCRIPT_PATH}")
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,77 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pre-commit
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 1
9
+ version: 0.1.1
10
+ platform: ruby
11
+ authors:
12
+ - Shajith Chacko, Josh Lubaway
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-12-15 00:00:00 -08:00
18
+ default_executable: pre-commit
19
+ dependencies: []
20
+
21
+ description:
22
+ email: dontneedmoreemail@example.com
23
+ executables:
24
+ - pre-commit
25
+ extensions: []
26
+
27
+ extra_rdoc_files:
28
+ - README.md
29
+ files:
30
+ - lib/pre-commit/checks/merge_conflict.rb
31
+ - lib/pre-commit/checks.rb
32
+ - lib/pre-commit/utils.rb
33
+ - lib/pre-commit.rb
34
+ - lib/support/all.rb
35
+ - lib/support/closure/closure_checker.rb
36
+ - lib/support/closure/compiler.jar
37
+ - lib/support/jslint/jslint_checker.rb
38
+ - lib/support/jslint/lint.js
39
+ - lib/support/whitespace/whitespace
40
+ - lib/support/whitespace/whitespace_checker.rb
41
+ - README.md
42
+ - bin/pre-commit
43
+ has_rdoc: true
44
+ homepage: http://github.com/jish/pre-commit
45
+ licenses: []
46
+
47
+ post_install_message:
48
+ rdoc_options:
49
+ - --main
50
+ - README.md
51
+ require_paths:
52
+ - lib
53
+ required_ruby_version: !ruby/object:Gem::Requirement
54
+ none: false
55
+ requirements:
56
+ - - ">="
57
+ - !ruby/object:Gem::Version
58
+ segments:
59
+ - 0
60
+ version: "0"
61
+ required_rubygems_version: !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ segments:
67
+ - 0
68
+ version: "0"
69
+ requirements: []
70
+
71
+ rubyforge_project:
72
+ rubygems_version: 1.3.7
73
+ signing_key:
74
+ specification_version: 3
75
+ summary: What this thing does
76
+ test_files: []
77
+