pivotal-github 0.6.12 → 0.6.14

Sign up to get free protection for your applications and to get access to all the features.
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ pivotal-github
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-1.9.3-p392
data/README.md CHANGED
@@ -78,6 +78,17 @@ The purpose of `git story-pull` is to prepare the local story branch for rebasin
78
78
 
79
79
  but I don't like having `master` and `origin/master` be different since that means you have to remember to run `git pull` on `master` some time down the line.)
80
80
 
81
+ If you've already pushed the story, you'll have to force a subsequent push using
82
+
83
+ $ git push --force
84
+
85
+ If someone else might already have pulled the branch, you should probably merge `master` instead of rebasing against it:
86
+
87
+ $ git story-push
88
+ $ git story-pull
89
+ $ git merge master
90
+
91
+
81
92
  #### Options
82
93
 
83
94
  Usage: git story-pull [options]
@@ -183,7 +194,9 @@ Here's the process in detail:
183
194
  4. Rebase against `master` using `git story-pull` followed by `git rebase master` or `git rebase master --interactive` (optionally squashing commit messages as described in the article [A Git Workflow for Agile Teams](http://reinh.com/blog/2009/03/02/a-git-workflow-for-agile-teams.html))
184
195
  4. Push up with `git push`
185
196
  6. At the GitHub page for the repo, select **Branches** and submit a pull request
186
- 7. Go the story at Pivotal Tracker and change the **Owner** to Developer #2 (Bob)
197
+ 6. (On OS X, replace the previous two steps with `git story-pull-request`)
198
+ 6. Assign the pull request to Bob at GitHub
199
+ 7. On the Pivotal Tracker story, change the **Owner** to Developer #2 (Bob) and add a comment with the pull request URL
187
200
  8. Continue working, taking care to branch off of the current story branch if its changes are required to continue
188
201
 
189
202
  Rather than immediately submitting a pull request, Alice can also continue by branching off the previous story branch, working on a set of related features, and then issue Bob a pull request for the final branch when she reaches a natural stopping place.
data/bin/git-story-commit CHANGED
@@ -2,4 +2,4 @@
2
2
  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
3
  require 'pivotal-github/story_commit'
4
4
 
5
- exit Command.run!(StoryCommit, ARGV.dup)
5
+ exit Command.run!(StoryCommit, ARGV.dup)
data/bin/git-story-merge CHANGED
@@ -2,4 +2,4 @@
2
2
  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
3
  require 'pivotal-github/story_merge'
4
4
 
5
- exit Command.run!(StoryMerge, ARGV.dup)
5
+ exit Command.run!(StoryMerge, ARGV.dup)
data/bin/git-story-pull CHANGED
@@ -2,4 +2,4 @@
2
2
  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
3
  require 'pivotal-github/story_pull'
4
4
 
5
- exit Command.run!(StoryPull, ARGV.dup)
5
+ exit Command.run!(StoryPull, ARGV.dup)
@@ -2,4 +2,4 @@
2
2
  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
3
  require 'pivotal-github/story_pull_request'
4
4
 
5
- exit Command.run!(StoryPullRequest, ARGV.dup)
5
+ exit Command.run!(StoryPullRequest, ARGV.dup)
data/bin/git-story-push CHANGED
@@ -2,4 +2,4 @@
2
2
  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
3
  require 'pivotal-github/story_push'
4
4
 
5
- exit Command.run!(StoryPush, ARGV.dup)
5
+ exit Command.run!(StoryPush, ARGV.dup)
data/bin/story-open CHANGED
@@ -2,4 +2,4 @@
2
2
  $LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
3
3
  require 'pivotal-github/story_open'
4
4
 
5
- exit Command.run!(StoryOpen, ARGV.dup)
5
+ exit Command.run!(StoryOpen, ARGV.dup)
@@ -29,9 +29,9 @@ class Command
29
29
  story_branch.scan(/\d+/).first
30
30
  end
31
31
 
32
- # Runs a command
32
+ # Runs a command.
33
33
  # If the argument array contains '--debug', returns the command that would
34
- # have been run
34
+ # have been run.
35
35
  def self.run!(command_class, args)
36
36
  debug = args.delete('--debug')
37
37
  command = command_class.new(args)
@@ -46,7 +46,7 @@ class Command
46
46
 
47
47
  private
48
48
 
49
- # Returns an argument string based on given arguments
49
+ # Returns an argument string based on given arguments.
50
50
  # The main trick is to add in quotes for option
51
51
  # arguments when necessary.
52
52
  # For example, ['-a', '-m', 'foo bar'] becomes
@@ -6,17 +6,17 @@ class StoryCommit < Command
6
6
  OptionParser.new do |opts|
7
7
  opts.banner = "Usage: git story-commit [options]"
8
8
  opts.on("-m", "--message MESSAGE",
9
- "add a commit message (including story #)") do |m|
10
- self.options.message = m
9
+ "add a commit message (including story #)") do |opt|
10
+ self.options.message = opt
11
11
  end
12
- opts.on("-f", "--finish", "mark story as finished") do |f|
13
- self.options.finish = f
12
+ opts.on("-f", "--finish", "mark story as finished") do |opt|
13
+ self.options.finish = opt
14
14
  end
15
- opts.on("-d", "--deliver", "mark story as delivered") do |d|
16
- self.options.deliver = d
15
+ opts.on("-d", "--deliver", "mark story as delivered") do |opt|
16
+ self.options.deliver = opt
17
17
  end
18
- opts.on("-a", "--all", "commit all changed files") do |a|
19
- self.options.all = a
18
+ opts.on("-a", "--all", "commit all changed files") do |opt|
19
+ self.options.all = opt
20
20
  end
21
21
  opts.on_tail("-h", "--help", "this usage guide") do
22
22
  puts opts.to_s; exit 0
@@ -40,7 +40,7 @@ class StoryCommit < Command
40
40
  end
41
41
  end
42
42
 
43
- # Returns a command appropriate for executing at the command line
43
+ # Returns a command appropriate for executing at the command line.
44
44
  # We take care to insert the story number and, if necessary, an indication
45
45
  # that the commit finishes the story.
46
46
  def cmd
@@ -34,12 +34,19 @@ class StoryPullRequest < FinishedCommand
34
34
 
35
35
  private
36
36
 
37
- # Returns the remote URI for the repository
38
- # E.g., https://github.com/mhartl/pivotal-github
39
- def origin_uri
37
+ # Returns the raw remote location for the repository.
38
+ # E.g., http://github.com/mhartl/pivotal-github or
39
+ # git@github.com:mhartl/pivotal-github
40
+ def remote_location
40
41
  `git config --get remote.origin.url`.strip.chomp('.git')
41
42
  end
42
43
 
44
+ # Returns the remote URI for the repository.
45
+ # Both https://... and git@... remote formats are supported.
46
+ def origin_uri
47
+ remote_location.sub(/^git@(.+?):(.+)$/, 'https://\1/\2')
48
+ end
49
+
43
50
  def skip?
44
51
  options.skip
45
52
  end
@@ -1,5 +1,5 @@
1
1
  module Pivotal
2
2
  module Github
3
- VERSION = "0.6.12"
3
+ VERSION = "0.6.14"
4
4
  end
5
5
  end
@@ -5,13 +5,32 @@ describe StoryPullRequest do
5
5
  let(:command) { StoryPullRequest.new }
6
6
  before { command.stub(:story_branch).and_return('6283185-tau-manifesto') }
7
7
  before do
8
- command.stub(:origin_uri).and_return('https://github.com/mhartl/foo')
8
+ command.stub(:remote_location).
9
+ and_return('https://github.com/mhartl/foo')
9
10
  end
10
11
  subject { command }
11
12
 
12
13
  its(:cmd) { should =~ /open #{command.uri}/ }
13
14
  its(:cmd) { should =~ /git story-push/ }
14
15
 
16
+ describe 'origin uri parsing' do
17
+ let(:correct_origin) { 'https://github.com/mhartl/foo' }
18
+ subject { command.send :origin_uri }
19
+
20
+ context 'https protocol' do
21
+ it { should eq correct_origin }
22
+ end
23
+
24
+ context 'git protocol' do
25
+ before do
26
+ command.stub(:remote_location).
27
+ and_return('git@github.com:mhartl/foo')
28
+ end
29
+
30
+ it { should eq correct_origin }
31
+ end
32
+ end
33
+
15
34
  describe "command-line command" do
16
35
  subject { `bin/git-story-pull-request --debug` }
17
36
  it { should =~ /pull\/new/ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pivotal-github
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.12
4
+ version: 0.6.14
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: 2013-03-12 00:00:00.000000000 Z
12
+ date: 2013-04-25 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Add commands for Pivotal Tracker-GitHub integration
15
15
  email:
@@ -26,6 +26,8 @@ extra_rdoc_files: []
26
26
  files:
27
27
  - .gitignore
28
28
  - .rspec
29
+ - .ruby-gemset
30
+ - .ruby-version
29
31
  - Gemfile
30
32
  - LICENSE.txt
31
33
  - README.md