git-comitter 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,6 @@
1
- === 0.0.1 2010-05-29
1
+ === 0.0.2 2010-11-18
2
+ * 1 fixed up deps and some pretty syntax
2
3
 
4
+ === 0.0.1 2010-05-29
3
5
  * 1 major enhancement:
4
6
  * Initial release
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ Hoe.plugin :newgem
13
13
  $hoe = Hoe.spec 'git-comitter' do
14
14
  self.developer 'Tejas Dinkar', 'tejas@gja.in'
15
15
  self.rubyforge_name = self.name # TODO this is default value
16
- # self.extra_deps = [['activesupport','>= 2.0.2']]
16
+ self.extra_deps = [['git','>= 1.2.5']]
17
17
 
18
18
  end
19
19
 
@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module GitCommitter
5
- VERSION = '0.0.1'
5
+ VERSION = '0.0.2'
6
6
  end
7
7
 
8
8
  require 'git'
@@ -15,7 +15,11 @@ module GitComitter
15
15
  PatternMatcher.new(patterns) {|c| c.author.email}
16
16
  end
17
17
 
18
+ alias :match_email :matches_email
19
+
18
20
  def matches_message(*patterns)
19
21
  PatternMatcher.new(patterns) {|c| c.message}
20
22
  end
23
+
24
+ alias :match_message :matches_message
21
25
  end
@@ -6,12 +6,23 @@ module GitComitter
6
6
  end
7
7
 
8
8
  def accept(args = {})
9
- print(args[:message]) if args[:message]
9
+ message = get_message(args)
10
+ print(message) if message
10
11
  _accept
11
12
  end
12
13
 
13
14
  def deny(args = {})
14
- print(args[:message]) if args[:message]
15
+ message = get_message(args)
16
+ print(message) if message
15
17
  _deny
16
18
  end
19
+
20
+ def with_message(message)
21
+ {:message => message}
22
+ end
23
+
24
+ private
25
+ def get_message(args)
26
+ args[:message] || args[:with_message]
27
+ end
17
28
  end
@@ -17,7 +17,7 @@ describe GitComitter do
17
17
 
18
18
  it "should not match unless all authors match pattern" do
19
19
  self.stub!(:commits).and_return([mock_commit("tejas@gja.in"), mock_commit("spam@gja.in")])
20
- all_commits(matches_email(/tejas/)).should == false
20
+ all_commits(match_email(/tejas/)).should == false
21
21
  end
22
22
 
23
23
  it "should be able to take a list of patterns" do
@@ -30,4 +30,9 @@ describe GitComitter do
30
30
  latest_commit(matches_message(/fixing build/i)).should == true
31
31
  latest_commit(matches_message(/foobar/i)).should == false
32
32
  end
33
+
34
+ it "should be able to match message of last commit" do
35
+ self.stub!(:commits).and_return([mock(:message => "Fixing Build")])
36
+ all_commits(match_message(/fixing build/i)).should == true
37
+ end
33
38
  end
@@ -15,6 +15,16 @@ describe GitComitter do
15
15
  message.should == "Dude, you can commit"
16
16
  end
17
17
 
18
+ it "Should accept messages using the :with_message syntax" do
19
+ accept :with_message => "Dude, you can commit"
20
+ message.should == "Dude, you can commit"
21
+ end
22
+
23
+ it "should accept messages with the with_message(message) syntax" do
24
+ accept with_message("Dude, you can commit")
25
+ message.should == "Dude, you can commit"
26
+ end
27
+
18
28
  it "Should be able to deny a commit" do
19
29
  deny
20
30
  state.should == :denied
@@ -16,6 +16,7 @@ module GitComitter
16
16
 
17
17
  def clear_flags
18
18
  @state = :neutral
19
+ @message = nil
19
20
  end
20
21
 
21
22
  def _accept
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-comitter
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Tejas Dinkar
@@ -19,9 +19,25 @@ date: 2010-11-18 00:00:00 +05:30
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- name: rubyforge
22
+ name: git
23
23
  prerelease: false
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 21
30
+ segments:
31
+ - 1
32
+ - 2
33
+ - 5
34
+ version: 1.2.5
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ - !ruby/object:Gem::Dependency
38
+ name: rubyforge
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
25
41
  none: false
26
42
  requirements:
27
43
  - - ">="
@@ -33,11 +49,11 @@ dependencies:
33
49
  - 4
34
50
  version: 2.0.4
35
51
  type: :development
36
- version_requirements: *id001
52
+ version_requirements: *id002
37
53
  - !ruby/object:Gem::Dependency
38
54
  name: hoe
39
55
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
56
+ requirement: &id003 !ruby/object:Gem::Requirement
41
57
  none: false
42
58
  requirements:
43
59
  - - ">="
@@ -49,7 +65,7 @@ dependencies:
49
65
  - 0
50
66
  version: 2.6.0
51
67
  type: :development
52
- version_requirements: *id002
68
+ version_requirements: *id003
53
69
  description: "* A gem that helps define rules to write git update hooks"
54
70
  email:
55
71
  - tejas@gja.in