pre-commit 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/pre-commit/checks/tabs.rb +10 -2
- metadata +2 -2
@@ -40,11 +40,19 @@ class Tabs
|
|
40
40
|
LEADING_TAB_PATTERN = '^ *\t'
|
41
41
|
|
42
42
|
def detected_bad_code?
|
43
|
-
system("grep -
|
43
|
+
system("#{grep} -q '#{LEADING_TAB_PATTERN}' #{staged_files}")
|
44
44
|
end
|
45
45
|
|
46
46
|
def violations
|
47
|
-
|
47
|
+
`#{grep} '#{LEADING_TAB_PATTERN}' #{staged_files}`
|
48
48
|
end
|
49
49
|
|
50
|
+
def grep
|
51
|
+
grep_version = `grep --version | head -n 1 | sed -e 's/^[^0-9.]*\([0-9.]*\)$/\1/'`
|
52
|
+
if grep_version =~ /FreeBSD/
|
53
|
+
"grep -EnIH"
|
54
|
+
else
|
55
|
+
"grep -PnIH"
|
56
|
+
end
|
57
|
+
end
|
50
58
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pre-commit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: execjs
|