git_tracker 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +20 -0
- data/Rakefile +1 -1
- data/lib/git_tracker.rb +3 -3
- data/lib/git_tracker/branch.rb +8 -1
- data/lib/git_tracker/commit_message.rb +6 -1
- data/lib/git_tracker/prepare_commit_message.rb +10 -2
- data/lib/git_tracker/repository.rb +4 -0
- data/lib/git_tracker/version.rb +1 -1
- data/spec/git_tracker/branch_spec.rb +13 -11
- data/spec/git_tracker/commit_message_spec.rb +60 -49
- data/spec/git_tracker/prepare_commit_message_spec.rb +47 -24
- data/spec/git_tracker/repository_spec.rb +15 -7
- data/spec/git_tracker_spec.rb +9 -9
- data/spec/spec_helper.rb +1 -0
- data/spec/support/matchers/exit_code_matchers.rb +33 -0
- metadata +40 -13
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -68,6 +68,26 @@ the top)*
|
|
68
68
|
|
69
69
|
```
|
70
70
|
|
71
|
+
## Keywords
|
72
|
+
You can use the custom keywords that Pivotal Tracker provide with the API.
|
73
|
+
|
74
|
+
The keywords are [Delivers] and [Fixes]
|
75
|
+
|
76
|
+
If you use those keywords in your commit message, the keyword will be prepended to the story ID in the commit message.
|
77
|
+
|
78
|
+
For example:
|
79
|
+
|
80
|
+
```bash
|
81
|
+
# on branch named `bug/redis_connection_not_initializing_#8675309`
|
82
|
+
$ git commit -am "changed the redis connection string [Fixes]"
|
83
|
+
```
|
84
|
+
|
85
|
+
Will result in a this being appended to the commit message
|
86
|
+
|
87
|
+
```bash
|
88
|
+
[Fixes #8675309]
|
89
|
+
```
|
90
|
+
|
71
91
|
You should then add a [useful and responsible commit message][tpope]. :heart:
|
72
92
|
|
73
93
|
### Valid branch names
|
data/Rakefile
CHANGED
data/lib/git_tracker.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
1
|
+
require 'git_tracker/hook'
|
2
|
+
require 'git_tracker/prepare_commit_message'
|
3
|
+
require 'git_tracker/version'
|
4
4
|
|
5
5
|
module GitTracker
|
6
6
|
def self.execute(cmd_arg, *args)
|
data/lib/git_tracker/branch.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'English'
|
2
|
+
require 'git_tracker/repository'
|
2
3
|
|
3
4
|
module GitTracker
|
4
5
|
module Branch
|
@@ -9,9 +10,15 @@ module GitTracker
|
|
9
10
|
def self.current
|
10
11
|
branch_path = `git symbolic-ref HEAD`
|
11
12
|
|
12
|
-
|
13
|
+
Repository.ensure_exists unless exit_successful?
|
13
14
|
|
14
15
|
branch_path[%r{refs/heads/(?<name>.+)}, :name] || ''
|
15
16
|
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def self.exit_successful?
|
21
|
+
$CHILD_STATUS.exitstatus == 0
|
22
|
+
end
|
16
23
|
end
|
17
24
|
end
|
@@ -10,6 +10,11 @@ module GitTracker
|
|
10
10
|
@message =~ /^(?!#).*\[(\w+\s)?(#\d+\s)*##{number}(\s#\d+)*(\s\w+)?\]/io
|
11
11
|
end
|
12
12
|
|
13
|
+
def keyword
|
14
|
+
@message =~ /\[(Delivers|Fixes)\]/
|
15
|
+
$1
|
16
|
+
end
|
17
|
+
|
13
18
|
def append(text)
|
14
19
|
body, postscript = parse(@message)
|
15
20
|
new_message = format_message(body, text, postscript)
|
@@ -23,7 +28,7 @@ module GitTracker
|
|
23
28
|
|
24
29
|
def parse(message)
|
25
30
|
lines = message.split($/)
|
26
|
-
body = lines.take_while { |line| !line.start_with?(
|
31
|
+
body = lines.take_while { |line| !line.start_with?('#') }
|
27
32
|
postscript = lines.slice(body.length..-1)
|
28
33
|
[body.join("\n"), postscript.join("\n")]
|
29
34
|
end
|
@@ -16,15 +16,23 @@ module GitTracker
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def run
|
19
|
-
|
19
|
+
exit_when_commit_exists
|
20
20
|
|
21
|
+
story = story_number_from_branch
|
21
22
|
message = CommitMessage.new(file)
|
22
23
|
exit if message.mentions_story?(story)
|
23
|
-
message.
|
24
|
+
keyword = message.keyword
|
25
|
+
|
26
|
+
message_addition = [keyword, "##{story}"].compact.join(' ')
|
27
|
+
message.append("[#{message_addition}]")
|
24
28
|
end
|
25
29
|
|
26
30
|
private
|
27
31
|
|
32
|
+
def exit_when_commit_exists
|
33
|
+
exit if source == 'commit'
|
34
|
+
end
|
35
|
+
|
28
36
|
def story_number_from_branch
|
29
37
|
story = Branch.story_number
|
30
38
|
exit unless story
|
data/lib/git_tracker/version.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'spec_helper'
|
1
2
|
require 'git_tracker/branch'
|
2
3
|
|
3
4
|
describe GitTracker::Branch do
|
@@ -16,40 +17,41 @@ describe GitTracker::Branch do
|
|
16
17
|
subject.current
|
17
18
|
end
|
18
19
|
|
19
|
-
it '
|
20
|
-
stub_branch(
|
20
|
+
it 'ensures in a Git repository when looking for HEAD exits with non-zero status' do
|
21
|
+
stub_branch('', 128)
|
21
22
|
|
22
|
-
|
23
|
+
GitTracker::Repository.should_receive(:ensure_exists)
|
24
|
+
subject.current
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
26
28
|
describe '.story_number' do
|
27
|
-
context
|
28
|
-
it
|
29
|
+
context 'Current branch has a story number' do
|
30
|
+
it 'finds the story that starts with a hash' do
|
29
31
|
stub_branch('refs/heads/a_very_descriptive_name_#8675309')
|
30
32
|
subject.story_number.should == '8675309'
|
31
33
|
end
|
32
34
|
|
33
|
-
it
|
35
|
+
it 'finds the story without a leading hash' do
|
34
36
|
stub_branch('refs/heads/a_very_descriptive_name_1235309')
|
35
37
|
subject.story_number.should == '1235309'
|
36
38
|
end
|
37
39
|
|
38
|
-
it
|
40
|
+
it 'finds the story following a forward hash' do
|
39
41
|
stub_branch('refs/heads/alindeman/8675309_got_her_number')
|
40
42
|
subject.story_number.should == '8675309'
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
44
|
-
context
|
45
|
-
it
|
46
|
+
context 'The current branch does not have a story number' do
|
47
|
+
it 'finds no story' do
|
46
48
|
stub_branch('refs/heads/a_very_descriptive_name_without_a_#number')
|
47
49
|
subject.story_number.should_not be
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
51
|
-
context
|
52
|
-
it
|
53
|
+
context 'Not on a branch (HEAD does not exist)' do
|
54
|
+
it 'finds no story' do
|
53
55
|
stub_branch('')
|
54
56
|
subject.story_number.should_not be
|
55
57
|
end
|
@@ -6,76 +6,88 @@ describe GitTracker::CommitMessage do
|
|
6
6
|
include CommitMessageHelper
|
7
7
|
|
8
8
|
subject { described_class.new(file) }
|
9
|
-
let(:file) {
|
9
|
+
let(:file) { 'COMMIT_EDITMSG' }
|
10
10
|
|
11
|
-
it
|
12
|
-
|
11
|
+
it 'requires path to the temporary commit message file' do
|
12
|
+
lambda { GitTracker::CommitMessage.new }.should raise_error ArgumentError
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
15
|
+
def stub_commit_message(story_text)
|
16
|
+
File.stub(:read).with(file) { example_commit_message(story_text) }
|
17
|
+
end
|
18
|
+
|
19
|
+
describe '#keyword' do
|
20
|
+
it 'should return the correct keyword' do
|
21
|
+
stub_commit_message('[Delivers]')
|
22
|
+
subject.keyword.should == 'Delivers'
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'should return nil when there no keyword matching' do
|
26
|
+
stub_commit_message('[Something]')
|
27
|
+
subject.keyword.should be_nil
|
18
28
|
end
|
29
|
+
end
|
19
30
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
31
|
+
describe '#mentions_story?' do
|
32
|
+
context 'commit message contains the special Pivotal Tracker story syntax' do
|
33
|
+
it 'allows just the number' do
|
34
|
+
stub_commit_message('[#8675309]')
|
35
|
+
subject.should be_mentions_story('8675309')
|
24
36
|
end
|
25
37
|
|
26
|
-
it
|
27
|
-
stub_commit_message(
|
28
|
-
subject.should be_mentions_story(
|
29
|
-
subject.should be_mentions_story(
|
30
|
-
subject.should be_mentions_story(
|
31
|
-
subject.should be_mentions_story(
|
38
|
+
it 'allows multiple numbers' do
|
39
|
+
stub_commit_message('[#99 #777 #8675309 #111222]')
|
40
|
+
subject.should be_mentions_story('99')
|
41
|
+
subject.should be_mentions_story('777')
|
42
|
+
subject.should be_mentions_story('8675309')
|
43
|
+
subject.should be_mentions_story('111222')
|
32
44
|
end
|
33
45
|
|
34
|
-
it
|
35
|
-
stub_commit_message(
|
36
|
-
subject.should be_mentions_story(
|
46
|
+
it 'allows state change before number' do
|
47
|
+
stub_commit_message('[Fixes #8675309]')
|
48
|
+
subject.should be_mentions_story('8675309')
|
37
49
|
end
|
38
50
|
|
39
|
-
it
|
40
|
-
stub_commit_message(
|
41
|
-
subject.should be_mentions_story(
|
51
|
+
it 'allows state change after the number' do
|
52
|
+
stub_commit_message('[#8675309 Delivered]')
|
53
|
+
subject.should be_mentions_story('8675309')
|
42
54
|
end
|
43
55
|
|
44
|
-
it
|
45
|
-
stub_commit_message(
|
46
|
-
subject.should be_mentions_story(
|
56
|
+
it 'allows surrounding text' do
|
57
|
+
stub_commit_message('derp de #herp [Fixes #8675309] de herp-ity derp')
|
58
|
+
subject.should be_mentions_story('8675309')
|
47
59
|
end
|
48
60
|
end
|
49
61
|
|
50
|
-
context
|
51
|
-
it
|
52
|
-
stub_commit_message(
|
53
|
-
subject.should_not be_mentions_story(
|
62
|
+
context 'commit message doesn not contain the special Pivotal Tracker story syntax' do
|
63
|
+
it 'requires brackets' do
|
64
|
+
stub_commit_message('#8675309')
|
65
|
+
subject.should_not be_mentions_story('8675309')
|
54
66
|
end
|
55
67
|
|
56
|
-
it
|
57
|
-
stub_commit_message(
|
58
|
-
subject.should_not be_mentions_story(
|
68
|
+
it 'requires a pound sign' do
|
69
|
+
stub_commit_message('[8675309]')
|
70
|
+
subject.should_not be_mentions_story('8675309')
|
59
71
|
end
|
60
72
|
|
61
|
-
it
|
62
|
-
stub_commit_message(
|
63
|
-
subject.should_not be_mentions_story(
|
73
|
+
it 'does not allow the bare number' do
|
74
|
+
stub_commit_message('8675309')
|
75
|
+
subject.should_not be_mentions_story('8675309')
|
64
76
|
end
|
65
77
|
|
66
|
-
it
|
67
|
-
stub_commit_message(
|
68
|
-
subject.should_not be_mentions_story(
|
78
|
+
it 'does not allow multiple state changes' do
|
79
|
+
stub_commit_message('[Fixes Deploys #8675309]')
|
80
|
+
subject.should_not be_mentions_story('8675309')
|
69
81
|
end
|
70
82
|
|
71
|
-
it
|
72
|
-
stub_commit_message(
|
73
|
-
subject.should_not be_mentions_story(
|
83
|
+
it 'does not allow comments' do
|
84
|
+
stub_commit_message('#[#8675309]')
|
85
|
+
subject.should_not be_mentions_story('8675309')
|
74
86
|
end
|
75
87
|
end
|
76
88
|
end
|
77
89
|
|
78
|
-
describe
|
90
|
+
describe '#append' do
|
79
91
|
let(:fake_file) { GitTracker::FakeFile.new }
|
80
92
|
before do
|
81
93
|
File.stub(:open).and_yield(fake_file)
|
@@ -84,9 +96,9 @@ describe GitTracker::CommitMessage do
|
|
84
96
|
File.stub(:read) { message }
|
85
97
|
end
|
86
98
|
|
87
|
-
it
|
99
|
+
it 'handles no existing message' do
|
88
100
|
stub_original_commit_message("\n\n# some other comments\n")
|
89
|
-
subject.append(
|
101
|
+
subject.append('[#8675309]')
|
90
102
|
|
91
103
|
fake_file.content.should == <<-COMMIT_MESSAGE.strip_heredoc
|
92
104
|
|
@@ -96,9 +108,9 @@ describe GitTracker::CommitMessage do
|
|
96
108
|
COMMIT_MESSAGE
|
97
109
|
end
|
98
110
|
|
99
|
-
it
|
111
|
+
it 'preserves existing messages' do
|
100
112
|
stub_original_commit_message("A first line\n\nWith more here\n# other comments\n")
|
101
|
-
subject.append(
|
113
|
+
subject.append('[#8675309]')
|
102
114
|
|
103
115
|
fake_file.content.should == <<-COMMIT_MESSAGE.strip_heredoc
|
104
116
|
A first line
|
@@ -110,9 +122,9 @@ describe GitTracker::CommitMessage do
|
|
110
122
|
COMMIT_MESSAGE
|
111
123
|
end
|
112
124
|
|
113
|
-
it
|
125
|
+
it 'preserves line breaks in comments' do
|
114
126
|
stub_original_commit_message("# comment #1\n# comment B\n# comment III")
|
115
|
-
subject.append(
|
127
|
+
subject.append('[#8675309]')
|
116
128
|
|
117
129
|
fake_file.content.should == <<-COMMIT_MESSAGE.strip_heredoc
|
118
130
|
|
@@ -124,5 +136,4 @@ describe GitTracker::CommitMessage do
|
|
124
136
|
COMMIT_MESSAGE
|
125
137
|
end
|
126
138
|
end
|
127
|
-
|
128
139
|
end
|
@@ -1,73 +1,96 @@
|
|
1
|
+
require 'spec_helper'
|
1
2
|
require 'git_tracker/prepare_commit_message'
|
2
3
|
|
3
4
|
describe GitTracker::PrepareCommitMessage do
|
4
5
|
subject { GitTracker::PrepareCommitMessage }
|
5
6
|
|
6
7
|
describe '.run' do
|
7
|
-
let(:hook) { stub(
|
8
|
+
let(:hook) { stub('PrepareCommitMessage') }
|
8
9
|
before do
|
9
10
|
subject.stub(:new) { hook }
|
10
11
|
end
|
11
12
|
|
12
|
-
it
|
13
|
+
it 'runs the hook' do
|
13
14
|
hook.should_receive(:run)
|
14
|
-
subject.run(
|
15
|
+
subject.run('FILE1', 'hook_source', 'sha1234')
|
15
16
|
end
|
16
17
|
end
|
17
18
|
|
18
|
-
describe
|
19
|
+
describe '.new' do
|
19
20
|
|
20
|
-
it
|
21
|
+
it 'requires the name of the commit message file' do
|
21
22
|
lambda { subject.new }.should raise_error(ArgumentError)
|
22
23
|
end
|
23
24
|
|
24
|
-
it
|
25
|
-
subject.new(
|
25
|
+
it 'remembers the name of the commit message file' do
|
26
|
+
subject.new('FILE1').file.should == 'FILE1'
|
26
27
|
end
|
27
28
|
|
28
|
-
it
|
29
|
-
hook = subject.new(
|
29
|
+
it 'optionally accepts a message source' do
|
30
|
+
hook = subject.new('FILE1', 'merge').source.should == 'merge'
|
30
31
|
end
|
31
32
|
|
32
|
-
it
|
33
|
-
hook = subject.new(
|
33
|
+
it 'optionally accepts the SHA-1 of a commit' do
|
34
|
+
hook = subject.new('FILE1', 'commit', 'abc1234').commit_sha.should == 'abc1234'
|
34
35
|
end
|
35
36
|
end
|
36
37
|
|
37
38
|
describe '#run' do
|
38
|
-
let(:hook) { GitTracker::PrepareCommitMessage.new(
|
39
|
+
let(:hook) { GitTracker::PrepareCommitMessage.new('FILE1') }
|
39
40
|
before do
|
40
41
|
GitTracker::Branch.stub(:story_number) { story }
|
41
42
|
end
|
42
43
|
|
43
|
-
context
|
44
|
+
context 'with an existing commit (via `-c`, `-C`, or `--amend` options)' do
|
45
|
+
let(:hook) { described_class.new('FILE2', 'commit', '60a086f3') }
|
46
|
+
|
47
|
+
it 'exits with status code 0' do
|
48
|
+
lambda { hook.run }.should succeed
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
context 'branch name without a Pivotal Tracker story number' do
|
44
53
|
let(:story) { nil }
|
45
54
|
|
46
|
-
it
|
47
|
-
lambda { hook.run }.should
|
55
|
+
it 'exits without updating the commit message' do
|
56
|
+
lambda { hook.run }.should succeed
|
48
57
|
GitTracker::CommitMessage.should_not have_received(:append)
|
49
58
|
end
|
50
59
|
end
|
51
60
|
|
52
|
-
context
|
53
|
-
let(:story) {
|
54
|
-
let(:commit_message) { stub(
|
61
|
+
context 'branch name with a Pivotal Tracker story number' do
|
62
|
+
let(:story) { '8675309' }
|
63
|
+
let(:commit_message) { stub('CommitMessage', mentions_story?: false) }
|
64
|
+
|
55
65
|
before do
|
66
|
+
commit_message.stub(:keyword) { nil }
|
56
67
|
GitTracker::CommitMessage.stub(:new) { commit_message }
|
57
68
|
end
|
58
69
|
|
59
|
-
it
|
60
|
-
commit_message.should_receive(:append).with(
|
70
|
+
it 'appends the number to the commit message' do
|
71
|
+
commit_message.should_receive(:append).with('[#8675309]')
|
61
72
|
hook.run
|
62
73
|
end
|
63
74
|
|
64
|
-
context
|
75
|
+
context 'keyword mentioned in the commit message' do
|
76
|
+
before do
|
77
|
+
commit_message.stub(:mentions_story?).with('8675309') { false }
|
78
|
+
commit_message.stub(:keyword) { 'Delivers' }
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'appends the keyword and the story number' do
|
82
|
+
commit_message.should_receive(:append).with('[Delivers #8675309]')
|
83
|
+
hook.run
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context 'number already mentioned in the commit message' do
|
65
88
|
before do
|
66
|
-
commit_message.stub(:mentions_story?).with(
|
89
|
+
commit_message.stub(:mentions_story?).with('8675309') { true }
|
67
90
|
end
|
68
91
|
|
69
|
-
it
|
70
|
-
lambda { hook.run }.should
|
92
|
+
it 'exits without updating the commit message' do
|
93
|
+
lambda { hook.run }.should succeed
|
71
94
|
GitTracker::CommitMessage.should_not have_received(:append)
|
72
95
|
end
|
73
96
|
end
|
@@ -1,23 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
1
2
|
require 'git_tracker/repository'
|
2
3
|
|
3
4
|
describe GitTracker::Repository do
|
4
5
|
subject { described_class }
|
6
|
+
let(:git_command) { 'git rev-parse --show-toplevel' }
|
7
|
+
before do
|
8
|
+
allow_message_expectations_on_nil
|
9
|
+
subject.stub(:`).with(git_command) { "/path/to/git/repo/root\n" }
|
10
|
+
end
|
5
11
|
|
6
12
|
describe '.root' do
|
7
|
-
|
8
|
-
|
9
|
-
allow_message_expectations_on_nil
|
10
|
-
subject.stub(:`).with(git_command) { "/path/to/git/repo/root\n" }
|
13
|
+
|
14
|
+
it 'gets the path to the top-level directory of the local Repository' do
|
11
15
|
$?.stub(:exitstatus) { 0 }
|
16
|
+
subject.root.should == '/path/to/git/repo/root'
|
12
17
|
end
|
13
18
|
|
14
|
-
it
|
15
|
-
|
19
|
+
it 'aborts when not in a git repository' do
|
20
|
+
$?.stub(:exitstatus) { 128 }
|
21
|
+
lambda { subject.root }.should_not succeed
|
16
22
|
end
|
23
|
+
end
|
17
24
|
|
25
|
+
describe '.ensure_exists' do
|
18
26
|
it 'aborts when not in a git repository' do
|
19
27
|
$?.stub(:exitstatus) { 128 }
|
20
|
-
|
28
|
+
lambda { subject.root }.should_not succeed
|
21
29
|
end
|
22
30
|
end
|
23
31
|
|
data/spec/git_tracker_spec.rb
CHANGED
@@ -1,34 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
1
2
|
require 'git_tracker'
|
2
3
|
|
3
4
|
describe GitTracker do
|
4
5
|
subject { described_class }
|
5
|
-
let(:args) { [
|
6
|
+
let(:args) { ['a_file', 'the_source', 'sha1234'] }
|
6
7
|
|
7
|
-
describe
|
8
|
+
describe '.execute' do
|
8
9
|
before do
|
9
10
|
subject.stub(:prepare_commit_msg) { true }
|
10
11
|
end
|
11
12
|
|
12
|
-
it
|
13
|
+
it 'runs the hook, passing the args' do
|
13
14
|
subject.should_receive(:prepare_commit_msg).with(*args) { true }
|
14
15
|
subject.execute('prepare-commit-msg', *args)
|
15
16
|
end
|
16
17
|
|
17
18
|
# TODO: stop the abort from writing to stderr during tests?
|
18
|
-
it
|
19
|
-
lambda { subject.execute('non-existent-hook', *args) }.
|
20
|
-
should raise_error SystemExit, "[git_tracker] command: 'non-existent-hook' does not exist."
|
19
|
+
it 'does not run hooks we do not know about' do
|
20
|
+
lambda { subject.execute('non-existent-hook', *args) }.should_not succeed
|
21
21
|
end
|
22
22
|
end
|
23
23
|
|
24
|
-
describe
|
25
|
-
it
|
24
|
+
describe '.prepare_commit_msg' do
|
25
|
+
it 'runs the hook, passing the args' do
|
26
26
|
GitTracker::PrepareCommitMessage.should_receive(:run).with(*args) { true }
|
27
27
|
subject.prepare_commit_msg(*args)
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
describe
|
31
|
+
describe '.install' do
|
32
32
|
it 'tells the hook to install itself' do
|
33
33
|
GitTracker::Hook.should_receive(:install)
|
34
34
|
subject.install
|
data/spec/spec_helper.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rspec/expectations'
|
2
|
+
|
3
|
+
RSpec::Matchers.define :succeed do
|
4
|
+
actual = nil
|
5
|
+
|
6
|
+
match do |block|
|
7
|
+
begin
|
8
|
+
block.call
|
9
|
+
rescue SystemExit => e
|
10
|
+
actual = e.status
|
11
|
+
end
|
12
|
+
actual and actual == successful_exit_code
|
13
|
+
end
|
14
|
+
|
15
|
+
failure_message_for_should do |block|
|
16
|
+
"expected block to call exit(#{successful_exit_code}) but exit" +
|
17
|
+
(actual.nil? ? ' not called' : "(#{actual}) was called")
|
18
|
+
end
|
19
|
+
|
20
|
+
failure_message_for_should_not do |block|
|
21
|
+
"expected block not to call exit(#{successful_exit_code})"
|
22
|
+
end
|
23
|
+
|
24
|
+
description do
|
25
|
+
"expect block to call exit(#{successful_exit_code})"
|
26
|
+
end
|
27
|
+
|
28
|
+
def successful_exit_code
|
29
|
+
0
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git_tracker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
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: 2012-04-
|
12
|
+
date: 2012-04-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 2.9.0
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.9.0
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: rspec-spies
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ~>
|
@@ -32,10 +37,15 @@ dependencies:
|
|
32
37
|
version: '2.0'
|
33
38
|
type: :development
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '2.0'
|
36
46
|
- !ruby/object:Gem::Dependency
|
37
47
|
name: pry
|
38
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
39
49
|
none: false
|
40
50
|
requirements:
|
41
51
|
- - ~>
|
@@ -43,10 +53,15 @@ dependencies:
|
|
43
53
|
version: 0.9.8
|
44
54
|
type: :development
|
45
55
|
prerelease: false
|
46
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.9.8
|
47
62
|
- !ruby/object:Gem::Dependency
|
48
63
|
name: activesupport
|
49
|
-
requirement:
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
50
65
|
none: false
|
51
66
|
requirements:
|
52
67
|
- - ~>
|
@@ -54,10 +69,15 @@ dependencies:
|
|
54
69
|
version: '3.2'
|
55
70
|
type: :development
|
56
71
|
prerelease: false
|
57
|
-
version_requirements:
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '3.2'
|
58
78
|
- !ruby/object:Gem::Dependency
|
59
79
|
name: rake
|
60
|
-
requirement:
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
61
81
|
none: false
|
62
82
|
requirements:
|
63
83
|
- - ! '>='
|
@@ -65,7 +85,12 @@ dependencies:
|
|
65
85
|
version: '0'
|
66
86
|
type: :development
|
67
87
|
prerelease: false
|
68
|
-
version_requirements:
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
69
94
|
description: ! " Some simple tricks that make working with Pivotal Tracker even\n
|
70
95
|
\ better... and easier... um, besier!\n"
|
71
96
|
email:
|
@@ -101,6 +126,7 @@ files:
|
|
101
126
|
- spec/spec_helper.rb
|
102
127
|
- spec/support/commit_message_helper.rb
|
103
128
|
- spec/support/fake_file.rb
|
129
|
+
- spec/support/matchers/exit_code_matchers.rb
|
104
130
|
homepage: https://github.com/highgroove/git_tracker
|
105
131
|
licenses: []
|
106
132
|
post_install_message:
|
@@ -121,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
147
|
version: '0'
|
122
148
|
requirements: []
|
123
149
|
rubyforge_project:
|
124
|
-
rubygems_version: 1.8.
|
150
|
+
rubygems_version: 1.8.21
|
125
151
|
signing_key:
|
126
152
|
specification_version: 3
|
127
153
|
summary: Teaching Git about Pivotal Tracker.
|
@@ -135,3 +161,4 @@ test_files:
|
|
135
161
|
- spec/spec_helper.rb
|
136
162
|
- spec/support/commit_message_helper.rb
|
137
163
|
- spec/support/fake_file.rb
|
164
|
+
- spec/support/matchers/exit_code_matchers.rb
|