pt-flow 2.6.1 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6a0562587fbfa03bef4f6f3af61e2737853f4165
4
- data.tar.gz: af4979a0277642e8d1aec9f03adea6053b2a87c4
3
+ metadata.gz: 9687945c5478e9af32ba27d0916f53833bf029e8
4
+ data.tar.gz: f9de9d266b17218d6f926d38904a37127cf61df3
5
5
  SHA512:
6
- metadata.gz: 857b7934a8639ba42007ad16cddcf42c822de3a216c81898b90872888956f76fafda713d5a0ac4e6a20dc7469dbabf33fa68a1019a98f33b181195eb66c04737
7
- data.tar.gz: af7aae768af293a9a6205d7e68eb2d6c8d7de6284b1686a072298370887675ea61a531690e111aa452b6c029aa748fe1462b87715d2b1a1ea882c4be84709dba
6
+ metadata.gz: 827c3e5305abea2084205d64252f86d54e4e49068d4cecfc88ca8df2e644b47874e7b18ca5a5b0a319461f6201b1f05ed890e4856b86ad54441ade4b448a226a
7
+ data.tar.gz: 8d74ed807e9a7265f015d93e7cc95ce015d6e18cb88ebf04e16c88d664e6d167a98bee28408e0b4e182d44f64286f0ead4e17e313dc90324cf2a6b9833b3c5d2
@@ -20,6 +20,10 @@ module PT::Flow
20
20
  name.split('.').first
21
21
  end
22
22
 
23
+ def release_branch?
24
+ target != 'master'
25
+ end
26
+
23
27
  def task_id
24
28
  name[/\d+$/] || ''
25
29
  end
@@ -46,10 +46,8 @@ module PT::Flow
46
46
  run "git push origin #{branch} -u"
47
47
  if @options[:deliver]
48
48
  deliver!
49
- elsif @options[:wip]
50
- open_url pull_request_url('[WIP]')
51
49
  else
52
- finish_task current_task
50
+ finish_task(current_task) unless @options[:wip]
53
51
  open_url pull_request_url
54
52
  end
55
53
  end
@@ -102,11 +100,18 @@ module PT::Flow
102
100
  task_title
103
101
  end
104
102
 
105
- def pull_request_url(prefix = nil)
103
+ def pull_request_url
106
104
  title = URI.escape "#{prefix} #{task_title}".strip
107
105
  repo.url + "/compare/#{branch.target}...#{branch}?expand=1&title=#{title}"
108
106
  end
109
107
 
108
+ def prefix
109
+ prefixes = []
110
+ prefixes << "[WIP]" if @options[:wip]
111
+ prefixes << "[#{branch.target.titleize}]" if branch.release_branch?
112
+ prefixes.join(" ")
113
+ end
114
+
110
115
  def deliver!
111
116
  run "hub pull-request -b #{branch.target} -h #{repo.user}:#{branch} -m \"#{task_title}\""
112
117
  finished_branch = branch
@@ -1,5 +1,5 @@
1
1
  module PT
2
2
  module Flow
3
- VERSION = '2.6.1'
3
+ VERSION = '2.7.0'
4
4
  end
5
5
  end
@@ -106,17 +106,17 @@ module PT::Flow
106
106
  context 'no options' do
107
107
  it "pushes the current branch to origin, flags the story as finished, and opens github pull request URL" do
108
108
  UI.any_instance.should_receive(:run).with('git push origin new_feature.this-is-for-comments.4460038 -u')
109
- UI.any_instance.should_receive(:run).with("open \"https://github.com/cookpad/pt-flow/compare/new_feature...new_feature.this-is-for-comments.4460038?expand=1&title=This%20is%20for%20comments%20[Delivers%20%234460038]\"")
109
+ UI.any_instance.should_receive(:run).with("open \"https://github.com/cookpad/pt-flow/compare/new_feature...new_feature.this-is-for-comments.4460038?expand=1&title=[New%20Feature]%20This%20is%20for%20comments%20[Delivers%20%234460038]\"")
110
110
  UI.new('finish')
111
111
  current_branch.should == 'new_feature.this-is-for-comments.4460038'
112
112
  WebMock.should have_requested(:put, "#{endpoint}/projects/102622/stories/4460038").with(body: /<current_state>finished<\/current_state>/)
113
113
  end
114
114
  end
115
115
 
116
- context 'give option --wip' do
116
+ context 'given option --wip' do
117
117
  it "pushes the current branch to origin, and opens github [WIP] pull request URL" do
118
118
  UI.any_instance.should_receive(:run).with('git push origin new_feature.this-is-for-comments.4460038 -u')
119
- UI.any_instance.should_receive(:run).with("open \"https://github.com/cookpad/pt-flow/compare/new_feature...new_feature.this-is-for-comments.4460038?expand=1&title=[WIP]%20This%20is%20for%20comments%20[Delivers%20%234460038]\"")
119
+ UI.any_instance.should_receive(:run).with("open \"https://github.com/cookpad/pt-flow/compare/new_feature...new_feature.this-is-for-comments.4460038?expand=1&title=[WIP]%20[New%20Feature]%20This%20is%20for%20comments%20[Delivers%20%234460038]\"")
120
120
  UI.new('finish', ['--wip'])
121
121
  end
122
122
  end
@@ -137,7 +137,7 @@ module PT::Flow
137
137
 
138
138
  context 'https repo' do
139
139
  before do
140
- system('git checkout -B new_feature')
140
+ system('git checkout -B master')
141
141
  system('git remote rm origin')
142
142
  system('git remote add origin https://github.com/balvig/pt-flow.git')
143
143
 
@@ -146,8 +146,8 @@ module PT::Flow
146
146
  end
147
147
 
148
148
  it "pushes the current branch to origin, flags the story as finished, and opens a github pull request" do
149
- UI.any_instance.should_receive(:run).with('git push origin new_feature.this-is-for-comments.4460038 -u')
150
- UI.any_instance.should_receive(:run).with("open \"https://github.com/balvig/pt-flow/compare/new_feature...new_feature.this-is-for-comments.4460038?expand=1&title=This%20is%20for%20comments%20[Delivers%20%234460038]\"")
149
+ UI.any_instance.should_receive(:run).with('git push origin master.this-is-for-comments.4460038 -u')
150
+ UI.any_instance.should_receive(:run).with("open \"https://github.com/balvig/pt-flow/compare/master...master.this-is-for-comments.4460038?expand=1&title=This%20is%20for%20comments%20[Delivers%20%234460038]\"")
151
151
  UI.new('finish')
152
152
  end
153
153
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pt-flow
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Balvig
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-20 00:00:00.000000000 Z
11
+ date: 2015-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pt
@@ -217,3 +217,4 @@ test_files:
217
217
  - spec/support/fixture_macros.rb
218
218
  - spec/support/git_macros.rb
219
219
  - spec/support/webmock.rb
220
+ has_rdoc: