git-pivotal 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/CHANGELOG +18 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/git-pivotal.gemspec +10 -7
- data/lib/commands/base.rb +28 -8
- data/lib/commands/finish.rb +19 -14
- data/lib/commands/pick.rb +19 -10
- data/lib/pivotal/base.rb +1 -0
- data/lib/pivotal/story.rb +10 -1
- data/readme.markdown +20 -10
- data/spec/commands/base_spec.rb +22 -1
- data/spec/commands/finish_spec.rb +131 -0
- data/spec/pivotal/story_spec.rb +13 -0
- data/spec/spec.opts +1 -0
- metadata +28 -6
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
v 0.2.3
|
2
|
+
- Allow the developer to specify the integration branch for git finish [Graeme Mathieson]
|
3
|
+
- Fixed bug which prevented chores from finishing successfully [Joshua Vial]
|
4
|
+
- Added option to allow only pickup items already assigned to you [Mark Butcher]
|
5
|
+
- Fix RestClient version issues
|
6
|
+
|
7
|
+
v 0.2.2
|
8
|
+
- Added git chore command
|
9
|
+
|
10
|
+
v 0.2.1
|
11
|
+
- Remove &:to_s shortcut for MRI 1.8.6 compatibility
|
12
|
+
- Updated to handle RestClient 1.4
|
13
|
+
|
14
|
+
v 0.2.0
|
15
|
+
- Added git feature and git bug commands
|
16
|
+
- Deprecated git feature
|
17
|
+
- Improved XPath reliability for Pivotal API requests [Sam Stokes]
|
18
|
+
|
1
19
|
v 0.1.3
|
2
20
|
- Fixed bug preventing command line args from being properly interpretted
|
3
21
|
|
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ begin
|
|
15
15
|
gemspec.authors = ["Jeff Tucker", "Sam Stokes"]
|
16
16
|
|
17
17
|
gemspec.add_dependency "nokogiri"
|
18
|
-
gemspec.add_dependency "rest-client"
|
18
|
+
gemspec.add_dependency "rest-client", "~>1.4.0"
|
19
19
|
gemspec.add_dependency "builder"
|
20
20
|
|
21
21
|
gemspec.add_development_dependency "rspec"
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/git-pivotal.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{git-pivotal}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.3"
|
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{2010-
|
12
|
+
s.date = %q{2010-07-23}
|
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-pick"]
|
@@ -47,6 +47,7 @@ Gem::Specification.new do |s|
|
|
47
47
|
"spec/commands/bug_spec.rb",
|
48
48
|
"spec/commands/chore_spec.rb",
|
49
49
|
"spec/commands/feature_spec.rb",
|
50
|
+
"spec/commands/finish_spec.rb",
|
50
51
|
"spec/factories.rb",
|
51
52
|
"spec/factory.rb",
|
52
53
|
"spec/pivotal/api_spec.rb",
|
@@ -56,18 +57,20 @@ Gem::Specification.new do |s|
|
|
56
57
|
"spec/pivotal/collection_spec.rb",
|
57
58
|
"spec/pivotal/project_spec.rb",
|
58
59
|
"spec/pivotal/story_spec.rb",
|
60
|
+
"spec/spec.opts",
|
59
61
|
"spec/spec_helper.rb"
|
60
62
|
]
|
61
63
|
s.homepage = %q{http://github.com/trydionel/git-pivotal}
|
62
64
|
s.rdoc_options = ["--charset=UTF-8"]
|
63
65
|
s.require_paths = ["lib"]
|
64
|
-
s.rubygems_version = %q{1.3.
|
66
|
+
s.rubygems_version = %q{1.3.7}
|
65
67
|
s.summary = %q{A collection of git utilities to ease integration with Pivotal Tracker}
|
66
68
|
s.test_files = [
|
67
69
|
"spec/commands/base_spec.rb",
|
68
70
|
"spec/commands/bug_spec.rb",
|
69
71
|
"spec/commands/chore_spec.rb",
|
70
72
|
"spec/commands/feature_spec.rb",
|
73
|
+
"spec/commands/finish_spec.rb",
|
71
74
|
"spec/factories.rb",
|
72
75
|
"spec/factory.rb",
|
73
76
|
"spec/pivotal/api_spec.rb",
|
@@ -84,16 +87,16 @@ Gem::Specification.new do |s|
|
|
84
87
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
85
88
|
s.specification_version = 3
|
86
89
|
|
87
|
-
if Gem::Version.new(Gem::
|
90
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
88
91
|
s.add_runtime_dependency(%q<nokogiri>, [">= 0"])
|
89
|
-
s.add_runtime_dependency(%q<rest-client>, ["
|
92
|
+
s.add_runtime_dependency(%q<rest-client>, ["~> 1.4.0"])
|
90
93
|
s.add_runtime_dependency(%q<builder>, [">= 0"])
|
91
94
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
92
95
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
93
96
|
s.add_development_dependency(%q<mocha>, [">= 0"])
|
94
97
|
else
|
95
98
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
96
|
-
s.add_dependency(%q<rest-client>, ["
|
99
|
+
s.add_dependency(%q<rest-client>, ["~> 1.4.0"])
|
97
100
|
s.add_dependency(%q<builder>, [">= 0"])
|
98
101
|
s.add_dependency(%q<rspec>, [">= 0"])
|
99
102
|
s.add_dependency(%q<rcov>, [">= 0"])
|
@@ -101,7 +104,7 @@ Gem::Specification.new do |s|
|
|
101
104
|
end
|
102
105
|
else
|
103
106
|
s.add_dependency(%q<nokogiri>, [">= 0"])
|
104
|
-
s.add_dependency(%q<rest-client>, ["
|
107
|
+
s.add_dependency(%q<rest-client>, ["~> 1.4.0"])
|
105
108
|
s.add_dependency(%q<builder>, [">= 0"])
|
106
109
|
s.add_dependency(%q<rspec>, [">= 0"])
|
107
110
|
s.add_dependency(%q<rcov>, [">= 0"])
|
data/lib/commands/base.rb
CHANGED
@@ -35,16 +35,34 @@ module Commands
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
protected
|
39
|
+
|
40
|
+
def project
|
41
|
+
@project ||= api.projects.find(:id => options[:project_id])
|
42
|
+
end
|
43
|
+
|
44
|
+
def api
|
45
|
+
@api ||= Pivotal::Api.new(:api_token => options[:api_token])
|
46
|
+
end
|
47
|
+
|
48
|
+
def integration_branch
|
49
|
+
options[:integration_branch] || "master"
|
50
|
+
end
|
51
|
+
|
38
52
|
private
|
39
53
|
|
40
54
|
def parse_gitconfig
|
41
|
-
token
|
42
|
-
id
|
43
|
-
name
|
55
|
+
token = get("git config --get pivotal.api-token").strip
|
56
|
+
id = get("git config --get pivotal.project-id").strip
|
57
|
+
name = get("git config --get pivotal.full-name").strip
|
58
|
+
integration_branch = get("git config --get pivotal.integration-branch").strip
|
59
|
+
only_mine = get("git config --get pivotal.only-mine").strip
|
44
60
|
|
45
|
-
options[:api_token]
|
46
|
-
options[:project_id]
|
47
|
-
options[:full_name]
|
61
|
+
options[:api_token] = token unless token == ""
|
62
|
+
options[:project_id] = id unless id == ""
|
63
|
+
options[:full_name] = name unless name == ""
|
64
|
+
options[:integration_branch] = integration_branch unless integration_branch == ""
|
65
|
+
options[:only_mine] = (only_mine != "") unless name == ""
|
48
66
|
end
|
49
67
|
|
50
68
|
def parse_argv(*args)
|
@@ -53,11 +71,13 @@ module Commands
|
|
53
71
|
opts.on("-k", "--api-key=", "Pivotal Tracker API key") { |k| options[:api_token] = k }
|
54
72
|
opts.on("-p", "--project-id=", "Pivotal Trakcer project id") { |p| options[:project_id] = p }
|
55
73
|
opts.on("-n", "--full-name=", "Pivotal Trakcer full name") { |n| options[:full_name] = n }
|
74
|
+
opts.on("-b", "--integration-branch=", "The branch to merge finished stories back down onto") { |b| options[:integration_branch] = b }
|
75
|
+
opts.on("-m", "--only-mine", "Only select Pivotal Tracker stories assigned to you") { |m| options[:only_mine] = m }
|
56
76
|
opts.on("-q", "--quiet", "Quiet, no-interaction mode") { |q| options[:quiet] = q }
|
57
77
|
opts.on("-v", "--[no-]verbose", "Run verbosely") { |v| options[:verbose] = v }
|
58
|
-
opts.on_tail("-h", "--help", "This usage guide") { put opts; exit 0 }
|
78
|
+
opts.on_tail("-h", "--help", "This usage guide") { put opts.to_s; exit 0 }
|
59
79
|
end.parse!(args)
|
60
80
|
end
|
61
81
|
|
62
82
|
end
|
63
|
-
end
|
83
|
+
end
|
data/lib/commands/finish.rb
CHANGED
@@ -6,26 +6,17 @@ module Commands
|
|
6
6
|
def run!
|
7
7
|
super
|
8
8
|
|
9
|
-
# clunky way to get branch name... need better method
|
10
|
-
current_branch = get('git status | head -1').gsub(/^.+On branch /, '').chomp
|
11
|
-
story_id = current_branch[/\d+/]
|
12
9
|
unless story_id
|
13
10
|
put "Branch name must contain a Pivotal Tracker story id"
|
14
11
|
return 1
|
15
12
|
end
|
16
13
|
|
17
|
-
api = Pivotal::Api.new(:api_token => options[:api_token])
|
18
|
-
project = api.projects.find(:id => options[:project_id])
|
19
|
-
story = project.stories.find(:id => story_id)
|
20
|
-
|
21
14
|
put "Marking Story #{story_id} as finished..."
|
22
|
-
if story.update_attributes(:current_state =>
|
23
|
-
|
24
|
-
|
25
|
-
put "Merging #{current_branch} into #{target_branch}"
|
26
|
-
sys "git checkout #{target_branch}"
|
15
|
+
if story.update_attributes(:current_state => story.finished_state)
|
16
|
+
put "Merging #{current_branch} into #{integration_branch}"
|
17
|
+
sys "git checkout #{integration_branch}"
|
27
18
|
sys "git merge --no-ff #{current_branch}"
|
28
|
-
|
19
|
+
|
29
20
|
put "Removing #{current_branch} branch"
|
30
21
|
sys "git branch -d #{current_branch}"
|
31
22
|
|
@@ -37,5 +28,19 @@ module Commands
|
|
37
28
|
end
|
38
29
|
end
|
39
30
|
|
31
|
+
protected
|
32
|
+
|
33
|
+
# FIXME: clunky way to get branch name... need better method
|
34
|
+
def current_branch
|
35
|
+
@current_branch ||= get('git status | head -1').gsub(/^.+On branch /, '').chomp
|
36
|
+
end
|
37
|
+
|
38
|
+
def story_id
|
39
|
+
current_branch[/\d+/]
|
40
|
+
end
|
41
|
+
|
42
|
+
def story
|
43
|
+
@story ||= project.stories.find(:id => story_id)
|
44
|
+
end
|
40
45
|
end
|
41
|
-
end
|
46
|
+
end
|
data/lib/commands/pick.rb
CHANGED
@@ -4,26 +4,26 @@ module Commands
|
|
4
4
|
class Pick < Base
|
5
5
|
|
6
6
|
def type
|
7
|
-
raise Error
|
7
|
+
raise Error("must define in subclass")
|
8
8
|
end
|
9
9
|
|
10
10
|
def plural_type
|
11
|
-
raise Error
|
11
|
+
raise Error("must define in subclass")
|
12
12
|
end
|
13
13
|
|
14
14
|
def branch_suffix
|
15
|
-
raise Error
|
15
|
+
raise Error("must define in subclass")
|
16
16
|
end
|
17
17
|
|
18
18
|
def run!
|
19
19
|
super
|
20
|
-
|
21
|
-
put "Retrieving latest #{plural_type} from Pivotal Tracker..."
|
22
|
-
api = Pivotal::Api.new(:api_token => options[:api_token])
|
23
20
|
|
24
|
-
|
25
|
-
|
26
|
-
|
21
|
+
msg = "Retrieving latest #{plural_type} from Pivotal Tracker"
|
22
|
+
if options[:only_mine]
|
23
|
+
msg += " for #{options[:full_name]}"
|
24
|
+
end
|
25
|
+
put "#{msg}..."
|
26
|
+
|
27
27
|
unless story
|
28
28
|
put "No #{plural_type} available!"
|
29
29
|
return 0
|
@@ -57,5 +57,14 @@ module Commands
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
+
protected
|
61
|
+
|
62
|
+
def story
|
63
|
+
return @story if @story
|
64
|
+
|
65
|
+
conditions = { :story_type => type, :current_state => :unstarted }
|
66
|
+
conditions[:owned_by] = options[:full_name] if options[:only_mine]
|
67
|
+
@story = project.stories.find(:conditions => conditions, :limit => 1).first
|
68
|
+
end
|
60
69
|
end
|
61
|
-
end
|
70
|
+
end
|
data/lib/pivotal/base.rb
CHANGED
data/lib/pivotal/story.rb
CHANGED
data/readme.markdown
CHANGED
@@ -6,26 +6,26 @@ You might want to have [this song](http://www.dailymotion.com/video/x9vzh0_olivi
|
|
6
6
|
##Let's Git Pivotal
|
7
7
|
Inspired by [Hashrocket's blend of git and Pivotal Tracker](http://reinh.com/blog/2009/03/02/a-git-workflow-for-agile-teams.html) and [a popular article on effective git workflows](http://nvie.com/archives/323), I set off to create a set of utilities to simplify the workflow between the two.
|
8
8
|
|
9
|
-
###Git
|
10
|
-
The
|
9
|
+
###Git Feature/Bug/Chore
|
10
|
+
The Git Pivotal utility provides three tools to integrate with your Pivotal Tracker project -- `git feature`, `git bug` and `git chore`. These commands collect the top-most available feature, bug or chore (respectively) from your Pivotal Tracker and creates a unique feature branch for it.
|
11
11
|
|
12
|
-
1 git-
|
12
|
+
1 git-pivotal:master % git feature
|
13
13
|
Collecting latest stories from Pivotal Tracker...
|
14
14
|
Story: Test git pivotal
|
15
15
|
URL: http://www.pivotaltracker.com/story/show/1234567
|
16
16
|
Updating story status in Pivotal Tracker...
|
17
17
|
Enter branch name (will be prepended by 1234567) [feature]: testing
|
18
18
|
Creating 1234567-testing branch...
|
19
|
-
2 git-
|
19
|
+
2 git-pivotal:1234567-testing %
|
20
20
|
|
21
21
|
###Git Finish
|
22
|
-
When on a feature branch, this command will close the associated story in Pivotal Tracker, merge the branch into
|
22
|
+
When on a feature branch, this command will close the associated story in Pivotal Tracker, merge the branch into your integration branch (`master` by default) and remove the feature branch.
|
23
23
|
|
24
|
-
3 git-
|
24
|
+
3 git-pivotal:1234567-testing % git finish
|
25
25
|
Marking Story 1234567 as finished...
|
26
|
-
Merging 1234567-testing into
|
26
|
+
Merging 1234567-testing into master
|
27
27
|
Removing 1234567-testing branch
|
28
|
-
4 git-
|
28
|
+
4 git-pivotal:master %
|
29
29
|
|
30
30
|
##Installation
|
31
31
|
To install git-pivotal, simply run
|
@@ -38,6 +38,14 @@ Once installed, git pivotal needs three bits of info: your Pivotal Tracker API T
|
|
38
38
|
git config --global pivotal.api-token 9a9a9a9a9a9a9a9a9a9a
|
39
39
|
git config --global pivotal.full-name "Jeff Tucker"
|
40
40
|
|
41
|
+
If you prefer to merge back to a branch other than master when you've finished a story, you can configure that:
|
42
|
+
|
43
|
+
git config --global pivotal.integration-branch develop
|
44
|
+
|
45
|
+
If you only want to pick up bugs/features/chores that are already assigned to you, set:
|
46
|
+
|
47
|
+
git config --global pivotal.only-mine true
|
48
|
+
|
41
49
|
The project id is best placed within your project's git config:
|
42
50
|
|
43
51
|
git config -f .git/config pivotal.project-id 88888
|
@@ -45,11 +53,13 @@ The project id is best placed within your project's git config:
|
|
45
53
|
If you're not interested in storing these options in git, you can pass them into git pivotal as command line arguments. See the usage guides for more details.
|
46
54
|
|
47
55
|
##TODO
|
48
|
-
This is
|
56
|
+
This is beta software. Several things on the ol' todo list:
|
49
57
|
|
50
58
|
* <del>Create a general Pivotal::Base#update_attributes method</del>
|
51
59
|
* <del>`git pick` doesn't update the story to indicate who claimed it</del>
|
52
60
|
* <del>Add command to close/finish currently 'picked' feature</del>
|
53
61
|
* <del>Reduce verbosity of `git pick`</del>
|
54
|
-
* Allow users to define their development branch name for `git finish
|
62
|
+
* <del>Allow users to define their development branch name for `git finish`</del>
|
63
|
+
* Add option to install git commit hooks which add commit messages to story comments
|
64
|
+
* Drop custom Pivotal API in favor of pivotal-tracker gem
|
55
65
|
* More that I can't recall at the moment
|
data/spec/commands/base_spec.rb
CHANGED
@@ -65,7 +65,28 @@ describe Commands::Base do
|
|
65
65
|
@pick = Commands::Base.new(@input, @output,"--no-verbose")
|
66
66
|
@pick.options[:verbose].should be_false
|
67
67
|
end
|
68
|
-
|
68
|
+
|
69
|
+
it "should set the integration branch with the -b option" do
|
70
|
+
@pick = Commands::Base.new(@input, @output, "-b", "integration")
|
71
|
+
@pick.send(:integration_branch).should == "integration"
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should set the integration branch from git config" do
|
75
|
+
Commands::Base.any_instance.stubs(:get).with("git config --get pivotal.integration-branch").returns("chickens")
|
76
|
+
@pick = Commands::Base.new
|
77
|
+
@pick.send(:integration_branch).should == "chickens"
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should set the integration branch with the --integration-branch= option" do
|
81
|
+
@pick = Commands::Base.new(@input, @output, "--integration-branch=integration")
|
82
|
+
@pick.send(:integration_branch).should == "integration"
|
83
|
+
end
|
84
|
+
|
85
|
+
it "should default the integration branch to master if none is specified" do
|
86
|
+
@pick = Commands::Base.new
|
87
|
+
@pick.send(:integration_branch).should == "master"
|
88
|
+
end
|
89
|
+
|
69
90
|
it "should print a message if the API token is missing" do
|
70
91
|
@output.expects(:print).with("Pivotal Tracker API Token and Project ID are required\n")
|
71
92
|
|
@@ -0,0 +1,131 @@
|
|
1
|
+
require 'commands/finish'
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Commands::Finish do
|
5
|
+
|
6
|
+
def mock_projects
|
7
|
+
if @mock_projects.nil?
|
8
|
+
@mock_projects = mock("mock project list")
|
9
|
+
@mock_projects.stubs(:find).with(:id => mock_project_id).returns(mock_project)
|
10
|
+
end
|
11
|
+
@mock_projects
|
12
|
+
end
|
13
|
+
|
14
|
+
def mock_project_id
|
15
|
+
@mock_project_id ||= '4321'
|
16
|
+
end
|
17
|
+
|
18
|
+
def mock_project
|
19
|
+
if @mock_project.nil?
|
20
|
+
@mock_project = mock("mock project")
|
21
|
+
@mock_project.stubs(:stories).returns(mock_stories)
|
22
|
+
end
|
23
|
+
@mock_project
|
24
|
+
end
|
25
|
+
|
26
|
+
def mock_stories
|
27
|
+
if @mock_stories.nil?
|
28
|
+
@mock_stories = mock("mock story list")
|
29
|
+
@mock_stories.stubs(:find).with(:id => mock_story_id).returns(mock_story)
|
30
|
+
end
|
31
|
+
@mock_stories
|
32
|
+
end
|
33
|
+
|
34
|
+
def mock_story_id
|
35
|
+
@mock_story_id ||= '1234'
|
36
|
+
end
|
37
|
+
|
38
|
+
def mock_story
|
39
|
+
if @mock_story.nil?
|
40
|
+
@mock_story = mock("mock story")
|
41
|
+
end
|
42
|
+
@mock_story
|
43
|
+
end
|
44
|
+
|
45
|
+
before(:each) do
|
46
|
+
# stub out git config requests
|
47
|
+
Commands::Finish.any_instance.stubs(:get).with { |v| v =~ /git config/ }.returns("")
|
48
|
+
|
49
|
+
Pivotal::Api.any_instance.stubs(:projects).returns(mock_projects)
|
50
|
+
|
51
|
+
@finish = Commands::Finish.new(nil, nil, "-p", mock_project_id)
|
52
|
+
@finish.stubs(:sys)
|
53
|
+
@finish.stubs(:put)
|
54
|
+
end
|
55
|
+
|
56
|
+
context "where the branch name does not contain a valid story id" do
|
57
|
+
before(:each) do
|
58
|
+
# stub out git status request to identify the branch
|
59
|
+
branch_name = "invalid-branch-name-without-story-id"
|
60
|
+
Commands::Finish.any_instance.stubs(:get).with { |v| v =~ /git status/ }.returns("# On branch #{branch_name}")
|
61
|
+
end
|
62
|
+
|
63
|
+
it "should return an exit status of one" do
|
64
|
+
@finish.run!.should == 1
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should print an error message" do
|
68
|
+
@finish.expects(:put).with("Branch name must contain a Pivotal Tracker story id").once
|
69
|
+
@finish.run!
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
context "where the branch name does contain a valid story id" do
|
74
|
+
def branch_name
|
75
|
+
"#{mock_story_id}-feature-branch-name"
|
76
|
+
end
|
77
|
+
|
78
|
+
before(:each) do
|
79
|
+
# stub out git status request to identify the branch
|
80
|
+
Commands::Finish.any_instance.stubs(:get).with { |v| v =~ /git status/ }.returns("# On branch #{branch_name}")
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should attempt to update the story status to the stories finished_state" do
|
84
|
+
mock_story.stubs(:finished_state).returns(:finished)
|
85
|
+
mock_story.expects(:update_attributes).with(:current_state => :finished)
|
86
|
+
@finish.run!
|
87
|
+
end
|
88
|
+
|
89
|
+
context "and the story is successfully marked as finished in PT" do
|
90
|
+
before(:each) do
|
91
|
+
mock_story.stubs(:finished_state).returns(:finished)
|
92
|
+
mock_story.stubs(:update_attributes).with(:current_state => :finished).returns(true)
|
93
|
+
end
|
94
|
+
|
95
|
+
it "should succeed with an exist status of zero" do
|
96
|
+
@finish.run!.should == 0
|
97
|
+
end
|
98
|
+
|
99
|
+
it "should checkout the developer's integration branch" do
|
100
|
+
@finish.expects(:sys).with("git checkout master")
|
101
|
+
@finish.run!
|
102
|
+
end
|
103
|
+
|
104
|
+
it "should merge in the story branch" do
|
105
|
+
@finish.expects(:sys).with("git merge --no-ff #{branch_name}")
|
106
|
+
@finish.run!
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should remove the story branch" do
|
110
|
+
@finish.expects(:sys).with("git branch -d #{branch_name}")
|
111
|
+
@finish.run!
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
context "and the story fails to be marked as finished in PT" do
|
116
|
+
before(:each) do
|
117
|
+
mock_story.stubs(:finished_state).returns(:finished)
|
118
|
+
mock_story.stubs(:update_attributes).with(:current_state => :finished).returns(false)
|
119
|
+
end
|
120
|
+
|
121
|
+
it "should fail with an exist status of one" do
|
122
|
+
@finish.run!.should == 1
|
123
|
+
end
|
124
|
+
|
125
|
+
it "should print an error message" do
|
126
|
+
@finish.expects(:put).with("Unable to mark Story #{mock_story_id} as finished").once
|
127
|
+
@finish.run!
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
131
|
+
end
|
data/spec/pivotal/story_spec.rb
CHANGED
@@ -96,5 +96,18 @@ describe Pivotal::Story do
|
|
96
96
|
@story.xml = Factory(:story, :story_type => :feature, :estimate => :unestimated)
|
97
97
|
@story.start!.should be_false
|
98
98
|
end
|
99
|
+
|
100
|
+
it "should return a finished state of accepted for a chore" do
|
101
|
+
@story.xml = story_type "chore"
|
102
|
+
@story.finished_state.should == :accepted
|
103
|
+
end
|
104
|
+
|
105
|
+
["feature", "release", "bug"].each do |type|
|
106
|
+
it "should return a finished state of finished for a #{type}" do
|
107
|
+
@story.xml = story_type type
|
108
|
+
@story.finished_state.should == :finished
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
99
112
|
|
100
113
|
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: git-pivotal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 17
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
9
|
+
- 3
|
10
|
+
version: 0.2.3
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Jeff Tucker
|
@@ -15,16 +16,18 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2010-
|
19
|
+
date: 2010-07-23 00:00:00 -04:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
22
23
|
name: nokogiri
|
23
24
|
prerelease: false
|
24
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
25
27
|
requirements:
|
26
28
|
- - ">="
|
27
29
|
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
28
31
|
segments:
|
29
32
|
- 0
|
30
33
|
version: "0"
|
@@ -34,21 +37,27 @@ dependencies:
|
|
34
37
|
name: rest-client
|
35
38
|
prerelease: false
|
36
39
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
37
41
|
requirements:
|
38
|
-
- -
|
42
|
+
- - ~>
|
39
43
|
- !ruby/object:Gem::Version
|
44
|
+
hash: 7
|
40
45
|
segments:
|
46
|
+
- 1
|
47
|
+
- 4
|
41
48
|
- 0
|
42
|
-
version:
|
49
|
+
version: 1.4.0
|
43
50
|
type: :runtime
|
44
51
|
version_requirements: *id002
|
45
52
|
- !ruby/object:Gem::Dependency
|
46
53
|
name: builder
|
47
54
|
prerelease: false
|
48
55
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
49
57
|
requirements:
|
50
58
|
- - ">="
|
51
59
|
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
52
61
|
segments:
|
53
62
|
- 0
|
54
63
|
version: "0"
|
@@ -58,9 +67,11 @@ dependencies:
|
|
58
67
|
name: rspec
|
59
68
|
prerelease: false
|
60
69
|
requirement: &id004 !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
61
71
|
requirements:
|
62
72
|
- - ">="
|
63
73
|
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
64
75
|
segments:
|
65
76
|
- 0
|
66
77
|
version: "0"
|
@@ -70,9 +81,11 @@ dependencies:
|
|
70
81
|
name: rcov
|
71
82
|
prerelease: false
|
72
83
|
requirement: &id005 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
73
85
|
requirements:
|
74
86
|
- - ">="
|
75
87
|
- !ruby/object:Gem::Version
|
88
|
+
hash: 3
|
76
89
|
segments:
|
77
90
|
- 0
|
78
91
|
version: "0"
|
@@ -82,9 +95,11 @@ dependencies:
|
|
82
95
|
name: mocha
|
83
96
|
prerelease: false
|
84
97
|
requirement: &id006 !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
85
99
|
requirements:
|
86
100
|
- - ">="
|
87
101
|
- !ruby/object:Gem::Version
|
102
|
+
hash: 3
|
88
103
|
segments:
|
89
104
|
- 0
|
90
105
|
version: "0"
|
@@ -133,6 +148,7 @@ files:
|
|
133
148
|
- spec/commands/bug_spec.rb
|
134
149
|
- spec/commands/chore_spec.rb
|
135
150
|
- spec/commands/feature_spec.rb
|
151
|
+
- spec/commands/finish_spec.rb
|
136
152
|
- spec/factories.rb
|
137
153
|
- spec/factory.rb
|
138
154
|
- spec/pivotal/api_spec.rb
|
@@ -142,6 +158,7 @@ files:
|
|
142
158
|
- spec/pivotal/collection_spec.rb
|
143
159
|
- spec/pivotal/project_spec.rb
|
144
160
|
- spec/pivotal/story_spec.rb
|
161
|
+
- spec/spec.opts
|
145
162
|
- spec/spec_helper.rb
|
146
163
|
has_rdoc: true
|
147
164
|
homepage: http://github.com/trydionel/git-pivotal
|
@@ -153,23 +170,27 @@ rdoc_options:
|
|
153
170
|
require_paths:
|
154
171
|
- lib
|
155
172
|
required_ruby_version: !ruby/object:Gem::Requirement
|
173
|
+
none: false
|
156
174
|
requirements:
|
157
175
|
- - ">="
|
158
176
|
- !ruby/object:Gem::Version
|
177
|
+
hash: 3
|
159
178
|
segments:
|
160
179
|
- 0
|
161
180
|
version: "0"
|
162
181
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
|
+
none: false
|
163
183
|
requirements:
|
164
184
|
- - ">="
|
165
185
|
- !ruby/object:Gem::Version
|
186
|
+
hash: 3
|
166
187
|
segments:
|
167
188
|
- 0
|
168
189
|
version: "0"
|
169
190
|
requirements: []
|
170
191
|
|
171
192
|
rubyforge_project:
|
172
|
-
rubygems_version: 1.3.
|
193
|
+
rubygems_version: 1.3.7
|
173
194
|
signing_key:
|
174
195
|
specification_version: 3
|
175
196
|
summary: A collection of git utilities to ease integration with Pivotal Tracker
|
@@ -178,6 +199,7 @@ test_files:
|
|
178
199
|
- spec/commands/bug_spec.rb
|
179
200
|
- spec/commands/chore_spec.rb
|
180
201
|
- spec/commands/feature_spec.rb
|
202
|
+
- spec/commands/finish_spec.rb
|
181
203
|
- spec/factories.rb
|
182
204
|
- spec/factory.rb
|
183
205
|
- spec/pivotal/api_spec.rb
|