git-pivotal 0.2.3 → 0.8.0

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.
Files changed (71) hide show
  1. data/.gitignore +2 -0
  2. data/CHANGELOG +9 -1
  3. data/Rakefile +23 -10
  4. data/VERSION +1 -1
  5. data/bin/git-bug +0 -1
  6. data/bin/git-chore +0 -1
  7. data/bin/git-feature +0 -1
  8. data/bin/git-finish +0 -1
  9. data/bin/git-info +7 -0
  10. data/bin/git-pick +0 -1
  11. data/features/bug.feature +9 -0
  12. data/features/chore.feature +22 -0
  13. data/features/feature.feature +37 -0
  14. data/features/finish.feature +79 -0
  15. data/features/info.feature +39 -0
  16. data/features/step_definitions/steps.rb +18 -0
  17. data/features/support/env.rb +5 -0
  18. data/features/support/git-pivotal.rb +47 -0
  19. data/features/test_repo/readme +1 -0
  20. data/features/test_repo/working.git/COMMIT_EDITMSG +1 -0
  21. data/features/test_repo/working.git/HEAD +1 -0
  22. data/features/test_repo/working.git/config +8 -0
  23. data/features/test_repo/working.git/description +1 -0
  24. data/features/test_repo/working.git/hooks/applypatch-msg.sample +15 -0
  25. data/features/test_repo/working.git/hooks/commit-msg.sample +24 -0
  26. data/features/test_repo/working.git/hooks/post-commit.sample +8 -0
  27. data/features/test_repo/working.git/hooks/post-receive.sample +15 -0
  28. data/features/test_repo/working.git/hooks/post-update.sample +8 -0
  29. data/features/test_repo/working.git/hooks/pre-applypatch.sample +14 -0
  30. data/features/test_repo/working.git/hooks/pre-commit.sample +46 -0
  31. data/features/test_repo/working.git/hooks/pre-rebase.sample +169 -0
  32. data/features/test_repo/working.git/hooks/prepare-commit-msg.sample +36 -0
  33. data/features/test_repo/working.git/hooks/update.sample +128 -0
  34. data/features/test_repo/working.git/index +0 -0
  35. data/features/test_repo/working.git/info/exclude +6 -0
  36. data/features/test_repo/working.git/logs/HEAD +1 -0
  37. data/features/test_repo/working.git/logs/refs/heads/master +1 -0
  38. data/features/test_repo/working.git/objects/0c/6f7b1384910d1a2f137590095f008a06c7e00c +0 -0
  39. data/features/test_repo/working.git/objects/10/ecf2b7ce989f01f3f7266e712b48d9275f2635 +0 -0
  40. data/features/test_repo/working.git/objects/a5/71d56305df09fb060f6ccb730b46080d305beb +0 -0
  41. data/features/test_repo/working.git/refs/heads/master +1 -0
  42. data/git-pivotal.gemspec +49 -38
  43. data/lib/commands/base.rb +19 -9
  44. data/lib/commands/finish.rb +12 -9
  45. data/lib/commands/info.rb +31 -0
  46. data/lib/commands/pick.rb +26 -22
  47. data/lib/git-pivotal.rb +9 -0
  48. data/readme.markdown +13 -0
  49. data/spec/commands/base_spec.rb +20 -1
  50. data/spec/commands/bug_spec.rb +0 -1
  51. data/spec/commands/chore_spec.rb +0 -1
  52. data/spec/commands/feature_spec.rb +0 -1
  53. data/spec/commands/finish_spec.rb +1 -2
  54. data/spec/spec_helper.rb +4 -8
  55. metadata +61 -52
  56. data/lib/pivotal/api.rb +0 -17
  57. data/lib/pivotal/associations.rb +0 -17
  58. data/lib/pivotal/attributes.rb +0 -25
  59. data/lib/pivotal/base.rb +0 -73
  60. data/lib/pivotal/collection.rb +0 -63
  61. data/lib/pivotal/project.rb +0 -14
  62. data/lib/pivotal/story.rb +0 -44
  63. data/lib/pivotal.rb +0 -8
  64. data/spec/pivotal/api_spec.rb +0 -18
  65. data/spec/pivotal/associations_spec.rb +0 -13
  66. data/spec/pivotal/attributes_spec.rb +0 -31
  67. data/spec/pivotal/base_spec.rb +0 -77
  68. data/spec/pivotal/collection_spec.rb +0 -25
  69. data/spec/pivotal/project_spec.rb +0 -34
  70. data/spec/pivotal/story_spec.rb +0 -113
  71. data/spec/spec.opts +0 -1
