git-pivotal-tracker 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/.gitignore +5 -0
  2. data/.rspec +2 -0
  3. data/.rvmrc +1 -0
  4. data/.travis.yml +3 -0
  5. data/CHANGELOG +45 -0
  6. data/Gemfile +3 -0
  7. data/Gemfile.lock +74 -0
  8. data/LICENSE +21 -0
  9. data/Rakefile +24 -0
  10. data/VERSION +1 -0
  11. data/bin/git-accept +7 -0
  12. data/bin/git-block +7 -0
  13. data/bin/git-finish +7 -0
  14. data/bin/git-info +7 -0
  15. data/bin/git-start +8 -0
  16. data/bin/git-unblock +7 -0
  17. data/features/accept.feature +140 -0
  18. data/features/block.feature +94 -0
  19. data/features/finish.feature +119 -0
  20. data/features/info.feature +99 -0
  21. data/features/start.feature +113 -0
  22. data/features/step_definitions/steps.rb +114 -0
  23. data/features/support/dsl/assertions.rb +11 -0
  24. data/features/support/dsl/data.rb +11 -0
  25. data/features/support/dsl/pivotal.rb +76 -0
  26. data/features/support/env.rb +6 -0
  27. data/features/support/git-pivotal.rb +69 -0
  28. data/features/test_repo/origin.git/COMMIT_EDITMSG +1 -0
  29. data/features/test_repo/origin.git/HEAD +1 -0
  30. data/features/test_repo/origin.git/config +8 -0
  31. data/features/test_repo/origin.git/description +1 -0
  32. data/features/test_repo/origin.git/hooks/applypatch-msg.sample +15 -0
  33. data/features/test_repo/origin.git/hooks/commit-msg.sample +24 -0
  34. data/features/test_repo/origin.git/hooks/post-commit.sample +8 -0
  35. data/features/test_repo/origin.git/hooks/post-receive.sample +15 -0
  36. data/features/test_repo/origin.git/hooks/post-update.sample +8 -0
  37. data/features/test_repo/origin.git/hooks/pre-applypatch.sample +14 -0
  38. data/features/test_repo/origin.git/hooks/pre-commit.sample +46 -0
  39. data/features/test_repo/origin.git/hooks/pre-rebase.sample +169 -0
  40. data/features/test_repo/origin.git/hooks/prepare-commit-msg.sample +36 -0
  41. data/features/test_repo/origin.git/hooks/update.sample +128 -0
  42. data/features/test_repo/origin.git/index +0 -0
  43. data/features/test_repo/origin.git/info/exclude +6 -0
  44. data/features/test_repo/origin.git/logs/HEAD +1 -0
  45. data/features/test_repo/origin.git/logs/refs/heads/master +1 -0
  46. data/features/test_repo/origin.git/objects/0c/6f7b1384910d1a2f137590095f008a06c7e00c +0 -0
  47. data/features/test_repo/origin.git/objects/10/ecf2b7ce989f01f3f7266e712b48d9275f2635 +0 -0
  48. data/features/test_repo/origin.git/objects/a5/71d56305df09fb060f6ccb730b46080d305beb +0 -0
  49. data/features/test_repo/origin.git/refs/heads/master +1 -0
  50. data/features/test_repo/readme +1 -0
  51. data/features/unblock.feature +68 -0
  52. data/git-pivotal-tracker.gemspec +27 -0
  53. data/lib/commands/accept.rb +76 -0
  54. data/lib/commands/base.rb +128 -0
  55. data/lib/commands/block.rb +59 -0
  56. data/lib/commands/bug.rb +19 -0
  57. data/lib/commands/card.rb +32 -0
  58. data/lib/commands/chore.rb +19 -0
  59. data/lib/commands/feature.rb +19 -0
  60. data/lib/commands/finish.rb +59 -0
  61. data/lib/commands/info.rb +58 -0
  62. data/lib/commands/map.rb +10 -0
  63. data/lib/commands/pick.rb +76 -0
  64. data/lib/commands/start.rb +35 -0
  65. data/lib/commands/unblock.rb +55 -0
  66. data/lib/git-pivotal-tracker.rb +11 -0
  67. data/readme.markdown +95 -0
  68. data/spec/commands/base_spec.rb +151 -0
  69. data/spec/commands/bug_spec.rb +24 -0
  70. data/spec/commands/chore_spec.rb +24 -0
  71. data/spec/commands/feature_spec.rb +24 -0
  72. data/spec/commands/finish_spec.rb +125 -0
  73. data/spec/commands/map_spec.rb +14 -0
  74. data/spec/commands/start_spec.rb +29 -0
  75. data/spec/factories.rb +13 -0
  76. data/spec/factory.rb +26 -0
  77. data/spec/spec_helper.rb +24 -0
  78. metadata +251 -0
