tracker-git 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +0 -1
- data/README.md +9 -3
- data/bin/tracker +20 -4
- data/lib/tracker-git/deliverer.rb +5 -2
- data/lib/tracker-git/git.rb +1 -1
- data/lib/tracker-git/version.rb +1 -1
- data/spec/deliverer_spec.rb +22 -8
- data/spec/git_spec.rb +1 -1
- metadata +4 -4
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -26,10 +26,16 @@ Or install it yourself as:
|
|
26
26
|
|
27
27
|
## Usage
|
28
28
|
|
29
|
-
This gem will create a 'tracker' binary. Call that in your deploy script with
|
29
|
+
This gem will create a 'tracker' binary. Call that in your deploy script with
|
30
|
+
the tracker id and access token as command line arguments, or with following
|
31
|
+
environment variables set, and your finished stories will be updated to
|
32
|
+
delivered.
|
30
33
|
|
31
|
-
export
|
32
|
-
export
|
34
|
+
export TRACKER_PROJECT_ID=123456
|
35
|
+
export TRACKER_TOKEN=abc123
|
36
|
+
|
37
|
+
Optionally you can specify a specific git branch as the third command line
|
38
|
+
argument or with the GIT_BRANCH environment variable.
|
33
39
|
|
34
40
|
## Known Issues
|
35
41
|
|
data/bin/tracker
CHANGED
@@ -6,11 +6,27 @@ rescue LoadError
|
|
6
6
|
require 'tracker-git'
|
7
7
|
end
|
8
8
|
|
9
|
-
tracker_token =
|
10
|
-
|
9
|
+
project_id, tracker_token, git_branch = \
|
10
|
+
if [2, 3].include? ARGV.size
|
11
|
+
ARGV
|
12
|
+
else
|
13
|
+
[ENV['TRACKER_PROJECT_ID'], ENV['TRACKER_TOKEN'], ENV['GIT_BRANCH']]
|
14
|
+
end
|
15
|
+
|
16
|
+
unless tracker_token && project_id
|
17
|
+
puts <<-USAGE
|
18
|
+
Usage: Pass your pivotal tracker project id and access token on the command
|
19
|
+
line, e.g:
|
20
|
+
tracker 123456 abc123
|
21
|
+
or as an environment variable:
|
22
|
+
export TRACKER_PROJECT_ID=123456
|
23
|
+
export TRACKER_TOKEN=abc123
|
24
|
+
tracker
|
25
|
+
USAGE
|
26
|
+
exit(1)
|
27
|
+
end
|
11
28
|
|
12
29
|
project = Tracker::Project.new(tracker_token, project_id)
|
13
30
|
git = Tracker::Git.new
|
14
31
|
deliverer = Tracker::Deliverer.new(project, git)
|
15
|
-
|
16
|
-
deliverer.mark_as_delivered
|
32
|
+
deliverer.mark_as_delivered(git_branch)
|
@@ -6,9 +6,12 @@ module Tracker
|
|
6
6
|
@git = git
|
7
7
|
end
|
8
8
|
|
9
|
-
def mark_as_delivered
|
9
|
+
def mark_as_delivered(branch = nil)
|
10
|
+
options = {}
|
11
|
+
options[:branch] = branch if branch
|
12
|
+
|
10
13
|
project.finished.each do |story|
|
11
|
-
if git.contains?(story.id)
|
14
|
+
if git.contains?(story.id, options)
|
12
15
|
project.deliver(story)
|
13
16
|
end
|
14
17
|
end
|
data/lib/tracker-git/git.rb
CHANGED
data/lib/tracker-git/version.rb
CHANGED
data/spec/deliverer_spec.rb
CHANGED
@@ -11,15 +11,29 @@ describe Tracker::Deliverer do
|
|
11
11
|
let(:git) { stub }
|
12
12
|
let(:deliverer) { Tracker::Deliverer.new(project, git) }
|
13
13
|
|
14
|
-
describe
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
describe '#mark_as_delivered' do
|
15
|
+
context 'when called without argument' do
|
16
|
+
it('should mark stories as delivered') do
|
17
|
+
project.should_receive(:finished) { finished_stories }
|
18
|
+
git.should_receive(:contains?).with(1, {}) { true }
|
19
|
+
git.should_receive(:contains?).with(2, {}) { false }
|
20
|
+
project.should_receive(:deliver).with(commited_story)
|
21
|
+
project.should_not_receive(:deliver).with(uncommited_story)
|
21
22
|
|
22
|
-
|
23
|
+
deliverer.mark_as_delivered
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'when given a specific branch' do
|
28
|
+
it('should mark stories as delivered') do
|
29
|
+
project.should_receive(:finished) { finished_stories }
|
30
|
+
git.should_receive(:contains?).with(1, {branch: 'develop'}) { true }
|
31
|
+
git.should_receive(:contains?).with(2, {branch: 'develop'}) { false }
|
32
|
+
project.should_receive(:deliver).with(commited_story)
|
33
|
+
project.should_not_receive(:deliver).with(uncommited_story)
|
34
|
+
|
35
|
+
deliverer.mark_as_delivered('develop')
|
36
|
+
end
|
23
37
|
end
|
24
38
|
end
|
25
39
|
|
data/spec/git_spec.rb
CHANGED
@@ -4,7 +4,7 @@ describe Tracker::Git do
|
|
4
4
|
describe "#search" do
|
5
5
|
let(:message) { "[Finishes #123456]" }
|
6
6
|
let(:branch) { "master" }
|
7
|
-
let(:query) { "git log --grep
|
7
|
+
let(:query) { "git log #{branch} --grep='#{message}'"}
|
8
8
|
let(:result) { "Some git message" }
|
9
9
|
|
10
10
|
before do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tracker-git
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
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-
|
12
|
+
date: 2012-10-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pivotal-tracker
|
@@ -116,7 +116,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
116
|
version: '0'
|
117
117
|
segments:
|
118
118
|
- 0
|
119
|
-
hash:
|
119
|
+
hash: 531834068982296945
|
120
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
121
|
none: false
|
122
122
|
requirements:
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
segments:
|
127
127
|
- 0
|
128
|
-
hash:
|
128
|
+
hash: 531834068982296945
|
129
129
|
requirements: []
|
130
130
|
rubyforge_project:
|
131
131
|
rubygems_version: 1.8.24
|