data/lib/pivotal/story.rb DELETED
@@ -1,44 +0,0 @@
1
- module Pivotal
2
- class Story < Base
3
-
4
- has_attributes :id, :story_type, :url, :estimate, :current_state,
5
- :description, :name, :requested_by, :owned_by,
6
- :created_at, :accepted_at, :labels
7
-
8
- def start!(options = {})
9
- return false if feature? && unestimated?
10
-
11
- update_attributes(options.merge(:current_state => :started))
12
- end
13
-
14
- def feature?
15
- story_type == "feature"
16
- end
17
-
18
- def bug?
19
- story_type == "bug"
20
- end
21
-
22
- def chore?
23
- story_type == "chore"
24
- end
25
-
26
- def release?
27
- story_type == "release"
28
- end
29
-
30
- def unestimated?
31
- estimate == "unestimated"
32
- end
33
-
34
- def finished_state
35
- case story_type
36
- when "chore"
37
- :accepted
38
- else
39
- :finished
40
- end
41
- end
42
-
43
- end
44
- end
data/lib/pivotal.rb DELETED
@@ -1,8 +0,0 @@
1
- require File.join(File.dirname(__FILE__),'pivotal', 'collection')
2
- require File.join(File.dirname(__FILE__),'pivotal', 'associations')
3
- require File.join(File.dirname(__FILE__),'pivotal', 'attributes')
4
-
5
- require File.join(File.dirname(__FILE__),'pivotal','base')
6
- require File.join(File.dirname(__FILE__),'pivotal','story')
7
- require File.join(File.dirname(__FILE__),'pivotal','project')
8
- require File.join(File.dirname(__FILE__),'pivotal','api')
@@ -1,18 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Pivotal::Api do
4
-
5
- before(:each) do
6
- @api = pivotal_api
7
- end
8
-
9
- it "should connect to Pivotal Tracker's API" do
10
- @api.resource.url.should == "https://www.pivotaltracker.com/services/v3"
11
- end
12
-
13
- it "should have a collection of projects" do
14
- @api.projects.should be_a(Pivotal::Collection)
15
- @api.projects.component_class.should == Pivotal::Project
16
- end
17
-
18
- end
@@ -1,13 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Pivotal::Associations do
4
-
5
- it "should load the #has_collection method into a class" do
6
- @base = Object
7
- @base.should_not respond_to(:has_collection)
8
-
9
- @base.send(:include, Pivotal::Associations)
10
- @base.should respond_to(:has_collection)
11
- end
12
-
13
- end
@@ -1,31 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Pivotal::Attributes do
4
-
5
- it "should load the #has_attributes method onto a class" do
6
- @base = Class.new
7
- @base.should_not respond_to(:has_attributes)
8
-
9
- @base.send :include, Pivotal::Attributes
10
- @base.should respond_to(:has_attributes)
11
- end
12
-
13
- it "should add methods specified in #has_attributes to the object" do
14
- @base = Class.new
15
- @base.send :include, Pivotal::Attributes
16
-
17
- @base.new.should_not respond_to(:one)
18
- @base.has_attributes :one
19
- @base.new.should respond_to(:one)
20
- end
21
-
22
- it "should add the attributes specified in #has_attributes to the class #attributes list" do
23
- @base = Class.new
24
- @base.send :include, Pivotal::Attributes
25
-
26
- @base.attributes.should be_nil
27
- @base.has_attributes :one
28
- @base.attributes.should == ["one"]
29
- end
30
-
31
- end
@@ -1,77 +0,0 @@
1
- require 'spec_helper'
2
- require 'nokogiri'
3
-
4
- describe Pivotal::Base do
5
-
6
- before(:each) do
7
- @base = pivotal_api
8
- @response = mock("response")
9
- @response.stubs(:body => "<xml>Some XML String</xml>")
10
- end
11
-
12
- it "should expose a REST resource" do
13
- @base.resource.should be_a(RestClient::Resource)
14
- end
15
-
16
- it "should expose the resource's XML" do
17
- @base.resource.expects(:get).returns(@response)
18
- @base.xml.should be_a(String)
19
- end
20
-
21
- it "should expose the resource's XML parse tree" do
22
- @base.resource.expects(:get).returns(@response)
23
- @base.parsed_resource.should be_a(Nokogiri::XML::Document)
24
- end
25
-
26
- it "should present the class's item xpath" do
27
- @base.class.xpath.should == "//api"
28
- end
29
-
30
- it "should expose association methods" do
31
- @base.class.should include(Pivotal::Associations)
32
- end
33
-
34
- describe "updating the remote resource" do
35
-
36
- before(:each) do
37
- @xml = "<api><current_state>started</current_state></api>"
38
- @response.stubs(:code).returns(200)
39
- @response.stubs(:body).returns(@xml)
40
-
41
- @base.resource.expects(:put).with(@xml).yields(@response)
42
- @base.class.has_attributes :current_state
43
- end
44
-
45
- it "should be able to update the remote resource with a hash of string values" do
46
- @base.update_attributes(:current_state => "started")
47
- end
48
-
49
- it "should be able to update the remote resource with a hash of symbol values" do
50
- @base.update_attributes(:current_state => :started)
51
- end
52
-
53
- it "should not update attributes which don't exist on the remote model" do
54
- @base.update_attributes(:current_state => :started, :unknown_attribute => true)
55
- end
56
-
57
- it "should update the stored xml with the new remote model" do
58
- pending("not sure what changed here, but it needs to be fixed") do
59
- @base.resource.stubs(:get => @response)
60
- lambda {
61
- @base.update_attributes(:current_state => "started")
62
- }.should change(@base, :xml).to(@response.body)
63
- end
64
- end
65
-
66
- it "should return true if the response code is 200" do
67
- @base.update_attributes(:current_state => :started).should == true
68
- end
69
-
70
- it "should return false if the response code is not 200" do
71
- @response.stubs(:code).returns(422)
72
- @base.update_attributes(:current_state => :started).should == false
73
- end
74
-
75
- end
76
-
77
- end
@@ -1,25 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Pivotal::Collection do
4
-
5
- before(:each) do
6
- @api = pivotal_api
7
- response = mock("response")
8
- response.stubs(:body => "<project><id>1</id></project>")
9
- RestClient::Resource.any_instance.stubs(:get).returns(response)
10
- end
11
-
12
- it "should find a single item given an id" do
13
- @api.projects.find(1).should be_a(Pivotal::Project)
14
- end
15
-
16
- it "should find a collection of items giving a set of conditions" do
17
- @api.projects.find(:all).should be_a(Array)
18
- @api.projects.first.should be_a(Pivotal::Project)
19
- end
20
-
21
- it "should return the first item of a collection" do
22
- @api.projects.first.should be_a(Pivotal::Project)
23
- end
24
-
25
- end
@@ -1,34 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Pivotal::Project do
4
-
5
- before(:each) do
6
- @project = Pivotal::Project.new :resource => pivotal_api.resource["projects"][1]
7
- end
8
-
9
- it "should be connected to the project resource" do
10
- @project.resource.url.should == "https://www.pivotaltracker.com/services/v3/projects/1"
11
- end
12
-
13
- it "should have a collection of stories" do
14
- @project.stories.should be_a(Pivotal::Collection)
15
- @project.stories.component_class.should == Pivotal::Story
16
- end
17
-
18
- [:id, :name, :iteration_length, :week_start_day,
19
- :point_scale, :account, :velocity_scheme,
20
- :current_velocity, :initial_velocity,
21
- :number_of_iterations_to_show, :labels,
22
- :allow_attachments, :public, :use_https,
23
- :bugs_and_chores_are_estimatable, :commit_mode,
24
- :last_activity_at, :memberships, :integrations].map(&:to_s).each do |method|
25
- it "should have an accessor method for #{method}" do
26
- @project.methods.should include(method)
27
- end
28
-
29
- it "should include #{method} in the list of valid attributes" do
30
- @project.class.attributes.should include(method)
31
- end
32
- end
33
-
34
- end
@@ -1,113 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Pivotal::Story do
4
-
5
- def story_type(type = "feature")
6
- Factory(:story, :story_type => type)
7
- end
8
-
9
- before(:each) do
10
- @story = Pivotal::Story.new :resource => pivotal_api.resource["projects"][1]["stories"][1]
11
- @response = mock("response")
12
- @response.stubs(:body => "")
13
- end
14
-
15
- it "should be connected to the story resource" do
16
- @story.resource.url.should == "https://www.pivotaltracker.com/services/v3/projects/1/stories/1"
17
- end
18
-
19
- [:id, :story_type, :url, :estimate, :current_state,
20
- :description, :name, :requested_by, :owned_by,
21
- :created_at, :accepted_at, :labels].map(&:to_s).each do |method|
22
- it "should have an accessor method for #{method}" do
23
- @story.methods.should include(method)
24
- end
25
-
26
- it "should include #{method} in the list of valid attributes" do
27
- @story.class.attributes.should include(method)
28
- end
29
-
30
- it "should return the proper value when #{method} is called" do
31
- @story.xml = Factory(:story, method.to_sym => "Test Result")
32
- @story.send(method).should == "Test Result"
33
- end
34
- end
35
-
36
- it "should specify whether the story is a feature" do
37
- @story.xml = story_type "feature"
38
-
39
- @story.should be_a_feature
40
- @story.should_not be_a_bug
41
- @story.should_not be_a_chore
42
- @story.should_not be_a_release
43
- end
44
-
45
- it "should specify whether the story is a bug" do
46
- @story.xml = story_type "bug"
47
-
48
- @story.should_not be_a_feature
49
- @story.should be_a_bug
50
- @story.should_not be_a_chore
51
- @story.should_not be_a_release
52
- end
53
-
54
- it "should specify whether the story is a chore" do
55
- @story.xml = story_type "chore"
56
-
57
- @story.should_not be_a_feature
58
- @story.should_not be_a_bug
59
- @story.should be_a_chore
60
- @story.should_not be_a_release
61
- end
62
-
63
- it "should specify whether the story is a release" do
64
- @story.xml = story_type "release"
65
-
66
- @story.should_not be_a_feature
67
- @story.should_not be_a_bug
68
- @story.should_not be_a_chore
69
- @story.should be_a_release
70
- end
71
-
72
- it "should be able to mark the story as started" do
73
- @story.resource.stubs(:get => @response)
74
-
75
- @xpath = "//current_state = 'started'"
76
- @story.resource.expects(:put).with { |xml| Nokogiri::XML(xml).xpath(@xpath) }
77
- @story.start!
78
- end
79
-
80
- it "should be able to update other attributes when marking the story as started" do
81
- @story.resource.stubs(:get => @response)
82
-
83
- # Check the XML contains the right options.
84
- # Can't just check the XML string, because the elements may be in a
85
- # different order (because it's built from a hash).
86
- @xpath = "//current_state = 'started' and //owned_by = 'Jeff Tucker'"
87
- @story.resource.expects(:put).with {|xml| Nokogiri.XML(xml).xpath(@xpath) }
88
- @story.start!(:owned_by => "Jeff Tucker")
89
- end
90
-
91
- it "should return false if attempting to start an unestimated feature story" do
92
- # bad_response = mock("Response")
93
- # bad_response.stubs(:code).returns(422)
94
- # RestClient::Resource.any_instance.stubs(:put).yields(bad_response)
95
-
96
- @story.xml = Factory(:story, :story_type => :feature, :estimate => :unestimated)
97
- @story.start!.should be_false
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
-
112
-
113
- end
data/spec/spec.opts DELETED
@@ -1 +0,0 @@
1
- --color