tailor-hook 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -1
- data/.travis.yml +1 -0
- data/README.rdoc +1 -1
- data/Rakefile +9 -6
- data/VERSION +1 -1
- data/lib/tailor-hook/hook.rb +11 -2
- data/spec/tailor-hook/hook_spec.rb +9 -0
- data/tailor-hook.gemspec +3 -2
- metadata +18 -17
data/.rvmrc
CHANGED
@@ -1 +1 @@
|
|
1
|
-
rvm 1.9.2
|
1
|
+
rvm 1.9.2@tailor-hook
|
data/.travis.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm: 1.9.2
|
data/README.rdoc
CHANGED
data/Rakefile
CHANGED
@@ -26,10 +26,13 @@ end
|
|
26
26
|
Jeweler::RubygemsDotOrgTasks.new
|
27
27
|
|
28
28
|
require 'rake/testtask'
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
|
30
|
+
|
31
|
+
task :default => :spec
|
32
|
+
Rake::TestTask.new(:spec) do |t|
|
33
|
+
t.libs << 'spec'
|
34
|
+
t.pattern = 'spec/**/*_spec.rb'
|
35
|
+
t.verbose = false
|
33
36
|
end
|
34
37
|
|
35
38
|
require 'rcov/rcovtask'
|
@@ -40,7 +43,7 @@ Rcov::RcovTask.new do |test|
|
|
40
43
|
test.rcov_opts << '--exclude "gems/*"'
|
41
44
|
end
|
42
45
|
|
43
|
-
task :default => :
|
46
|
+
task :default => :spec
|
44
47
|
|
45
48
|
require 'rake/rdoctask'
|
46
49
|
Rake::RDocTask.new do |rdoc|
|
@@ -52,5 +55,5 @@ Rake::RDocTask.new do |rdoc|
|
|
52
55
|
rdoc.rdoc_files.include('lib/**/*.rb')
|
53
56
|
rdoc.rdoc_files.include('bin/tailor-hook-install')
|
54
57
|
rdoc.rdoc_files.include('pre-commit')
|
55
|
-
|
56
58
|
end
|
59
|
+
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/tailor-hook/hook.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
module TailorHook
|
2
2
|
class Hook
|
3
|
-
def initialize(path)
|
3
|
+
def initialize(path, ignore_list=[])
|
4
4
|
@git_repo = GitRepo.new(path)
|
5
|
+
@ignore_list = ignore_list.map { |path| File.expand_path(path) }
|
5
6
|
end
|
6
7
|
|
7
8
|
def hook!
|
8
9
|
@errors = []
|
9
10
|
|
10
|
-
|
11
|
+
files_to_check.each do |path|
|
11
12
|
check_file(path)
|
12
13
|
end
|
13
14
|
|
@@ -31,5 +32,13 @@ module TailorHook
|
|
31
32
|
@errors << output
|
32
33
|
end
|
33
34
|
end
|
35
|
+
|
36
|
+
def files_to_check
|
37
|
+
staged_files - @ignore_list
|
38
|
+
end
|
39
|
+
|
40
|
+
def staged_files
|
41
|
+
@git_repo.staged_ruby_files
|
42
|
+
end
|
34
43
|
end
|
35
44
|
end
|
@@ -5,5 +5,14 @@ describe Hook do
|
|
5
5
|
hook = Hook.new(".")
|
6
6
|
hook.hook!.must_equal 0
|
7
7
|
end
|
8
|
+
|
9
|
+
it "should ignore listed files" do
|
10
|
+
hook = Hook.new(".", ["ignore_file.rb"])
|
11
|
+
stub(hook).staged_files do
|
12
|
+
["file1.rb", "ignore_file.rb"].map { |path| File.expand_path(path) }
|
13
|
+
end
|
14
|
+
|
15
|
+
hook.send(:files_to_check).must_equal [File.expand_path("file1.rb")]
|
16
|
+
end
|
8
17
|
end
|
9
18
|
|
data/tailor-hook.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "tailor-hook"
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Sergei O. Udalov"]
|
12
|
-
s.date = "2011-
|
12
|
+
s.date = "2011-10-07"
|
13
13
|
s.description = "pre-commit hook, that checks ruby-style"
|
14
14
|
s.email = "sergei.udalov@gmail.com"
|
15
15
|
s.executables = ["tailor-hook-install"]
|
@@ -20,6 +20,7 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.files = [
|
21
21
|
".document",
|
22
22
|
".rvmrc",
|
23
|
+
".travis.yml",
|
23
24
|
"Gemfile",
|
24
25
|
"Gemfile.lock",
|
25
26
|
"Guardfile",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tailor-hook
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-10-07 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: tailor
|
16
|
-
requirement: &
|
16
|
+
requirement: &88642230 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.1.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *88642230
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: shoulda
|
27
|
-
requirement: &
|
27
|
+
requirement: &88641990 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *88641990
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: bundler
|
38
|
-
requirement: &
|
38
|
+
requirement: &88641750 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 1.0.0
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *88641750
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: jeweler
|
49
|
-
requirement: &
|
49
|
+
requirement: &88641510 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 1.6.4
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *88641510
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rcov
|
60
|
-
requirement: &
|
60
|
+
requirement: &88641270 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *88641270
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rr
|
71
|
-
requirement: &
|
71
|
+
requirement: &88641030 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *88641030
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: guard-minitest
|
82
|
-
requirement: &
|
82
|
+
requirement: &88640790 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *88640790
|
91
91
|
description: pre-commit hook, that checks ruby-style
|
92
92
|
email: sergei.udalov@gmail.com
|
93
93
|
executables:
|
@@ -99,6 +99,7 @@ extra_rdoc_files:
|
|
99
99
|
files:
|
100
100
|
- .document
|
101
101
|
- .rvmrc
|
102
|
+
- .travis.yml
|
102
103
|
- Gemfile
|
103
104
|
- Gemfile.lock
|
104
105
|
- Guardfile
|
@@ -130,7 +131,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
130
131
|
version: '0'
|
131
132
|
segments:
|
132
133
|
- 0
|
133
|
-
hash:
|
134
|
+
hash: 811073377
|
134
135
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
135
136
|
none: false
|
136
137
|
requirements:
|