pivotal-github 0.5.1 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +42 -15
- data/bin/git-story-merge +4 -4
- data/bin/git-story-pull +4 -5
- data/bin/git-story-push +4 -2
- data/bin/story-open +5 -0
- data/lib/pivotal-github.rb +4 -0
- data/lib/pivotal-github/command.rb +14 -7
- data/lib/pivotal-github/story_commit.rb +6 -14
- data/lib/pivotal-github/story_merge.rb +40 -0
- data/lib/pivotal-github/story_open.rb +14 -0
- data/lib/pivotal-github/story_pull.rb +41 -0
- data/lib/pivotal-github/story_push.rb +36 -0
- data/lib/pivotal-github/version.rb +1 -1
- data/spec/commands/command_spec.rb +13 -0
- data/spec/commands/story_commit_spec.rb +7 -12
- data/spec/commands/story_merge_spec.rb +39 -0
- data/spec/commands/story_open_spec.rb +16 -0
- data/spec/commands/story_push_spec.rb +37 -0
- data/spec/options/story_pull_spec.rb +40 -0
- data/spec/spec_helper.rb +0 -2
- metadata +18 -2
data/README.md
CHANGED
@@ -1,22 +1,21 @@
|
|
1
1
|
# pivotal-github
|
2
2
|
|
3
|
-
|
3
|
+
The `pivotal-github` gem facilitates a Pivotal Tracker–GitHub workflow inspired by [Logical Reality](http://lrdesign.com/). As per usual, there are several projects (notably [git-flow](https://github.com/nvie/gitflow) and [git-pivotal](https://github.com/trydionel/git-pivotal)) that implement similar solutions, but none met my exact needs.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
|
-
gem 'pivotal-github'
|
9
|
+
gem 'pivotal-github', '~> 0.5.0'
|
10
10
|
|
11
|
-
|
11
|
+
Then install the gem with Bundler:
|
12
12
|
|
13
|
-
$ bundle
|
13
|
+
$ bundle install
|
14
14
|
|
15
|
-
|
15
|
+
You can also install it directly as follows:
|
16
16
|
|
17
17
|
$ gem install pivotal-github
|
18
18
|
|
19
|
-
|
20
19
|
## Usage
|
21
20
|
|
22
21
|
The `pivotal-github` gem adds several additional Git commands to the local environment. There is only one non-trivial addition, `git story-commit`; the others are simple (tiny) bash scripts. (In fact, the current Ruby code looks over-engineered: there is a base `Command` class with only one derived class, `StoryCommit`. This is an artifact of history, as there used to be other commands, but I decided that the other cases were better served by plain bash scripts.) The `git story-commit` command automatically incorporates the Pivotal Tracker story id into the commit messages, while adding options to mark the story **Finished** or **Delivered**.
|
@@ -27,7 +26,7 @@ The full set of commands is as follows:
|
|
27
26
|
|
28
27
|
### git story-commit
|
29
28
|
|
30
|
-
`git story-commit` makes a standard `git commit` with the story number added to the commit message. This automatically adds a link at Pivotal Tracker between the story and the diff
|
29
|
+
`git story-commit` makes a standard `git commit` with the story number added to the commit message. This automatically adds a link at Pivotal Tracker between the story and the diff when the branch gets pushed up to GitHub.
|
31
30
|
|
32
31
|
For example, when on a branch called `6283185-add-markdown-support`, the `git story-commit` command automatically adds `[#6283185]` to the commit message:
|
33
32
|
|
@@ -39,7 +38,7 @@ To mark a story as **Finished**, add the `-f` flag:
|
|
39
38
|
$ git story-commit -f -am "Remove baz quuxes"
|
40
39
|
[6283185-add-markdown-support 7g56429] [Finishes #6283185] Remove baz quuxes
|
41
40
|
|
42
|
-
|
41
|
+
#### Options
|
43
42
|
|
44
43
|
$ git story-commit -h
|
45
44
|
Usage: git story-commit [options]
|
@@ -49,7 +48,7 @@ Here's the full usage info:
|
|
49
48
|
-a, --all commit all changed files
|
50
49
|
-h, --help this usage guide
|
51
50
|
|
52
|
-
Additionally, `git story-commit` accepts any options valid for `git commit`. (`git story-commit` supports the `-a` flag so that `git story-commit -am "message"` works.)
|
51
|
+
Additionally, `git story-commit` accepts any options valid for `git commit`. (`git story-commit` supports the `-a` flag even though that's a valid option to `git commit` so that the compound flag in `git story-commit -am "message"` works.)
|
53
52
|
|
54
53
|
### git story-push
|
55
54
|
|
@@ -58,7 +57,13 @@ Additionally, `git story-commit` accepts any options valid for `git commit`. (`g
|
|
58
57
|
$ git story-push
|
59
58
|
* [new branch] 6283185-add-markdown-support -> 6283185-add-markdown-support
|
60
59
|
|
61
|
-
|
60
|
+
#### Options
|
61
|
+
|
62
|
+
Usage: git story-push [options]
|
63
|
+
-t, --target TARGET push to a given target (defaults to origin)
|
64
|
+
-h, --help this usage guide
|
65
|
+
|
66
|
+
Additionall, `git story-push` accepts any options valid for `git push`.
|
62
67
|
|
63
68
|
### git story-pull
|
64
69
|
|
@@ -79,13 +84,35 @@ The purpose of `git story-pull` it to prepare the local story branch for rebasin
|
|
79
84
|
$ git rebase origin/master
|
80
85
|
|
81
86
|
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.)
|
87
|
+
|
88
|
+
#### Options
|
89
|
+
|
90
|
+
Usage: git story-pull [options]
|
91
|
+
-d, --development BRANCH development branch (defaults to master)
|
92
|
+
-h, --help this usage guide
|
93
|
+
|
94
|
+
Additionally, `git story-pull` accepts any options valid for `git pull`.
|
82
95
|
|
83
96
|
### git story-merge
|
84
97
|
|
85
98
|
`git story-merge` merges the current branch into `master`. On a branch called `6283185-add-markdown-support`, `git story-merge` is equivalent to the following:
|
86
99
|
|
87
100
|
$ git checkout master
|
88
|
-
$ git merge 6283185-add-markdown-support
|
101
|
+
$ git merge --no-ff 6283185-add-markdown-support
|
102
|
+
|
103
|
+
Note that this effectively changes the default merge behavior from fast-forward to no-fast-forward, which makes it possible to see from `git log` which of the commit objects together have implemented a story. As noted in [A successful Git branching model](http://nvie.com/posts/a-successful-git-branching-model/),
|
104
|
+
|
105
|
+
> The `--no-ff` flag causes the merge to always create a new commit object, even if the merge could be performed with a fast-forward. This avoids losing information about the historical existence of a feature branch and groups together all commits that together added the feature… Yes, it will create a few more (empty) commit objects, but the gain is much bigger that that cost.
|
106
|
+
|
107
|
+
Because of the way options are chained, passing the option `--ff` to `git story-merge` will override the `--no-ff` flag and restore the fast-forward behavior.
|
108
|
+
|
109
|
+
#### Options
|
110
|
+
|
111
|
+
Usage: git story-merge [options]
|
112
|
+
-d, --development BRANCH development branch (defaults to master)
|
113
|
+
-h, --help this usage guide
|
114
|
+
|
115
|
+
Additionally, `git story-merge` accepts any options valid for `git merge`.
|
89
116
|
|
90
117
|
## Configuration
|
91
118
|
|
@@ -134,16 +161,16 @@ Here's the process in detail:
|
|
134
161
|
4. Push up with `git push`
|
135
162
|
6. At the GitHub page for the repo, select **Branches** and submit a pull request
|
136
163
|
7. **(experimental)** Add a story of type Chore to Pivotal Tracker and assign it to Developer #2 (Bob)
|
137
|
-
|
164
|
+
8. Continue working, taking care to branch off of the current story branch if its changes are required to continue
|
138
165
|
|
139
166
|
### Developer #2 (Bob)
|
140
167
|
|
141
168
|
1. Select **Pull Requests** at GitHub and review the pull request diffs
|
142
169
|
2. If acceptable, merge the branch by clicking on the button at GitHub
|
143
|
-
3. If not acceptable, manually change the state at Pivotal Tracker to Rejected and leave a note (at GitHub or at Pivotal Tracker) indicating the reason
|
144
|
-
4. **(experimental)** If the branch
|
170
|
+
3. If not acceptable, manually change the state at Pivotal Tracker to **Rejected** and leave a note (at GitHub or at Pivotal Tracker) indicating the reason
|
171
|
+
4. **(experimental)** If the branch can't be automatically merged, make a Chore to resolve any conflicts and assign it to Alice
|
145
172
|
|
146
|
-
|
173
|
+
Note that the commits will appear on the story as soon as Alice creates a remote branch (and as she pushes to it), but it won't be marked **Finished** or **Delivered** until Bob merges the pull request into `master`.
|
147
174
|
|
148
175
|
## Merge conflicts
|
149
176
|
|
data/bin/git-story-merge
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
#!/bin/
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
3
|
+
require 'pivotal-github/story_merge'
|
2
4
|
|
3
|
-
|
4
|
-
git checkout master
|
5
|
-
git merge $branch
|
5
|
+
exit Command.run!(StoryMerge, ARGV.dup)
|
data/bin/git-story-pull
CHANGED
@@ -1,6 +1,5 @@
|
|
1
|
-
#!/bin/
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib')
|
3
|
+
require 'pivotal-github/story_pull'
|
2
4
|
|
3
|
-
|
4
|
-
git checkout master
|
5
|
-
git pull $@
|
6
|
-
git checkout $branch
|
5
|
+
exit Command.run!(StoryPull, ARGV.dup)
|
data/bin/git-story-push
CHANGED
data/bin/story-open
ADDED
data/lib/pivotal-github.rb
CHANGED
@@ -2,3 +2,7 @@ require "pivotal-github/version"
|
|
2
2
|
require "pivotal-github/options"
|
3
3
|
require "pivotal-github/command"
|
4
4
|
require "pivotal-github/story_commit"
|
5
|
+
require "pivotal-github/story_push"
|
6
|
+
require "pivotal-github/story_pull"
|
7
|
+
require "pivotal-github/story_merge"
|
8
|
+
require "pivotal-github/story_open"
|
@@ -1,25 +1,32 @@
|
|
1
|
+
require 'optparse'
|
2
|
+
require 'ostruct'
|
3
|
+
require 'pivotal-github/options'
|
4
|
+
|
1
5
|
class Command
|
2
6
|
attr_accessor :args, :cmd, :options, :known_options, :unknown_options
|
3
7
|
|
4
8
|
def initialize(args = [])
|
5
9
|
self.args = args
|
10
|
+
self.options = OpenStruct.new
|
6
11
|
parse
|
7
12
|
end
|
8
13
|
|
9
14
|
def parse
|
10
|
-
|
15
|
+
self.known_options = Options::known_options(parser, args)
|
16
|
+
self.unknown_options = Options::unknown_options(parser, args)
|
17
|
+
parser.parse(known_options)
|
11
18
|
end
|
12
19
|
|
13
|
-
def
|
14
|
-
|
20
|
+
def parser
|
21
|
+
OptionParser.new
|
15
22
|
end
|
16
23
|
|
17
|
-
def
|
18
|
-
|
24
|
+
def story_branch
|
25
|
+
`git rev-parse --abbrev-ref HEAD`.strip
|
19
26
|
end
|
20
27
|
|
21
|
-
def
|
22
|
-
|
28
|
+
def story_id
|
29
|
+
story_branch.scan(/\d+/).first
|
23
30
|
end
|
24
31
|
|
25
32
|
# Runs a command
|
@@ -1,35 +1,27 @@
|
|
1
|
-
require 'optparse'
|
2
|
-
require 'ostruct'
|
3
|
-
require 'pivotal-github/options'
|
4
1
|
require 'pivotal-github/command'
|
5
2
|
|
6
3
|
class StoryCommit < Command
|
7
4
|
|
8
|
-
def
|
9
|
-
|
10
|
-
parser = OptionParser.new do |opts|
|
5
|
+
def parser
|
6
|
+
OptionParser.new do |opts|
|
11
7
|
opts.banner = "Usage: git story-commit [options]"
|
12
8
|
opts.on("-m", "--message MESSAGE",
|
13
9
|
"add a commit message (including story #)") do |m|
|
14
|
-
options.message = m
|
10
|
+
self.options.message = m
|
15
11
|
end
|
16
12
|
opts.on("-f", "--finish", "mark story as finished") do |f|
|
17
|
-
options.finish = f
|
13
|
+
self.options.finish = f
|
18
14
|
end
|
19
15
|
opts.on("-d", "--deliver", "mark story as delivered") do |d|
|
20
|
-
options.deliver = d
|
16
|
+
self.options.deliver = d
|
21
17
|
end
|
22
18
|
opts.on("-a", "--all", "commit all changed files") do |a|
|
23
|
-
options.all = a
|
19
|
+
self.options.all = a
|
24
20
|
end
|
25
21
|
opts.on_tail("-h", "--help", "this usage guide") do
|
26
22
|
puts opts.to_s; exit 0
|
27
23
|
end
|
28
24
|
end
|
29
|
-
self.known_options = Options::known_options(parser, args)
|
30
|
-
self.unknown_options = Options::unknown_options(parser, args)
|
31
|
-
parser.parse(known_options)
|
32
|
-
options
|
33
25
|
end
|
34
26
|
|
35
27
|
def message
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'pivotal-github/command'
|
2
|
+
|
3
|
+
class StoryMerge < Command
|
4
|
+
|
5
|
+
def parser
|
6
|
+
OptionParser.new do |opts|
|
7
|
+
opts.banner = "Usage: git story-merge [options]"
|
8
|
+
opts.on("-d", "--development BRANCH",
|
9
|
+
"development branch (defaults to master)") do |opt|
|
10
|
+
self.options.development = opt
|
11
|
+
end
|
12
|
+
opts.on_tail("-h", "--help", "this usage guide") do
|
13
|
+
puts opts.to_s; exit 0
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Returns a command appropriate for executing at the command line
|
19
|
+
# For example:
|
20
|
+
# git checkout master
|
21
|
+
# git merge --no-ff <story branch>
|
22
|
+
def cmd
|
23
|
+
lines = ["git checkout #{development_branch}"]
|
24
|
+
c = ['git merge --no-ff']
|
25
|
+
c << argument_string(unknown_options) unless unknown_options.empty?
|
26
|
+
c << story_branch
|
27
|
+
lines << c.join(' ')
|
28
|
+
lines.join("\n")
|
29
|
+
end
|
30
|
+
|
31
|
+
def run!
|
32
|
+
system cmd
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def development_branch
|
38
|
+
options.development || 'master'
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'pivotal-github/command'
|
2
|
+
|
3
|
+
class StoryOpen < Command
|
4
|
+
|
5
|
+
# Returns a command appropriate for executing at the command line
|
6
|
+
# I.e., 'open https://www.pivotaltracker.com/story/show/6283185'
|
7
|
+
def cmd
|
8
|
+
"open https://www.pivotaltracker.com/story/show/#{story_id}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def run!
|
12
|
+
system cmd
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'pivotal-github/command'
|
2
|
+
|
3
|
+
class StoryPull < Command
|
4
|
+
|
5
|
+
def parser
|
6
|
+
OptionParser.new do |opts|
|
7
|
+
opts.banner = "Usage: git story-pull [options]"
|
8
|
+
opts.on("-d", "--development BRANCH",
|
9
|
+
"development branch (defaults to master)") do |opt|
|
10
|
+
self.options.development = opt
|
11
|
+
end
|
12
|
+
opts.on_tail("-h", "--help", "this usage guide") do
|
13
|
+
puts opts.to_s; exit 0
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Returns a command appropriate for executing at the command line
|
19
|
+
# For example:
|
20
|
+
# git checkout master
|
21
|
+
# git pull
|
22
|
+
# git checkout <story branch>
|
23
|
+
def cmd
|
24
|
+
lines = ["git checkout #{development_branch}"]
|
25
|
+
c = ['git pull']
|
26
|
+
c << argument_string(unknown_options) unless unknown_options.empty?
|
27
|
+
lines << c.join(' ')
|
28
|
+
lines << ["git checkout #{story_branch}"]
|
29
|
+
lines.join("\n")
|
30
|
+
end
|
31
|
+
|
32
|
+
def run!
|
33
|
+
system cmd
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def development_branch
|
39
|
+
options.development || 'master'
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'pivotal-github/command'
|
2
|
+
|
3
|
+
class StoryPush < Command
|
4
|
+
|
5
|
+
def parser
|
6
|
+
OptionParser.new do |opts|
|
7
|
+
opts.banner = "Usage: git story-push [options]"
|
8
|
+
opts.on("-t", "--target TARGET",
|
9
|
+
"push to a given target (defaults to origin)") do |t|
|
10
|
+
self.options.target = t
|
11
|
+
end
|
12
|
+
opts.on_tail("-h", "--help", "this usage guide") do
|
13
|
+
puts opts.to_s; exit 0
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
# Returns a command appropriate for executing at the command line
|
19
|
+
def cmd
|
20
|
+
c = ['git push']
|
21
|
+
c << argument_string(unknown_options) unless unknown_options.empty?
|
22
|
+
c << target
|
23
|
+
c << story_branch
|
24
|
+
c.join(' ')
|
25
|
+
end
|
26
|
+
|
27
|
+
def run!
|
28
|
+
system cmd
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def target
|
34
|
+
options.target || 'origin'
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Command do
|
4
|
+
let(:command) { Command.new }
|
5
|
+
before { command.stub(:story_branch).and_return('6283185-tau-manifesto') }
|
6
|
+
subject { command }
|
7
|
+
|
8
|
+
it { should respond_to(:cmd) }
|
9
|
+
it { should respond_to(:args) }
|
10
|
+
it { should respond_to(:options) }
|
11
|
+
it { should respond_to(:parse) }
|
12
|
+
it { should respond_to(:story_id) }
|
13
|
+
end
|
@@ -1,19 +1,14 @@
|
|
1
|
-
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe StoryCommit do
|
4
4
|
|
5
|
-
before { command.stub(:current_branch).and_return('6283185-tau-manifesto') }
|
6
5
|
let(:command) { StoryCommit.new(['-m', 'message', '-a', '-z', '--foo']) }
|
6
|
+
before { command.stub(:story_branch).and_return('6283185-tau-manifesto') }
|
7
7
|
subject { command }
|
8
8
|
|
9
|
-
it { should respond_to(:cmd) }
|
10
|
-
it { should respond_to(:args) }
|
11
|
-
it { should respond_to(:options) }
|
12
|
-
it { should respond_to(:parse) }
|
13
9
|
it { should respond_to(:message) }
|
14
|
-
it { should respond_to(:story_id) }
|
15
10
|
|
16
|
-
shared_examples "
|
11
|
+
shared_examples "story-commit with known options" do
|
17
12
|
subject { command }
|
18
13
|
|
19
14
|
its(:cmd) { should =~ /git commit/ }
|
@@ -31,18 +26,18 @@ describe StoryCommit do
|
|
31
26
|
|
32
27
|
describe "with only known options" do
|
33
28
|
let(:command) { StoryCommit.new(['-m', 'message', '-a']) }
|
34
|
-
it_should_behave_like "
|
29
|
+
it_should_behave_like "story-commit with known options"
|
35
30
|
end
|
36
31
|
|
37
32
|
describe "with a compound argument" do
|
38
33
|
let(:command) { StoryCommit.new(['-am', 'message']) }
|
39
|
-
it_should_behave_like "
|
34
|
+
it_should_behave_like "story-commit with known options"
|
40
35
|
end
|
41
36
|
|
42
37
|
describe "with some unknown options" do
|
43
38
|
let(:command) { StoryCommit.new(['-m', 'message', '-a', '-z', '--foo']) }
|
44
39
|
|
45
|
-
it_should_behave_like "
|
40
|
+
it_should_behave_like "story-commit with known options"
|
46
41
|
|
47
42
|
it "should not raise an error" do
|
48
43
|
expect { command.parse }.not_to raise_error(OptionParser::InvalidOption)
|
@@ -80,7 +75,7 @@ describe StoryCommit do
|
|
80
75
|
end
|
81
76
|
|
82
77
|
describe "command with no story id" do
|
83
|
-
before { command.stub(:
|
78
|
+
before { command.stub(:story_branch).and_return('tau-manifesto') }
|
84
79
|
its(:cmd) do
|
85
80
|
should == %(git commit -a -m "message" -z --foo)
|
86
81
|
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe StoryMerge do
|
4
|
+
|
5
|
+
let(:command) { StoryMerge.new }
|
6
|
+
before { command.stub(:story_branch).and_return('6283185-tau-manifesto') }
|
7
|
+
subject { command }
|
8
|
+
|
9
|
+
its(:cmd) { should =~ /git merge/ }
|
10
|
+
|
11
|
+
shared_examples "story-merge with known options" do
|
12
|
+
subject { command }
|
13
|
+
it "should not raise an error" do
|
14
|
+
expect { command.parse }.not_to raise_error(OptionParser::InvalidOption)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "with no options" do
|
19
|
+
its(:cmd) { should =~ /git checkout master/ }
|
20
|
+
its(:cmd) { should =~ /git merge --no-ff #{command.story_branch}/ }
|
21
|
+
end
|
22
|
+
|
23
|
+
describe "with a custom development branch" do
|
24
|
+
let(:command) { StoryPull.new(['-d', 'develop']) }
|
25
|
+
its(:cmd) { should =~ /git checkout develop/ }
|
26
|
+
end
|
27
|
+
|
28
|
+
describe "with some unknown options" do
|
29
|
+
let(:command) { StoryPull.new(['-d', 'develop', '-a', '-z', '--foo']) }
|
30
|
+
it_should_behave_like "story-merge with known options"
|
31
|
+
its(:cmd) { should =~ /git pull -a -z --foo/ }
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "command-line command" do
|
35
|
+
subject { `bin/git-story-merge --debug -ff -d develop` }
|
36
|
+
it { should =~ /git checkout develop/ }
|
37
|
+
it { should =~ /git merge --no-ff -ff/ }
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe StoryOpen do
|
4
|
+
|
5
|
+
let(:command) { StoryOpen.new }
|
6
|
+
let(:uri) { "https://www.pivotaltracker.com/story/show/#{command.story_id}" }
|
7
|
+
before { command.stub(:story_branch).and_return('6283185-tau-manifesto') }
|
8
|
+
subject { command }
|
9
|
+
|
10
|
+
its(:cmd) { should == "open #{uri}" }
|
11
|
+
|
12
|
+
describe "command-line command" do
|
13
|
+
subject { `bin/story-open --debug` }
|
14
|
+
it { should =~ /open https:\/\/www.pivotaltracker.com\/story\/show/ }
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe StoryPush do
|
4
|
+
|
5
|
+
let(:command) { StoryPush.new }
|
6
|
+
before { command.stub(:story_branch).and_return('6283185-tau-manifesto') }
|
7
|
+
subject { command }
|
8
|
+
|
9
|
+
its(:cmd) { should =~ /git push/ }
|
10
|
+
|
11
|
+
shared_examples "story-push with known options" do
|
12
|
+
subject { command }
|
13
|
+
it "should not raise an error" do
|
14
|
+
expect { command.parse }.not_to raise_error(OptionParser::InvalidOption)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "with no options" do
|
19
|
+
its(:cmd) { should == "git push origin #{command.story_branch}" }
|
20
|
+
end
|
21
|
+
|
22
|
+
describe "with a target option" do
|
23
|
+
let(:command) { StoryPush.new(['-t', 'heroku']) }
|
24
|
+
its(:cmd) { should =~ /git push heroku/ }
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "with some unknown options" do
|
28
|
+
let(:command) { StoryPush.new(['-p', 'develop', '-a', '-z', '--foo']) }
|
29
|
+
it_should_behave_like "story-push with known options"
|
30
|
+
its(:cmd) { should =~ /-a -z --foo/ }
|
31
|
+
end
|
32
|
+
|
33
|
+
describe "command-line command" do
|
34
|
+
subject { `bin/git-story-push --debug -z -t heroku` }
|
35
|
+
it { should =~ /git push -z heroku/ }
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe StoryPull do
|
4
|
+
|
5
|
+
let(:command) { StoryPull.new }
|
6
|
+
before { command.stub(:story_branch).and_return('6283185-tau-manifesto') }
|
7
|
+
subject { command }
|
8
|
+
|
9
|
+
its(:cmd) { should =~ /git pull/ }
|
10
|
+
|
11
|
+
shared_examples "story-pull with known options" do
|
12
|
+
subject { command }
|
13
|
+
it "should not raise an error" do
|
14
|
+
expect { command.parse }.not_to raise_error(OptionParser::InvalidOption)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "with no options" do
|
19
|
+
its(:cmd) { should =~ /git checkout master/ }
|
20
|
+
its(:cmd) { should =~ /git pull/ }
|
21
|
+
its(:cmd) { should =~ /git checkout #{command.story_branch}/ }
|
22
|
+
end
|
23
|
+
|
24
|
+
describe "with a custom development branch" do
|
25
|
+
let(:command) { StoryPull.new(['-d', 'develop']) }
|
26
|
+
its(:cmd) { should =~ /git checkout develop/ }
|
27
|
+
end
|
28
|
+
|
29
|
+
describe "with some unknown options" do
|
30
|
+
let(:command) { StoryPull.new(['-d', 'develop', '-a', '-z', '--foo']) }
|
31
|
+
it_should_behave_like "story-pull with known options"
|
32
|
+
its(:cmd) { should =~ /git pull -a -z --foo/ }
|
33
|
+
end
|
34
|
+
|
35
|
+
describe "command-line command" do
|
36
|
+
subject { `bin/git-story-pull --debug -z -d develop` }
|
37
|
+
it { should =~ /git checkout develop/ }
|
38
|
+
it { should =~ /git pull -z/ }
|
39
|
+
end
|
40
|
+
end
|
data/spec/spec_helper.rb
CHANGED
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.5.
|
4
|
+
version: 0.5.2
|
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-02-
|
12
|
+
date: 2013-02-08 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Add commands for Pivotal Tracker–GitHub integration
|
15
15
|
email:
|
@@ -19,6 +19,7 @@ executables:
|
|
19
19
|
- git-story-merge
|
20
20
|
- git-story-pull
|
21
21
|
- git-story-push
|
22
|
+
- story-open
|
22
23
|
extensions: []
|
23
24
|
extra_rdoc_files: []
|
24
25
|
files:
|
@@ -32,14 +33,24 @@ files:
|
|
32
33
|
- bin/git-story-merge
|
33
34
|
- bin/git-story-pull
|
34
35
|
- bin/git-story-push
|
36
|
+
- bin/story-open
|
35
37
|
- lib/pivotal-github.rb
|
36
38
|
- lib/pivotal-github/command.rb
|
37
39
|
- lib/pivotal-github/options.rb
|
38
40
|
- lib/pivotal-github/story_commit.rb
|
41
|
+
- lib/pivotal-github/story_merge.rb
|
42
|
+
- lib/pivotal-github/story_open.rb
|
43
|
+
- lib/pivotal-github/story_pull.rb
|
44
|
+
- lib/pivotal-github/story_push.rb
|
39
45
|
- lib/pivotal-github/version.rb
|
40
46
|
- pivotal-github.gemspec
|
47
|
+
- spec/commands/command_spec.rb
|
41
48
|
- spec/commands/story_commit_spec.rb
|
49
|
+
- spec/commands/story_merge_spec.rb
|
50
|
+
- spec/commands/story_open_spec.rb
|
51
|
+
- spec/commands/story_push_spec.rb
|
42
52
|
- spec/options/options_spec.rb
|
53
|
+
- spec/options/story_pull_spec.rb
|
43
54
|
- spec/spec_helper.rb
|
44
55
|
homepage: https://github.com/mhartl/pivotal-github
|
45
56
|
licenses: []
|
@@ -66,6 +77,11 @@ signing_key:
|
|
66
77
|
specification_version: 3
|
67
78
|
summary: See the README for full documentation
|
68
79
|
test_files:
|
80
|
+
- spec/commands/command_spec.rb
|
69
81
|
- spec/commands/story_commit_spec.rb
|
82
|
+
- spec/commands/story_merge_spec.rb
|
83
|
+
- spec/commands/story_open_spec.rb
|
84
|
+
- spec/commands/story_push_spec.rb
|
70
85
|
- spec/options/options_spec.rb
|
86
|
+
- spec/options/story_pull_spec.rb
|
71
87
|
- spec/spec_helper.rb
|