tailor-hook 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock ADDED
@@ -0,0 +1,30 @@
1
+ GIT
2
+ remote: git://github.com/sergio-fry/tailor.git
3
+ revision: 7f737091752ed8581762a6586547428a52c9e622
4
+ specs:
5
+ tailor (0.1.3.1)
6
+ term-ansicolor (>= 1.0.5)
7
+ term-ansicolor (>= 1.0.5)
8
+
9
+ GEM
10
+ remote: http://rubygems.org/
11
+ specs:
12
+ git (1.2.5)
13
+ jeweler (1.6.4)
14
+ bundler (~> 1.0)
15
+ git (>= 1.2.5)
16
+ rake
17
+ rake (0.9.2)
18
+ rcov (0.9.10)
19
+ shoulda (2.11.3)
20
+ term-ansicolor (1.0.6)
21
+
22
+ PLATFORMS
23
+ ruby
24
+
25
+ DEPENDENCIES
26
+ bundler (~> 1.0.0)
27
+ jeweler (~> 1.6.4)
28
+ rcov
29
+ shoulda
30
+ tailor!
data/Rakefile CHANGED
@@ -50,4 +50,7 @@ Rake::RDocTask.new do |rdoc|
50
50
  rdoc.title = "tailor-hook #{version}"
51
51
  rdoc.rdoc_files.include('README*')
52
52
  rdoc.rdoc_files.include('lib/**/*.rb')
53
+ rdoc.rdoc_files.include('bin/tailor-hook-install')
54
+ rdoc.rdoc_files.include('pre-commit')
55
+
53
56
  end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.1
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ src_path = File.join(File.dirname(__FILE__), "../pre-commit")
4
+ unless File.exists? ".git/hooks/pre-commit"
5
+ `cp #{src_path} .git/hooks/pre-commit`
6
+ else
7
+ print "Error: file '.git/hooks/pre-commit' already exists!\n"
8
+ end
9
+
data/pre-commit ADDED
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/ruby
2
+
3
+ class TailorHook
4
+ LAST_LINE = "The following files are out of style"
5
+
6
+ def initialize
7
+ @errors = []
8
+ end
9
+
10
+ def hook!
11
+ ruby_files.each do |filename|
12
+ check_file(filename)
13
+ end
14
+
15
+ if @errors.empty?
16
+ exit 0
17
+ else
18
+ @errors.each { |e| print e }
19
+ exit 1
20
+ end
21
+ end
22
+
23
+ private
24
+
25
+ def check_file(filename)
26
+ output = `tailor #{filename}`
27
+
28
+ unless output.split("\n")[-1].include? LAST_LINE
29
+ @errors << output
30
+ end
31
+ end
32
+
33
+ def ruby_files
34
+ `git status -s`.split("\n").collect do |line|
35
+ filename = line.split[1]
36
+ filename if filename.match(/\.rb$/)
37
+ end.compact
38
+ end
39
+ end
40
+
41
+ hook = TailorHook.new
42
+ hook.hook!
43
+
44
+
@@ -0,0 +1,65 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "tailor-hook"
8
+ s.version = "0.1.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Sergei O. Udalov"]
12
+ s.date = "2011-09-23"
13
+ s.description = "pre-commit hook, that checks ruby-style"
14
+ s.email = "sergei.udalov@gmail.com"
15
+ s.executables = ["tailor-hook-install"]
16
+ s.extra_rdoc_files = [
17
+ "LICENSE.txt",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE.txt",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "bin/tailor-hook-install",
29
+ "lib/tailor-hook.rb",
30
+ "pre-commit",
31
+ "tailor-hook.gemspec",
32
+ "test/helper.rb",
33
+ "test/test_tailor-hook.rb"
34
+ ]
35
+ s.homepage = "http://github.com/sergio-fry/tailor-hook"
36
+ s.licenses = ["MIT"]
37
+ s.require_paths = ["lib"]
38
+ s.rubygems_version = "1.8.10"
39
+ s.summary = "add tailor style-check to your hooks"
40
+
41
+ if s.respond_to? :specification_version then
42
+ s.specification_version = 3
43
+
44
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
+ s.add_runtime_dependency(%q<tailor>, [">= 0"])
46
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
47
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
48
+ s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
49
+ s.add_development_dependency(%q<rcov>, [">= 0"])
50
+ else
51
+ s.add_dependency(%q<tailor>, [">= 0"])
52
+ s.add_dependency(%q<shoulda>, [">= 0"])
53
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
54
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
55
+ s.add_dependency(%q<rcov>, [">= 0"])
56
+ end
57
+ else
58
+ s.add_dependency(%q<tailor>, [">= 0"])
59
+ s.add_dependency(%q<shoulda>, [">= 0"])
60
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
61
+ s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
62
+ s.add_dependency(%q<rcov>, [">= 0"])
63
+ end
64
+ end
65
+
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.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-23 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: tailor
16
- requirement: &19774720 !ruby/object:Gem::Requirement
16
+ requirement: &17938360 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *19774720
24
+ version_requirements: *17938360
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: shoulda
27
- requirement: &19773380 !ruby/object:Gem::Requirement
27
+ requirement: &17936220 !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: *19773380
35
+ version_requirements: *17936220
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: bundler
38
- requirement: &19771960 !ruby/object:Gem::Requirement
38
+ requirement: &17934800 !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: *19771960
46
+ version_requirements: *17934800
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: jeweler
49
- requirement: &19769820 !ruby/object:Gem::Requirement
49
+ requirement: &17933660 !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: *19769820
57
+ version_requirements: *17933660
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rcov
60
- requirement: &19765020 !ruby/object:Gem::Requirement
60
+ requirement: &17931980 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,11 @@ dependencies:
65
65
  version: '0'
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *19765020
68
+ version_requirements: *17931980
69
69
  description: pre-commit hook, that checks ruby-style
70
70
  email: sergei.udalov@gmail.com
71
- executables: []
71
+ executables:
72
+ - tailor-hook-install
72
73
  extensions: []
73
74
  extra_rdoc_files:
74
75
  - LICENSE.txt
@@ -76,10 +77,15 @@ extra_rdoc_files:
76
77
  files:
77
78
  - .document
78
79
  - Gemfile
80
+ - Gemfile.lock
79
81
  - LICENSE.txt
80
82
  - README.rdoc
81
83
  - Rakefile
84
+ - VERSION
85
+ - bin/tailor-hook-install
82
86
  - lib/tailor-hook.rb
87
+ - pre-commit
88
+ - tailor-hook.gemspec
83
89
  - test/helper.rb
84
90
  - test/test_tailor-hook.rb
85
91
  homepage: http://github.com/sergio-fry/tailor-hook
@@ -97,7 +103,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
103
  version: '0'
98
104
  segments:
99
105
  - 0
100
- hash: 1746804261535570194
106
+ hash: 1879902128259912444
101
107
  required_rubygems_version: !ruby/object:Gem::Requirement
102
108
  none: false
103
109
  requirements: