git-pivotal 0.8.0 → 0.8.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/CHANGELOG +5 -0
- data/Gemfile +17 -0
- data/VERSION +1 -1
- data/features/finish.feature +12 -3
- data/features/pick.feature +21 -0
- data/features/step_definitions/steps.rb +8 -2
- data/features/support/git-pivotal.rb +10 -7
- data/git-pivotal.gemspec +75 -76
- data/lib/commands/base.rb +4 -0
- data/lib/commands/finish.rb +1 -1
- data/lib/commands/pick.rb +3 -1
- data/spec/commands/base_spec.rb +29 -1
- data/spec/commands/finish_spec.rb +19 -24
- data/spec/spec_helper.rb +4 -2
- metadata +62 -52
- data/.gitignore +0 -6
data/CHANGELOG
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
v 0.8.1
|
2
|
+
- Improve error reporting when interacting with PivotalTracker
|
3
|
+
- Add SSL project support [bunnymatic (Mr Rogers)]
|
4
|
+
- Improve method of collecting story ID from branch name
|
5
|
+
|
1
6
|
v 0.8.0
|
2
7
|
- Drop home-rolled PivotalTracker API for pivotal-tracker gem
|
3
8
|
- Add Gemfile for easier development
|
data/Gemfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# A sample Gemfile
|
2
|
+
source "http://rubygems.org"
|
3
|
+
|
4
|
+
gem "builder"
|
5
|
+
gem "pivotal-tracker", "~> 0.3.1"
|
6
|
+
|
7
|
+
group :development do
|
8
|
+
gem "rake"
|
9
|
+
gem "jeweler"
|
10
|
+
gem "mocha"
|
11
|
+
gem "rspec", "~> 2.5.0"
|
12
|
+
gem "rcov", :platform => :ruby_18
|
13
|
+
gem "cucumber", "~> 0.9.2"
|
14
|
+
gem "aruba", "~> 0.2.3"
|
15
|
+
end
|
16
|
+
|
17
|
+
gemspec
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.8.
|
1
|
+
0.8.2
|
data/features/finish.feature
CHANGED
@@ -21,7 +21,7 @@ Feature: git finish
|
|
21
21
|
Removing 5799841-feature branch
|
22
22
|
"""
|
23
23
|
And I should be on the "master" branch
|
24
|
-
|
24
|
+
|
25
25
|
Scenario: Executing with git configuration
|
26
26
|
Given a file named ".gitconfig" with:
|
27
27
|
"""
|
@@ -38,7 +38,16 @@ Feature: git finish
|
|
38
38
|
Removing 5799841-feature branch
|
39
39
|
"""
|
40
40
|
And I should be on the "master" branch
|
41
|
-
|
41
|
+
|
42
|
+
Scenario: Executing from a misnamed branch
|
43
|
+
Given I am on the "missing-an-id" branch
|
44
|
+
When I run "git-finish -k 10bfe281783e2bdc2d6592c0ea21e8d5 -p 52815"
|
45
|
+
Then the output should contain:
|
46
|
+
"""
|
47
|
+
Branch name must contain a Pivotal Tracker story id
|
48
|
+
"""
|
49
|
+
And the exit status should be 1
|
50
|
+
|
42
51
|
Scenario: Specifying an integration branch
|
43
52
|
Given I have a "develop" branch
|
44
53
|
And a file named ".gitconfig" with:
|
@@ -76,4 +85,4 @@ Feature: git finish
|
|
76
85
|
Removing 5799841-chore branch
|
77
86
|
"""
|
78
87
|
And I should be on the "master" branch
|
79
|
-
|
88
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: General Git Pivotal story-picking features
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I have a Pivotal Tracker feature
|
5
|
+
And a file named ".gitconfig" with:
|
6
|
+
"""
|
7
|
+
[pivotal]
|
8
|
+
api-token = 10bfe281783e2bdc2d6592c0ea21e8d5
|
9
|
+
full-name = Jeff Tucker
|
10
|
+
integration-branch = develop
|
11
|
+
project-id = 52815
|
12
|
+
"""
|
13
|
+
|
14
|
+
Scenario: Giving better error messaging
|
15
|
+
Given the feature is unestimated
|
16
|
+
When I run "git-feature -D"
|
17
|
+
Then the output should contain:
|
18
|
+
"""
|
19
|
+
Stories in the started state must be estimated.
|
20
|
+
"""
|
21
|
+
And the exit status should be 1
|
@@ -2,7 +2,13 @@ STORY_TYPE = /feature|bug|chore|release/
|
|
2
2
|
STORY_STATE = /unscheduled|unstarted|started|finished|delivered|accepted|rejected/
|
3
3
|
|
4
4
|
Given /^I have a(?:n)? (#{STORY_STATE})?\s?Pivotal Tracker (#{STORY_TYPE})$/ do |status, type|
|
5
|
-
|
5
|
+
options = {}
|
6
|
+
options[:current_state] = status if status
|
7
|
+
update_test_story(type, options)
|
8
|
+
end
|
9
|
+
|
10
|
+
Given /the feature is unestimated/ do
|
11
|
+
update_test_story('feature', :estimate => -1)
|
6
12
|
end
|
7
13
|
|
8
14
|
Given /^I am on the "([^"]*)" branch$/ do |branch|
|
@@ -15,4 +21,4 @@ end
|
|
15
21
|
|
16
22
|
Then /^I should be on the "([^"]*)" branch$/ do |branch|
|
17
23
|
current_branch.should == branch
|
18
|
-
end
|
24
|
+
end
|
@@ -5,6 +5,7 @@ PIVOTAL_TEST_PROJECT = 52815
|
|
5
5
|
PIVOTAL_TEST_ID = 5799841
|
6
6
|
|
7
7
|
Before do
|
8
|
+
@aruba_timeout_seconds = 5
|
8
9
|
build_temp_paths
|
9
10
|
set_env_variables
|
10
11
|
end
|
@@ -12,7 +13,7 @@ end
|
|
12
13
|
at_exit do
|
13
14
|
# The features seem to have trouble repeating accurately without
|
14
15
|
# setting the test story to an unstarted feature for the next run.
|
15
|
-
update_test_story("feature", "unstarted")
|
16
|
+
update_test_story("feature", :current_state => "unstarted")
|
16
17
|
end
|
17
18
|
|
18
19
|
def build_temp_paths
|
@@ -31,17 +32,19 @@ def set_env_variables
|
|
31
32
|
set_env "HOME", File.expand_path(current_dir)
|
32
33
|
end
|
33
34
|
|
34
|
-
def update_test_story(type,
|
35
|
+
def update_test_story(type, options = {})
|
35
36
|
PivotalTracker::Client.token = PIVOTAL_API_KEY
|
36
37
|
project = PivotalTracker::Project.find(PIVOTAL_TEST_PROJECT)
|
37
38
|
story = project.stories.find(PIVOTAL_TEST_ID)
|
38
|
-
|
39
|
-
story.update(
|
40
|
-
|
41
|
-
|
39
|
+
|
40
|
+
story.update({
|
41
|
+
:story_type => type.to_s,
|
42
|
+
:current_state => "unstarted",
|
43
|
+
:estimate => (type.to_s == "feature" ? 1 : nil)
|
44
|
+
}.merge(options))
|
42
45
|
sleep(4) # let the data propagate
|
43
46
|
end
|
44
47
|
|
45
48
|
def current_branch
|
46
49
|
`git symbolic-ref HEAD`.chomp.split('/').last
|
47
|
-
end
|
50
|
+
end
|
data/git-pivotal.gemspec
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{git-pivotal}
|
8
|
-
s.version = "0.8.
|
8
|
+
s.version = "0.8.2"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Jeff Tucker", "Sam Stokes"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-08-10}
|
13
13
|
s.description = %q{A collection of git utilities to ease integration with Pivotal Tracker}
|
14
14
|
s.email = %q{jeff@trydionel.com}
|
15
15
|
s.executables = ["git-bug", "git-chore", "git-feature", "git-finish", "git-info", "git-pick"]
|
@@ -17,97 +17,93 @@ Gem::Specification.new do |s|
|
|
17
17
|
"LICENSE"
|
18
18
|
]
|
19
19
|
s.files = [
|
20
|
-
"
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
20
|
+
"CHANGELOG",
|
21
|
+
"Gemfile",
|
22
|
+
"LICENSE",
|
23
|
+
"Rakefile",
|
24
|
+
"VERSION",
|
25
|
+
"bin/git-bug",
|
26
|
+
"bin/git-chore",
|
27
|
+
"bin/git-feature",
|
28
|
+
"bin/git-finish",
|
29
|
+
"bin/git-info",
|
30
|
+
"bin/git-pick",
|
31
|
+
"features/bug.feature",
|
32
|
+
"features/chore.feature",
|
33
|
+
"features/feature.feature",
|
34
|
+
"features/finish.feature",
|
35
|
+
"features/info.feature",
|
36
|
+
"features/pick.feature",
|
37
|
+
"features/step_definitions/steps.rb",
|
38
|
+
"features/support/env.rb",
|
39
|
+
"features/support/git-pivotal.rb",
|
40
|
+
"features/test_repo/readme",
|
41
|
+
"features/test_repo/working.git/COMMIT_EDITMSG",
|
42
|
+
"features/test_repo/working.git/HEAD",
|
43
|
+
"features/test_repo/working.git/config",
|
44
|
+
"features/test_repo/working.git/description",
|
45
|
+
"features/test_repo/working.git/hooks/applypatch-msg.sample",
|
46
|
+
"features/test_repo/working.git/hooks/commit-msg.sample",
|
47
|
+
"features/test_repo/working.git/hooks/post-commit.sample",
|
48
|
+
"features/test_repo/working.git/hooks/post-receive.sample",
|
49
|
+
"features/test_repo/working.git/hooks/post-update.sample",
|
50
|
+
"features/test_repo/working.git/hooks/pre-applypatch.sample",
|
51
|
+
"features/test_repo/working.git/hooks/pre-commit.sample",
|
52
|
+
"features/test_repo/working.git/hooks/pre-rebase.sample",
|
53
|
+
"features/test_repo/working.git/hooks/prepare-commit-msg.sample",
|
54
|
+
"features/test_repo/working.git/hooks/update.sample",
|
55
|
+
"features/test_repo/working.git/index",
|
56
|
+
"features/test_repo/working.git/info/exclude",
|
57
|
+
"features/test_repo/working.git/logs/HEAD",
|
58
|
+
"features/test_repo/working.git/logs/refs/heads/master",
|
59
|
+
"features/test_repo/working.git/objects/0c/6f7b1384910d1a2f137590095f008a06c7e00c",
|
60
|
+
"features/test_repo/working.git/objects/10/ecf2b7ce989f01f3f7266e712b48d9275f2635",
|
61
|
+
"features/test_repo/working.git/objects/a5/71d56305df09fb060f6ccb730b46080d305beb",
|
62
|
+
"features/test_repo/working.git/refs/heads/master",
|
63
|
+
"git-pivotal.gemspec",
|
64
|
+
"lib/commands/base.rb",
|
65
|
+
"lib/commands/bug.rb",
|
66
|
+
"lib/commands/chore.rb",
|
67
|
+
"lib/commands/feature.rb",
|
68
|
+
"lib/commands/finish.rb",
|
69
|
+
"lib/commands/info.rb",
|
70
|
+
"lib/commands/pick.rb",
|
71
|
+
"lib/git-pivotal.rb",
|
72
|
+
"readme.markdown",
|
73
|
+
"spec/commands/base_spec.rb",
|
74
|
+
"spec/commands/bug_spec.rb",
|
75
|
+
"spec/commands/chore_spec.rb",
|
76
|
+
"spec/commands/feature_spec.rb",
|
77
|
+
"spec/commands/finish_spec.rb",
|
78
|
+
"spec/factories.rb",
|
79
|
+
"spec/factory.rb",
|
80
|
+
"spec/spec_helper.rb"
|
80
81
|
]
|
81
82
|
s.homepage = %q{http://github.com/trydionel/git-pivotal}
|
82
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
83
83
|
s.require_paths = ["lib"]
|
84
|
-
s.rubygems_version = %q{1.
|
84
|
+
s.rubygems_version = %q{1.6.2}
|
85
85
|
s.summary = %q{A collection of git utilities to ease integration with Pivotal Tracker}
|
86
|
-
s.test_files = [
|
87
|
-
"spec/commands/base_spec.rb",
|
88
|
-
"spec/commands/bug_spec.rb",
|
89
|
-
"spec/commands/chore_spec.rb",
|
90
|
-
"spec/commands/feature_spec.rb",
|
91
|
-
"spec/commands/finish_spec.rb",
|
92
|
-
"spec/factories.rb",
|
93
|
-
"spec/factory.rb",
|
94
|
-
"spec/spec_helper.rb"
|
95
|
-
]
|
96
86
|
|
97
87
|
if s.respond_to? :specification_version then
|
98
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
99
88
|
s.specification_version = 3
|
100
89
|
|
101
90
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
102
91
|
s.add_runtime_dependency(%q<builder>, [">= 0"])
|
103
92
|
s.add_runtime_dependency(%q<pivotal-tracker>, ["~> 0.3.1"])
|
93
|
+
s.add_development_dependency(%q<rake>, [">= 0"])
|
94
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
95
|
+
s.add_development_dependency(%q<mocha>, [">= 0"])
|
104
96
|
s.add_development_dependency(%q<rspec>, ["~> 2.5.0"])
|
105
97
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
106
98
|
s.add_development_dependency(%q<cucumber>, ["~> 0.9.2"])
|
107
99
|
s.add_development_dependency(%q<aruba>, ["~> 0.2.3"])
|
100
|
+
s.add_runtime_dependency(%q<builder>, [">= 0"])
|
108
101
|
else
|
109
102
|
s.add_dependency(%q<builder>, [">= 0"])
|
110
103
|
s.add_dependency(%q<pivotal-tracker>, ["~> 0.3.1"])
|
104
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
105
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
106
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
111
107
|
s.add_dependency(%q<rspec>, ["~> 2.5.0"])
|
112
108
|
s.add_dependency(%q<rcov>, [">= 0"])
|
113
109
|
s.add_dependency(%q<cucumber>, ["~> 0.9.2"])
|
@@ -116,6 +112,9 @@ Gem::Specification.new do |s|
|
|
116
112
|
else
|
117
113
|
s.add_dependency(%q<builder>, [">= 0"])
|
118
114
|
s.add_dependency(%q<pivotal-tracker>, ["~> 0.3.1"])
|
115
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
116
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
117
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
119
118
|
s.add_dependency(%q<rspec>, ["~> 2.5.0"])
|
120
119
|
s.add_dependency(%q<rcov>, [">= 0"])
|
121
120
|
s.add_dependency(%q<cucumber>, ["~> 0.9.2"])
|
data/lib/commands/base.rb
CHANGED
@@ -37,6 +37,7 @@ module Commands
|
|
37
37
|
end
|
38
38
|
|
39
39
|
PivotalTracker::Client.token = options[:api_token]
|
40
|
+
PivotalTracker::Client.use_ssl = options[:use_ssl]
|
40
41
|
|
41
42
|
return 0
|
42
43
|
end
|
@@ -64,6 +65,7 @@ module Commands
|
|
64
65
|
integration_branch = get("git config --get pivotal.integration-branch").strip
|
65
66
|
only_mine = get("git config --get pivotal.only-mine").strip
|
66
67
|
append_name = get("git config --get pivotal.append-name").strip
|
68
|
+
use_ssl = get("git config --get pivotal.use-ssl").strip
|
67
69
|
|
68
70
|
options[:api_token] = token unless token == ""
|
69
71
|
options[:project_id] = id unless id == ""
|
@@ -71,6 +73,7 @@ module Commands
|
|
71
73
|
options[:integration_branch] = integration_branch unless integration_branch == ""
|
72
74
|
options[:only_mine] = (only_mine != "") unless name == ""
|
73
75
|
options[:append_name] = (append_name != "")
|
76
|
+
options[:use_ssl] = (/^true$/i.match(use_ssl))
|
74
77
|
end
|
75
78
|
|
76
79
|
def parse_argv(*args)
|
@@ -81,6 +84,7 @@ module Commands
|
|
81
84
|
opts.on("-n", "--full-name=", "Pivotal Trakcer full name") { |n| options[:full_name] = n }
|
82
85
|
opts.on("-b", "--integration-branch=", "The branch to merge finished stories back down onto") { |b| options[:integration_branch] = b }
|
83
86
|
opts.on("-m", "--only-mine", "Only select Pivotal Tracker stories assigned to you") { |m| options[:only_mine] = m }
|
87
|
+
opts.on("-S", "--use-ssl", "Use SSL for connection to Pivotal Tracker (for private repos(?))") { |s| options[:use_ssl] = s }
|
84
88
|
opts.on("-a", "--append-name", "whether to append the story id to branch name instead of prepend") { |a| options[:append_name] = a }
|
85
89
|
opts.on("-D", "--defaults", "Accept default options. No-interaction mode") { |d| options[:defaults] = d }
|
86
90
|
opts.on("-q", "--quiet", "Quiet, no-interaction mode") { |q| options[:quiet] = q }
|
data/lib/commands/finish.rb
CHANGED
data/lib/commands/pick.rb
CHANGED
@@ -34,8 +34,9 @@ module Commands
|
|
34
34
|
put "URL: #{story.url}"
|
35
35
|
|
36
36
|
put "Updating #{type} status in Pivotal Tracker..."
|
37
|
-
|
37
|
+
story.update(:owned_by => options[:full_name], :current_state => :started)
|
38
38
|
|
39
|
+
if story.errors.empty?
|
39
40
|
suffix_or_prefix = ""
|
40
41
|
unless options[:quiet] || options[:defaults]
|
41
42
|
put "Enter branch name (will be #{options[:append_name] ? 'appended' : 'prepended'} by #{story.id}) [#{suffix_or_prefix}]: ", false
|
@@ -56,6 +57,7 @@ module Commands
|
|
56
57
|
return 0
|
57
58
|
else
|
58
59
|
put "Unable to mark #{type} as started"
|
60
|
+
put "\t" + story.errors.to_a.join("\n\t")
|
59
61
|
|
60
62
|
return 1
|
61
63
|
end
|
data/spec/commands/base_spec.rb
CHANGED
@@ -120,4 +120,32 @@ describe Commands::Base do
|
|
120
120
|
@pick = Commands::Base.new
|
121
121
|
@pick.options[:append_name].should be_false
|
122
122
|
end
|
123
|
-
|
123
|
+
|
124
|
+
it "should set use_ssl to true with --use-ssl" do
|
125
|
+
@pick = Commands::Base.new(@input, @output, "--use-ssl")
|
126
|
+
@pick.options[:use_ssl].should be_true
|
127
|
+
end
|
128
|
+
|
129
|
+
it "should set use_ssl to true with -S" do
|
130
|
+
@pick = Commands::Base.new(@input, @output, "-S")
|
131
|
+
@pick.options[:use_ssl].should be_true
|
132
|
+
end
|
133
|
+
|
134
|
+
it "should set use_ssl to false by default" do
|
135
|
+
@pick = Commands::Base.new(@input, @output, "")
|
136
|
+
@pick.options[:use_ssl].should be_false
|
137
|
+
end
|
138
|
+
|
139
|
+
it "should respect use_ssl from git config if it's set true (case insensitive)" do
|
140
|
+
Commands::Base.any_instance.stubs(:get).with("git config --get pivotal.use-ssl").returns("truE")
|
141
|
+
@pick = Commands::Base.new
|
142
|
+
@pick.options[:use_ssl].should be_true
|
143
|
+
end
|
144
|
+
|
145
|
+
it "should respect use_ssl from git config if it's set to anything but true" do
|
146
|
+
Commands::Base.any_instance.stubs(:get).with("git config --get pivotal.use-ssl").returns("not true")
|
147
|
+
@pick = Commands::Base.new
|
148
|
+
@pick.options[:use_ssl].should be_false
|
149
|
+
end
|
150
|
+
|
151
|
+
end
|
@@ -2,36 +2,28 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Commands::Finish do
|
4
4
|
|
5
|
-
def mock_projects
|
6
|
-
if @mock_projects.nil?
|
7
|
-
@mock_projects = mock("mock project list")
|
8
|
-
@mock_projects.stubs(:find).with(:id => mock_project_id).returns(mock_project)
|
9
|
-
end
|
10
|
-
@mock_projects
|
11
|
-
end
|
12
|
-
|
13
5
|
def mock_project_id
|
14
6
|
@mock_project_id ||= '4321'
|
15
7
|
end
|
16
8
|
|
17
|
-
def
|
18
|
-
if @
|
19
|
-
@
|
20
|
-
@
|
9
|
+
def mock_projects
|
10
|
+
if @mock_projects.nil?
|
11
|
+
@mock_projects = mock("mock project")
|
12
|
+
@mock_projects.stubs(:stories).returns(mock_stories)
|
21
13
|
end
|
22
|
-
@
|
14
|
+
@mock_projects
|
23
15
|
end
|
24
16
|
|
25
17
|
def mock_stories
|
26
18
|
if @mock_stories.nil?
|
27
19
|
@mock_stories = mock("mock story list")
|
28
|
-
@mock_stories.stubs(:find).with(
|
20
|
+
@mock_stories.stubs(:find).with(mock_story_id).returns(mock_story)
|
29
21
|
end
|
30
22
|
@mock_stories
|
31
23
|
end
|
32
24
|
|
33
25
|
def mock_story_id
|
34
|
-
@mock_story_id ||=
|
26
|
+
@mock_story_id ||= 1234
|
35
27
|
end
|
36
28
|
|
37
29
|
def mock_story
|
@@ -41,6 +33,10 @@ describe Commands::Finish do
|
|
41
33
|
@mock_story
|
42
34
|
end
|
43
35
|
|
36
|
+
def branch_name
|
37
|
+
"#{mock_story_id}-feature-branch-name"
|
38
|
+
end
|
39
|
+
|
44
40
|
before(:each) do
|
45
41
|
# stub out git config requests
|
46
42
|
Commands::Finish.any_instance.stubs(:get).with { |v| v =~ /git config/ }.returns("")
|
@@ -57,6 +53,7 @@ describe Commands::Finish do
|
|
57
53
|
# stub out git status request to identify the branch
|
58
54
|
branch_name = "invalid-branch-name-without-story-id"
|
59
55
|
Commands::Finish.any_instance.stubs(:get).with { |v| v =~ /git status/ }.returns("# On branch #{branch_name}")
|
56
|
+
Commands::Finish.any_instance.stubs(:get).with { |v| v == "git symbolic-ref HEAD" }.returns(branch_name)
|
60
57
|
end
|
61
58
|
|
62
59
|
it "should return an exit status of one" do
|
@@ -70,25 +67,23 @@ describe Commands::Finish do
|
|
70
67
|
end
|
71
68
|
|
72
69
|
context "where the branch name does contain a valid story id" do
|
73
|
-
def branch_name
|
74
|
-
"#{mock_story_id}-feature-branch-name"
|
75
|
-
end
|
76
70
|
|
77
71
|
before(:each) do
|
78
72
|
# stub out git status request to identify the branch
|
79
73
|
Commands::Finish.any_instance.stubs(:get).with { |v| v =~ /git status/ }.returns("# On branch #{branch_name}")
|
74
|
+
Commands::Finish.any_instance.stubs(:get).with { |v| v == "git symbolic-ref HEAD" }.returns(branch_name)
|
80
75
|
end
|
81
76
|
|
82
77
|
it "should attempt to update the story status to the stories finished_state" do
|
83
|
-
mock_story.stubs(:
|
84
|
-
mock_story.expects(:
|
78
|
+
mock_story.stubs(:story_type).returns("finished")
|
79
|
+
mock_story.expects(:update).with(:current_state => "finished")
|
85
80
|
@finish.run!
|
86
81
|
end
|
87
82
|
|
88
83
|
context "and the story is successfully marked as finished in PT" do
|
89
84
|
before(:each) do
|
90
|
-
mock_story.stubs(:
|
91
|
-
mock_story.stubs(:
|
85
|
+
mock_story.stubs(:story_type).returns("finished")
|
86
|
+
mock_story.stubs(:update).with(:current_state => "finished").returns(true)
|
92
87
|
end
|
93
88
|
|
94
89
|
it "should succeed with an exist status of zero" do
|
@@ -113,8 +108,8 @@ describe Commands::Finish do
|
|
113
108
|
|
114
109
|
context "and the story fails to be marked as finished in PT" do
|
115
110
|
before(:each) do
|
116
|
-
mock_story.stubs(:
|
117
|
-
mock_story.stubs(:
|
111
|
+
mock_story.stubs(:story_type).returns("finished")
|
112
|
+
mock_story.stubs(:update).with(:current_state => "finished").returns(false)
|
118
113
|
end
|
119
114
|
|
120
115
|
it "should fail with an exist status of one" do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
require 'rspec'
|
2
2
|
require 'mocha'
|
3
3
|
require 'builder'
|
4
|
-
|
4
|
+
|
5
|
+
specdir = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
6
|
+
require File.join(specdir, 'lib','git-pivotal')
|
5
7
|
|
6
8
|
require File.join(File.dirname(__FILE__), 'factories')
|
7
9
|
|
@@ -11,4 +13,4 @@ end
|
|
11
13
|
|
12
14
|
def stub_connection_to_pivotal
|
13
15
|
RestClient::Resource.any_instance.stubs(:get).returns("")
|
14
|
-
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,12 +1,8 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-pivotal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 8
|
8
|
-
- 0
|
9
|
-
version: 0.8.0
|
4
|
+
prerelease:
|
5
|
+
version: 0.8.2
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Jeff Tucker
|
@@ -15,7 +11,7 @@ autorequire:
|
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
13
|
|
18
|
-
date: 2011-
|
14
|
+
date: 2011-08-10 00:00:00 -04:00
|
19
15
|
default_executable:
|
20
16
|
dependencies:
|
21
17
|
- !ruby/object:Gem::Dependency
|
@@ -26,8 +22,6 @@ dependencies:
|
|
26
22
|
requirements:
|
27
23
|
- - ">="
|
28
24
|
- !ruby/object:Gem::Version
|
29
|
-
segments:
|
30
|
-
- 0
|
31
25
|
version: "0"
|
32
26
|
type: :runtime
|
33
27
|
version_requirements: *id001
|
@@ -39,71 +33,97 @@ dependencies:
|
|
39
33
|
requirements:
|
40
34
|
- - ~>
|
41
35
|
- !ruby/object:Gem::Version
|
42
|
-
segments:
|
43
|
-
- 0
|
44
|
-
- 3
|
45
|
-
- 1
|
46
36
|
version: 0.3.1
|
47
37
|
type: :runtime
|
48
38
|
version_requirements: *id002
|
49
39
|
- !ruby/object:Gem::Dependency
|
50
|
-
name:
|
40
|
+
name: rake
|
51
41
|
prerelease: false
|
52
42
|
requirement: &id003 !ruby/object:Gem::Requirement
|
53
43
|
none: false
|
54
44
|
requirements:
|
55
|
-
- -
|
45
|
+
- - ">="
|
56
46
|
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
- 2
|
59
|
-
- 5
|
60
|
-
- 0
|
61
|
-
version: 2.5.0
|
47
|
+
version: "0"
|
62
48
|
type: :development
|
63
49
|
version_requirements: *id003
|
64
50
|
- !ruby/object:Gem::Dependency
|
65
|
-
name:
|
51
|
+
name: jeweler
|
66
52
|
prerelease: false
|
67
53
|
requirement: &id004 !ruby/object:Gem::Requirement
|
68
54
|
none: false
|
69
55
|
requirements:
|
70
56
|
- - ">="
|
71
57
|
- !ruby/object:Gem::Version
|
72
|
-
segments:
|
73
|
-
- 0
|
74
58
|
version: "0"
|
75
59
|
type: :development
|
76
60
|
version_requirements: *id004
|
77
61
|
- !ruby/object:Gem::Dependency
|
78
|
-
name:
|
62
|
+
name: mocha
|
79
63
|
prerelease: false
|
80
64
|
requirement: &id005 !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: "0"
|
70
|
+
type: :development
|
71
|
+
version_requirements: *id005
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: rspec
|
74
|
+
prerelease: false
|
75
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ~>
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 2.5.0
|
81
|
+
type: :development
|
82
|
+
version_requirements: *id006
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rcov
|
85
|
+
prerelease: false
|
86
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: "0"
|
92
|
+
type: :development
|
93
|
+
version_requirements: *id007
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: cucumber
|
96
|
+
prerelease: false
|
97
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
81
98
|
none: false
|
82
99
|
requirements:
|
83
100
|
- - ~>
|
84
101
|
- !ruby/object:Gem::Version
|
85
|
-
segments:
|
86
|
-
- 0
|
87
|
-
- 9
|
88
|
-
- 2
|
89
102
|
version: 0.9.2
|
90
103
|
type: :development
|
91
|
-
version_requirements: *
|
104
|
+
version_requirements: *id008
|
92
105
|
- !ruby/object:Gem::Dependency
|
93
106
|
name: aruba
|
94
107
|
prerelease: false
|
95
|
-
requirement: &
|
108
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
96
109
|
none: false
|
97
110
|
requirements:
|
98
111
|
- - ~>
|
99
112
|
- !ruby/object:Gem::Version
|
100
|
-
segments:
|
101
|
-
- 0
|
102
|
-
- 2
|
103
|
-
- 3
|
104
113
|
version: 0.2.3
|
105
114
|
type: :development
|
106
|
-
version_requirements: *
|
115
|
+
version_requirements: *id009
|
116
|
+
- !ruby/object:Gem::Dependency
|
117
|
+
name: builder
|
118
|
+
prerelease: false
|
119
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: "0"
|
125
|
+
type: :runtime
|
126
|
+
version_requirements: *id010
|
107
127
|
description: A collection of git utilities to ease integration with Pivotal Tracker
|
108
128
|
email: jeff@trydionel.com
|
109
129
|
executables:
|
@@ -118,8 +138,8 @@ extensions: []
|
|
118
138
|
extra_rdoc_files:
|
119
139
|
- LICENSE
|
120
140
|
files:
|
121
|
-
- .gitignore
|
122
141
|
- CHANGELOG
|
142
|
+
- Gemfile
|
123
143
|
- LICENSE
|
124
144
|
- Rakefile
|
125
145
|
- VERSION
|
@@ -134,6 +154,7 @@ files:
|
|
134
154
|
- features/feature.feature
|
135
155
|
- features/finish.feature
|
136
156
|
- features/info.feature
|
157
|
+
- features/pick.feature
|
137
158
|
- features/step_definitions/steps.rb
|
138
159
|
- features/support/env.rb
|
139
160
|
- features/support/git-pivotal.rb
|
@@ -183,8 +204,8 @@ homepage: http://github.com/trydionel/git-pivotal
|
|
183
204
|
licenses: []
|
184
205
|
|
185
206
|
post_install_message:
|
186
|
-
rdoc_options:
|
187
|
-
|
207
|
+
rdoc_options: []
|
208
|
+
|
188
209
|
require_paths:
|
189
210
|
- lib
|
190
211
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -192,30 +213,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
192
213
|
requirements:
|
193
214
|
- - ">="
|
194
215
|
- !ruby/object:Gem::Version
|
195
|
-
segments:
|
196
|
-
- 0
|
197
216
|
version: "0"
|
198
217
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
199
218
|
none: false
|
200
219
|
requirements:
|
201
220
|
- - ">="
|
202
221
|
- !ruby/object:Gem::Version
|
203
|
-
segments:
|
204
|
-
- 0
|
205
222
|
version: "0"
|
206
223
|
requirements: []
|
207
224
|
|
208
225
|
rubyforge_project:
|
209
|
-
rubygems_version: 1.
|
226
|
+
rubygems_version: 1.6.2
|
210
227
|
signing_key:
|
211
228
|
specification_version: 3
|
212
229
|
summary: A collection of git utilities to ease integration with Pivotal Tracker
|
213
|
-
test_files:
|
214
|
-
|
215
|
-
- spec/commands/bug_spec.rb
|
216
|
-
- spec/commands/chore_spec.rb
|
217
|
-
- spec/commands/feature_spec.rb
|
218
|
-
- spec/commands/finish_spec.rb
|
219
|
-
- spec/factories.rb
|
220
|
-
- spec/factory.rb
|
221
|
-
- spec/spec_helper.rb
|
230
|
+
test_files: []
|
231
|
+
|