githooks 0.0.5 → 0.0.6

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.
data/README.md CHANGED
@@ -3,13 +3,13 @@
3
3
  A framework to manage git hooks with your repository. Codes in *_githooks.rb will be executed by the framework.
4
4
 
5
5
  ## Convention
6
- Githooks will look for files named as filename_githooks.rb in your repository. The typical directory structure with Githooks will look like this,
6
+ Githooks will look for files named as filename_githooks.rb under githooks folder in your repository. The typical directory structure with Githooks will look like this,
7
7
  ```
8
8
  /Your repository
9
9
  /lib
10
10
  /app
11
11
  ...
12
- /hooks
12
+ /githooks
13
13
  example_githooks.rb
14
14
  example2_githooks.rb
15
15
  ```
@@ -87,6 +87,5 @@ The example hook checks whether the commit message follows the provided pattern.
87
87
 
88
88
  ## TODO
89
89
 
90
- 1. Testing / CI
91
- 2. Provide git related information in the environment
92
- 3. Share context across hooks
90
+ 1. Provide git related information in the environment
91
+ 2. Share context across hooks
data/bin/githooks CHANGED
@@ -28,7 +28,14 @@ options = OptionParser.new do |opts|
28
28
  git_root = `git rev-parse --show-toplevel`.chop
29
29
  gem_root = File.expand_path "..", File.dirname($0)
30
30
  FileUtils.cp_r(Dir["#{gem_root}/gems/githooks-#{Githooks::VERSION}/lib/hooks/*"], "#{git_root}/.git/hooks")
31
- puts "git hooks initialized"
31
+
32
+ puts "Creating githooks directory..."
33
+ begin
34
+ FileUtils.mkdir "#{git_root}/githooks", :mode => 0755
35
+ rescue => e
36
+ puts "githooks directory is not created, #{e.message}"
37
+ end
38
+ puts "Git hooks initialized"
32
39
  end
33
40
  exit
34
41
  end
data/githooks.gemspec CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |gem|
9
9
  gem.authors = ["Yu Zhang"]
10
10
  gem.email = ["ian7zy@gmail.com"]
11
11
  gem.description = %q{A git hooks framework in Ruby}
12
- gem.summary = %q{A framework to manage git hooks with your source code}
12
+ gem.summary = %q{A framework to manage git hooks with your repository}
13
13
  gem.homepage = "https://github.com/ianzy/githooks"
14
14
 
15
15
  gem.files = `git ls-files`.split($/)
data/lib/githooks/base.rb CHANGED
@@ -33,14 +33,13 @@ module Githooks
33
33
  def execute
34
34
  git_root = `git rev-parse --show-toplevel`.chop
35
35
 
36
- Dir.glob("#{git_root}/**/*_githooks.rb").each do |file|
36
+ Dir.glob("#{git_root}/githooks/**/*_githooks.rb").each do |file|
37
37
  load file
38
38
  end
39
39
 
40
- # env = Object.new
40
+ env = Object.new
41
41
  each_hook do |hook|
42
- # env.instance_eval &hook
43
- hook.call @args
42
+ env.instance_exec @args, &hook
44
43
  end
45
44
  end
46
45
 
@@ -1,3 +1,3 @@
1
1
  module Githooks
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: githooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
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-10-21 00:00:00.000000000 Z
12
+ date: 2012-11-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -100,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
100
100
  version: '0'
101
101
  segments:
102
102
  - 0
103
- hash: 3571687485541321288
103
+ hash: -669187955603600665
104
104
  required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
@@ -109,13 +109,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
109
109
  version: '0'
110
110
  segments:
111
111
  - 0
112
- hash: 3571687485541321288
112
+ hash: -669187955603600665
113
113
  requirements: []
114
114
  rubyforge_project:
115
115
  rubygems_version: 1.8.24
116
116
  signing_key:
117
117
  specification_version: 3
118
- summary: A framework to manage git hooks with your source code
118
+ summary: A framework to manage git hooks with your repository
119
119
  test_files:
120
120
  - spec/lib/githooks/base_spec.rb
121
121
  - spec/lib/githooks/helper_spec.rb