git-comitter 0.0.1 → 0.0.2
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/History.txt +3 -1
- data/Rakefile +1 -1
- data/lib/git-comitter.rb +1 -1
- data/lib/git-comitter/commit.rb +4 -0
- data/lib/git-comitter/primitives.rb +13 -2
- data/spec/commit_spec.rb +6 -1
- data/spec/primitives_spec.rb +10 -0
- data/spec/spec_helper.rb +1 -0
- metadata +23 -7
data/History.txt
CHANGED
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
|
-
|
16
|
+
self.extra_deps = [['git','>= 1.2.5']]
|
17
17
|
|
18
18
|
end
|
19
19
|
|
data/lib/git-comitter.rb
CHANGED
data/lib/git-comitter/commit.rb
CHANGED
@@ -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
|
-
|
9
|
+
message = get_message(args)
|
10
|
+
print(message) if message
|
10
11
|
_accept
|
11
12
|
end
|
12
13
|
|
13
14
|
def deny(args = {})
|
14
|
-
|
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
|
data/spec/commit_spec.rb
CHANGED
@@ -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(
|
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
|
data/spec/primitives_spec.rb
CHANGED
@@ -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
|
data/spec/spec_helper.rb
CHANGED
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:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
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:
|
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: *
|
52
|
+
version_requirements: *id002
|
37
53
|
- !ruby/object:Gem::Dependency
|
38
54
|
name: hoe
|
39
55
|
prerelease: false
|
40
|
-
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: *
|
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
|