@@ -0,0 +1,5 @@
1
+ pkg
2
+ coverage
3
+ *.gem
4
+ *.swp
5
+ tmp
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/.rvmrc ADDED
@@ -0,0 +1 @@
1
+ rvm use 1.9.3
@@ -0,0 +1,3 @@
1
+ rvm:
2
+ - 1.9.2
3
+ - 1.9.3
@@ -0,0 +1,45 @@
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
+
6
+ v 0.8.0
7
+ - Drop home-rolled PivotalTracker API for pivotal-tracker gem
8
+ - Add Gemfile for easier development
9
+ - Add better test suite with Cucumber and Aruba
10
+ - Add option for appending the branch name (rather than prepending) [Addy
11
+ Naik]
12
+ - Add new `git info` command [Addy Naik]
13
+
14
+ v 0.2.3
15
+ - Allow the developer to specify the integration branch for git finish [Graeme Mathieson]
16
+ - Fixed bug which prevented chores from finishing successfully [Joshua Vial]
17
+ - Added option to allow only pickup items already assigned to you [Mark Butcher]
18
+ - Fix RestClient version issues
19
+
20
+ v 0.2.2
21
+ - Added git chore command
22
+
23
+ v 0.2.1
24
+ - Remove &:to_s shortcut for MRI 1.8.6 compatibility
25
+ - Updated to handle RestClient 1.4
26
+
27
+ v 0.2.0
28
+ - Added git feature and git bug commands
29
+ - Deprecated git feature
30
+ - Improved XPath reliability for Pivotal API requests [Sam Stokes]
31
+
32
+ v 0.1.3
33
+ - Fixed bug preventing command line args from being properly interpretted
34
+
35
+ v 0.1.2
36
+ - Fixed bug introduced in v 0.1.1 which prevented git pick from completing
37
+
38
+ v 0.1.1
39
+ - Updated git pick to tell Pivotal who owns the picked feature
40
+ - Improved Pivotal Tracker framework write ability
41
+
42
+ v 0.1.0
43
+ - Initial release
44
+ - Basic framework for reading from Pivotal Tracker
45
+ - git pick utility
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "http://rubygems.org"
2
+
3
+ gemspec
@@ -0,0 +1,74 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ git-pivotal-tracker (0.9.0)
5
+ pivotal-tracker
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ aruba (0.4.11)
11
+ childprocess (>= 0.2.3)
12
+ cucumber (>= 1.1.1)
13
+ ffi (>= 1.0.11)
14
+ rspec (>= 2.7.0)
15
+ builder (3.0.0)
16
+ childprocess (0.3.1)
17
+ ffi (~> 1.0.6)
18
+ cucumber (1.1.9)
19
+ builder (>= 2.1.2)
20
+ diff-lcs (>= 1.1.2)
21
+ gherkin (~> 2.9.0)
22
+ json (>= 1.4.6)
23
+ term-ansicolor (>= 1.0.6)
24
+ diff-lcs (1.1.3)
25
+ ffi (1.0.11)
26
+ gherkin (2.9.3)
27
+ json (>= 1.4.6)
28
+ happymapper (0.4.0)
29
+ libxml-ruby (~> 2.0)
30
+ json (1.6.6)
31
+ libxml-ruby (2.3.2)
32
+ metaclass (0.0.1)
33
+ mime-types (1.18)
34
+ mocha (0.10.5)
35
+ metaclass (~> 0.0.1)
36
+ multi_json (1.2.0)
37
+ nokogiri (1.5.2)
38
+ pivotal-tracker (0.5.1)
39
+ builder
40
+ builder
41
+ happymapper (>= 0.3.2)
42
+ happymapper (>= 0.3.2)
43
+ nokogiri (>= 1.4.3)
44
+ nokogiri (~> 1.4)
45
+ rest-client (~> 1.6.0)
46
+ rest-client (~> 1.6.0)
47
+ rake (0.9.2.2)
48
+ rest-client (1.6.7)
49
+ mime-types (>= 1.16)
50
+ rspec (2.9.0)
51
+ rspec-core (~> 2.9.0)
52
+ rspec-expectations (~> 2.9.0)
53
+ rspec-mocks (~> 2.9.0)
54
+ rspec-core (2.9.0)
55
+ rspec-expectations (2.9.0)
56
+ diff-lcs (~> 1.1.3)
57
+ rspec-mocks (2.9.0)
58
+ simplecov (0.6.1)
59
+ multi_json (~> 1.0)
60
+ simplecov-html (~> 0.5.3)
61
+ simplecov-html (0.5.3)
62
+ term-ansicolor (1.0.7)
63
+
64
+ PLATFORMS
65
+ ruby
66
+
67
+ DEPENDENCIES
68
+ aruba
69
+ cucumber
70
+ git-pivotal-tracker!
71
+ mocha
72
+ rake
73
+ rspec
74
+ simplecov
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) 2010 Jeff Tucker
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,24 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ $LOAD_PATH.unshift('lib')
5
+
6
+ task :default => [:spec, :features]
7
+
8
+ begin
9
+ require 'rspec/core/rake_task'
10
+ RSpec::Core::RakeTask.new do |t|
11
+ t.rspec_opts = ['--color']
12
+ end
13
+ rescue LoadError => e
14
+ puts "RSpec not installed"
15
+ end
16
+
17
+ begin
18
+ require 'cucumber/rake/task'
19
+ Cucumber::Rake::Task.new(:features) do |t|
20
+ t.cucumber_opts = "features --format pretty"
21
+ end
22
+ rescue LoadError => e
23
+ puts "Cucumber not installed"
24
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.9.0
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'commands/accept'
6
+
7
+ exit Commands::Accept.new(*ARGV).with(STDIN, STDOUT).run!
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'commands/block'
6
+
7
+ exit Commands::Block.new(*ARGV).with(STDIN, STDOUT).run!
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'commands/finish'
6
+
7
+ exit Commands::Finish.new(*ARGV).with(STDIN, STDOUT).run!
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'commands/info'
6
+
7
+ exit Commands::Info.new(*ARGV).with(STDIN, STDOUT).run!
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'commands/start'
6
+
7
+ args = ARGV
8
+ exit Commands::Start.for(*ARGV).with(STDIN, STDOUT).run!
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
4
+
5
+ require 'commands/unblock'
6
+
7
+ exit Commands::Unblock.new(*ARGV).with(STDIN, STDOUT).run!
@@ -0,0 +1,140 @@
1
+ Feature: git accept
2
+
3
+ In order to accept a card the following commands:
4
+
5
+ git accept
6
+ git accept <options>
7
+
8
+ Supported options:
9
+ -k <api_key> - specify the Pivotal API key to use. Overrides configuration.
10
+ -p <project_id> - specify the Pivotal project id to use. Overrides configuration.
11
+
12
+ This will do the following:
13
+ * mark the card as accepted in Pivotal
14
+ * push the topic branch to origin
15
+ * switch to main integration branch, run git pull, then merge in topic branch
16
+ * push main integration branch
17
+ * (TODO) delete topic branch is everything previously was done cleanly
18
+
19
+ Related git configuration settings:
20
+ * pivotal.integration-branch - this is where accepted cards are merged. Defaults to master.
21
+
22
+ Background:
23
+ Given I have a finished Pivotal Tracker feature
24
+ And I am on the "CURRENT_CARD-feature" branch
25
+
26
+ Scenario: Executing with no settings
27
+ When I run `git-accept`
28
+ Then the output should contain:
29
+ """
30
+ Pivotal Tracker API Token and Project ID are required
31
+ """
32
+ And the exit status should be 1
33
+
34
+ Scenario: Executing with inline settings
35
+ When I run `git-accept -k PIVOTAL_API_KEY -p PIVOTAL_TEST_PROJECT`
36
+ Then the output should contain:
37
+ """
38
+ Marking Story CURRENT_CARD as accepted...
39
+ Pushing CURRENT_CARD-feature to origin
40
+ Pulling master...
41
+ Merging CURRENT_CARD-feature into master
42
+ Pushing master to origin
43
+ Now on master.
44
+ """
45
+ And I should be on the "master" branch
46
+
47
+ Scenario: Executing with git configuration
48
+ Given a file named ".gitconfig" with:
49
+ """
50
+ [pivotal]
51
+ api-token = PIVOTAL_API_KEY
52
+ full-name = PIVOTAL_USER
53
+ project-id = PIVOTAL_TEST_PROJECT
54
+ """
55
+ When I run `git-accept -k PIVOTAL_API_KEY -p PIVOTAL_TEST_PROJECT`
56
+ Then the output should contain:
57
+ """
58
+ Marking Story CURRENT_CARD as accepted...
59
+ Pushing CURRENT_CARD-feature to origin
60
+ Pulling master...
61
+ Merging CURRENT_CARD-feature into master
62
+ Pushing master to origin
63
+ Now on master.
64
+ """
65
+ And I should be on the "master" branch
66
+
67
+ Scenario: Executing from a misnamed branch
68
+ Given I am on the "missing-an-id" branch
69
+ When I run `git-accept -k PIVOTAL_API_KEY -p PIVOTAL_TEST_PROJECT`
70
+ Then the output should contain:
71
+ """
72
+ Branch name must contain a Pivotal Tracker story id
73
+ """
74
+ And the exit status should be 1
75
+
76
+ Scenario: Specifying an integration branch in Git configuration
77
+ Given I have a "release" branch
78
+ And a file named ".gitconfig" with:
79
+ """
80
+ [pivotal]
81
+ api-token = PIVOTAL_API_KEY
82
+ full-name = PIVOTAL_USER
83
+ integration-branch = release
84
+ project-id = PIVOTAL_TEST_PROJECT
85
+ """
86
+ When I run `git-accept -k PIVOTAL_API_KEY -p PIVOTAL_TEST_PROJECT`
87
+ Then the output should contain:
88
+ """
89
+ Marking Story CURRENT_CARD as accepted...
90
+ Pushing CURRENT_CARD-feature to origin
91
+ Pulling release...
92
+ Merging CURRENT_CARD-feature into release
93
+ Pushing release to origin
94
+ Now on release.
95
+ """
96
+ And I should be on the "release" branch
97
+
98
+ Scenario Outline: Accepting cards in an acceptable state
99
+ Given I have configured the Git repos for Pivotal
100
+ And the card is a <card_type>
101
+ And the <card_type> is <card_state>
102
+ When I run `git-accept -k PIVOTAL_API_KEY -p PIVOTAL_TEST_PROJECT`
103
+ Then the output should contain:
104
+ """
105
+ Marking Story CURRENT_CARD as accepted...
106
+ Pushing CURRENT_CARD-feature to origin
107
+ Pulling master...
108
+ Merging CURRENT_CARD-feature into master
109
+ Pushing master to origin
110
+ Now on master.
111
+ """
112
+ And I should be on the "master" branch
113
+
114
+ Examples:
115
+ | card_type | card_state |
116
+ | chore | accepted |
117
+ | bug | finished |
118
+ | bug | delivered |
119
+ | feature | finished |
120
+ | feature | delivered |
121
+
122
+ Scenario Outline: You can't accept cards that aren't ready to be accepted
123
+ Given I have configured the Git repos for Pivotal
124
+ And the card is a <card_type>
125
+ And the <card_type> is <card_state>
126
+ When I run `git-accept -k PIVOTAL_API_KEY -p PIVOTAL_TEST_PROJECT`
127
+ Then the output should contain:
128
+ """
129
+ Story is not in an acceptable state. It's currently <card_state>.
130
+ """
131
+ And I should be on the "CURRENT_CARD-feature" branch
132
+
133
+ Examples:
134
+ | card_type | card_state |
135
+ | bug | unstarted |
136
+ | bug | started |
137
+ | chore | unstarted |
138
+ | feature | unstarted |
139
+ | feature | started |
140
+ | feature | rejected |
@@ -0,0 +1,94 @@
1
+ Feature: git block
2
+
3
+ In order to get information about a specific card you can issue one of the following
4
+ commands:
5
+
6
+ git block
7
+ git block <options>
8
+ git block <card_id>
9
+ git block <card_id> <options>
10
+
11
+ Supported options:
12
+ -m <message> - specify the reason why this is blocked. If not present, will be prompted. Adds this message to the comment as an activity.
13
+ -k <api_key> - specify the Pivotal API key to use. Overrides configuration.
14
+ -p <project_id> - specify the Pivotal project id to use. Overrides configuration.
15
+
16
+ Background:
17
+ Given I have a Pivotal Tracker feature named "Test Story" with description "This is the description!"
18
+ And I am on the "CURRENT_CARD-feature" branch
19
+
20
+ Scenario: Executing with no settings
21
+ When I run `git-block`
22
+ Then the output should contain:
23
+ """
24
+ Pivotal Tracker API Token and Project ID are required
25
+ """
26
+ And the exit status should be 1
27
+
28
+ Scenario: Blocking the current topic branch with a message argument
29
+ Given I have configured the Git repos for Pivotal
30
+ When I run `git-block -m "We need more information"`
31
+ Then the output should contain "Story CURRENT_CARD has been blocked."
32
+ When the current card is refreshed
33
+ Then the card CURRENT_CARD should have the "blocked" label
34
+ And the card CURRENT_CARD should have the comment by "PIVOTAL_USER":
35
+ """
36
+ Blocked: We need more information
37
+ """
38
+
39
+ Scenario: Blocking the current topic branch and being prompted for a message
40
+ Given I have configured the Git repos for Pivotal
41
+ When I run `git-block` interactively
42
+ When I type "We need more information"
43
+ Then the output should contain "Story CURRENT_CARD has been blocked."
44
+ When the current card is refreshed
45
+ Then the card CURRENT_CARD should have the "blocked" label
46
+ And the card CURRENT_CARD should have the comment by "PIVOTAL_USER":
47
+ """
48
+ Blocked: We need more information
49
+ """
50
+
51
+ Scenario: Blocking a specific card with a message argument
52
+ Given I have configured the Git repos for Pivotal
53
+ When I run `git-block CURRENT_CARD -m "We need more information"`
54
+ Then the output should contain "Story CURRENT_CARD has been blocked."
55
+ When the current card is refreshed
56
+ Then the card CURRENT_CARD should have the "blocked" label
57
+ And the card CURRENT_CARD should have the comment by "PIVOTAL_USER":
58
+ """
59
+ Blocked: We need more information
60
+ """
61
+
62
+ Scenario: Blocking a specific card and being prompted for a message
63
+ Given I have configured the Git repos for Pivotal
64
+ When I run `git-block CURRENT_CARD` interactively
65
+ When I type "We need more information"
66
+ Then the output should contain "Story CURRENT_CARD has been blocked."
67
+ When the current card is refreshed
68
+ Then the card CURRENT_CARD should have the "blocked" label
69
+ And the card CURRENT_CARD should have the comment by "PIVOTAL_USER":
70
+ """
71
+ Blocked: We need more information
72
+ """
73
+
74
+ Scenario: Blocking a card that is already blocked
75
+ Given I have configured the Git repos for Pivotal
76
+ And the card is labeled "blocked"
77
+ When I run `git-block CURRENT_CARD -m "We need more information"`
78
+ Then the output should contain "Story CURRENT_CARD is already blocked."
79
+ When the current card is refreshed
80
+ Then the card CURRENT_CARD should not have the comment:
81
+ """
82
+ Blocked: We need more information
83
+ """
84
+
85
+ Scenario: Trying to block when not on a topic branch and not supplying a card id
86
+ Given I have configured the Git repos for Pivotal
87
+ And I am on the "foo" branch
88
+ Then I should be on the "foo" branch
89
+ When I run `git-block -m "this will fail"`
90
+ Then the output should contain:
91
+ """
92
+ No story id was supplied and you aren't on a topic branch!
93
+ """
94
+