github-pivotal-flow 1.0.0 → 1.0.1
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.
- checksums.yaml +4 -4
- data/lib/github_pivotal_flow/git.rb +10 -4
- data/lib/github_pivotal_flow/story.rb +3 -3
- data/lib/github_pivotal_flow/version.rb +1 -1
- data/spec/github_pivotal_flow/command_spec.rb +2 -0
- data/spec/github_pivotal_flow/configuration_spec.rb +1 -0
- data/spec/github_pivotal_flow/finish_spec.rb +1 -0
- data/spec/github_pivotal_flow/git_spec.rb +13 -0
- data/spec/github_pivotal_flow/publish_spec.rb +3 -2
- data/spec/github_pivotal_flow/shell_spec.rb +1 -0
- data/spec/github_pivotal_flow/start_spec.rb +2 -1
- data/spec/github_pivotal_flow/story_spec.rb +49 -8
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4343fcc5d4d4d068f199c34fe588b89f78b34b78
|
4
|
+
data.tar.gz: 0279a5c747be018437bfbbe85183426c14542301
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 210e9a9b979fdbb6c184649d480dc59ab0276de600c8a33cc9e431d9810f3abbb09c14f27d83cb667c3693330c6320f1ccd706e9b5b551ff5d79bf26a5bf0c9a
|
7
|
+
data.tar.gz: d16ee45c8d0b8bcdeb08ff23c9151f0c8bca876d64bd44418ee4e4877b63fd1397d2739ff869140d060465e8848cc99d5163b472a96b6554599dc53be7c57486
|
@@ -29,7 +29,9 @@ module GithubPivotalFlow
|
|
29
29
|
|
30
30
|
def self.create_branch(branch_name, start_point = nil, options = {})
|
31
31
|
return if branch_exists?(branch_name)
|
32
|
-
|
32
|
+
command = "git branch --quiet"
|
33
|
+
command << " --set-upstream" if options[:set_upstream]
|
34
|
+
exec "#{command} #{[branch_name, start_point].compact.join(' ')}"
|
33
35
|
puts 'OK'
|
34
36
|
end
|
35
37
|
|
@@ -66,8 +68,12 @@ module GithubPivotalFlow
|
|
66
68
|
exec command
|
67
69
|
end
|
68
70
|
|
69
|
-
def self.tag(tag_name)
|
70
|
-
|
71
|
+
def self.tag(tag_name, options = {})
|
72
|
+
command = "git tag"
|
73
|
+
command << " -a" if options[:annotated]
|
74
|
+
command << " -m \"#{options[:message]}\"" unless options[:message].blank?
|
75
|
+
command << " #{tag_name}" if tag_name
|
76
|
+
exec command
|
71
77
|
end
|
72
78
|
|
73
79
|
def self.delete_branch(branch_name, options = {})
|
@@ -180,4 +186,4 @@ module GithubPivotalFlow
|
|
180
186
|
return Shell.exec(command, abort_on_failure)
|
181
187
|
end
|
182
188
|
end
|
183
|
-
end
|
189
|
+
end
|
@@ -86,7 +86,7 @@ module GithubPivotalFlow
|
|
86
86
|
Git.checkout(root_branch_name)
|
87
87
|
root_origin = Git.get_remote
|
88
88
|
Git.pull_remote
|
89
|
-
Git.create_branch(branch_name, root_branch_name)
|
89
|
+
Git.create_branch(branch_name, root_branch_name, set_upstream: true)
|
90
90
|
Git.checkout(branch_name)
|
91
91
|
Git.set_config('root-branch', root_branch_name, :branch)
|
92
92
|
Git.set_config('root-remote', root_origin, :branch)
|
@@ -129,7 +129,7 @@ module GithubPivotalFlow
|
|
129
129
|
Git.merge(branch_name, commit_message: commit_message, no_ff: true)
|
130
130
|
end
|
131
131
|
Git.checkout(master_branch_name)
|
132
|
-
Git.tag(name)
|
132
|
+
Git.tag(name, annotated: true, message: "Release #{escape_quotes(name)}")
|
133
133
|
Git.push(master_branch_name, development_branch_name)
|
134
134
|
Git.push_tags
|
135
135
|
self.delete_branch!
|
@@ -294,4 +294,4 @@ module GithubPivotalFlow
|
|
294
294
|
string.gsub('"', '\"')
|
295
295
|
end
|
296
296
|
end
|
297
|
-
end
|
297
|
+
end
|
@@ -17,6 +17,19 @@ module GithubPivotalFlow
|
|
17
17
|
expect(current_branch).to eq('dev_branch')
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
describe '.clean_working_tree?' do
|
22
|
+
context 'with a dirty working tree' do
|
23
|
+
before do
|
24
|
+
allow(Shell).to receive(:exec).with("git diff --no-ext-diff --ignore-submodules --quiet --exit-code", false).and_return(true)
|
25
|
+
allow(Shell).to receive(:exec).with("git diff-index --cached --quiet --ignore-submodules HEAD --", false).and_raise "fatal: Index contains uncommited changes. Aborting."
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'raises a runtime error' do
|
29
|
+
expect { Git.clean_working_tree? }.to raise_error(RuntimeError)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
20
33
|
|
21
34
|
describe '.repository_root' do
|
22
35
|
it 'returns the repository root' do
|
@@ -2,6 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module GithubPivotalFlow
|
4
4
|
describe Publish do
|
5
|
+
let(:fake_git) { double('Git').as_null_object }
|
6
|
+
|
5
7
|
before do
|
6
8
|
$stdout = StringIO.new
|
7
9
|
$stderr = StringIO.new
|
@@ -39,8 +41,7 @@ module GithubPivotalFlow
|
|
39
41
|
end
|
40
42
|
|
41
43
|
it 'fails with a dirty working tree' do
|
42
|
-
|
43
|
-
allow(Shell).to receive(:exec).with("git diff-index --cached --quiet --ignore-submodules HEAD --", false).and_raise "fatal: Index contains uncommited changes. Aborting."
|
44
|
+
expect(Git).to receive(:clean_working_tree?).and_raise(RuntimeError)
|
44
45
|
expect { @publish.run! }.to raise_error(RuntimeError)
|
45
46
|
end
|
46
47
|
|
@@ -2,6 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module GithubPivotalFlow
|
4
4
|
describe Start do
|
5
|
+
let(:fake_git) { double('Git').as_null_object }
|
6
|
+
|
5
7
|
before do
|
6
8
|
$stdout = StringIO.new
|
7
9
|
$stderr = StringIO.new
|
@@ -30,7 +32,6 @@ module GithubPivotalFlow
|
|
30
32
|
allow(Configuration).to receive(:new).and_return(@configuration)
|
31
33
|
allow(PivotalTracker::Project).to receive(:find).and_return(@project)
|
32
34
|
allow(@story).to receive(:create_branch!).and_return(true)
|
33
|
-
allow(Git).to receive(:add_hook)
|
34
35
|
allow(@configuration).to receive(:story=).with(@story).and_return(true)
|
35
36
|
allow(@story).to receive(:mark_started!)
|
36
37
|
@start = Start.new()
|
@@ -2,6 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module GithubPivotalFlow
|
4
4
|
describe Story do
|
5
|
+
let(:fake_git) { double('Git').as_null_object }
|
5
6
|
|
6
7
|
before do
|
7
8
|
$stdout = StringIO.new
|
@@ -125,14 +126,6 @@ module GithubPivotalFlow
|
|
125
126
|
|
126
127
|
describe '#create_branch!' do
|
127
128
|
before do
|
128
|
-
allow(Git).to receive(:checkout).and_return(nil)
|
129
|
-
allow(Git).to receive(:pull_remote).and_return(nil)
|
130
|
-
allow(Git).to receive(:create_branch).and_return(nil)
|
131
|
-
allow(Git).to receive(:set_config).and_return(nil)
|
132
|
-
allow(Git).to receive(:get_config).and_return(nil)
|
133
|
-
allow(Git).to receive(:push).and_return(nil)
|
134
|
-
allow(Git).to receive(:commit).and_return(nil)
|
135
|
-
allow(Git).to receive(:get_remote).and_return(nil)
|
136
129
|
allow(@pivotal_story).to receive(:story_type).and_return('feature')
|
137
130
|
allow(@pivotal_story).to receive(:id).and_return('123456')
|
138
131
|
allow(@pivotal_story).to receive(:name).and_return('test')
|
@@ -170,5 +163,53 @@ module GithubPivotalFlow
|
|
170
163
|
@story.create_branch!
|
171
164
|
end
|
172
165
|
end
|
166
|
+
|
167
|
+
describe '#merge_release!' do
|
168
|
+
before do
|
169
|
+
allow(@pivotal_story).to receive(:story_type).and_return('release')
|
170
|
+
allow(@pivotal_story).to receive(:id).and_return('123456')
|
171
|
+
allow(@pivotal_story).to receive(:name).and_return('v1.5.1')
|
172
|
+
@story = GithubPivotalFlow::Story.new(@project, @pivotal_story)
|
173
|
+
allow(@story).to receive(:branch_prefix).and_return('release/')
|
174
|
+
allow(@story).to receive(:branch_name).and_return('release/v1.5.1')
|
175
|
+
end
|
176
|
+
|
177
|
+
context 'if the merge is trivial' do
|
178
|
+
before do
|
179
|
+
allow(@story).to receive(:trivial_merge?).and_return(true)
|
180
|
+
end
|
181
|
+
|
182
|
+
it 'merges using fast-forward' do
|
183
|
+
expect(Git).to receive(:merge).with('release/v1.5.1', hash_including(ff: true))
|
184
|
+
|
185
|
+
@story.merge_release!
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
context 'with a non-trivial merge' do
|
190
|
+
before do
|
191
|
+
allow(@story).to receive(:trivial_merge?).and_return(false)
|
192
|
+
end
|
193
|
+
|
194
|
+
it 'merges using no-ff' do
|
195
|
+
expect(Git).to receive(:merge).with('release/v1.5.1', hash_including(no_ff: true))
|
196
|
+
|
197
|
+
@story.merge_release!
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
context 'when the branch is successfully merged' do
|
202
|
+
before do
|
203
|
+
allow(@story).to receive(:trivial_merge?).and_return(true)
|
204
|
+
allow(Git).to receive(:merge).and_return(true)
|
205
|
+
end
|
206
|
+
|
207
|
+
it 'creates an annotated tag with the release name and short description' do
|
208
|
+
expect(Git).to receive(:tag).with('v1.5.1', hash_including(annotated: true, message: 'Release v1.5.1'))
|
209
|
+
|
210
|
+
@story.merge_release!
|
211
|
+
end
|
212
|
+
end
|
213
|
+
end
|
173
214
|
end
|
174
215
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: github-pivotal-flow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Donald Piret
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -86,28 +86,28 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 3.0.0.rc1
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: 3.0.0.rc1
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rspec-mocks
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: 3.0.0.rc1
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: 3.0.0.rc1
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: simplecov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +136,20 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0.8'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: byebug
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '3.1'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '3.1'
|
139
153
|
description: Provides a set of additional Git commands to help developers when working
|
140
154
|
with Pivotal Tracker and Github pull requests
|
141
155
|
email: donald@donaldpiret.com
|