flash_flow 1.2.3.alpha → 1.2.3

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: 73df87f225f53804b6f04bc3974e7ad50a2e7593
4
- data.tar.gz: 36469747a24560104ed64c357b64412ef7a0ef33
3
+ metadata.gz: 3ba7a7fe175b96cc420cab775f520719c7fc83f5
4
+ data.tar.gz: 7d49a193d1430a55a3b42a135e8ec35838bb47cc
5
5
  SHA512:
6
- metadata.gz: e6f194f1021154559949b9a1256d792aa90a2b385a96f0a6577bddad4b3d829e7a2ebd37a07e2073fc8e6feca552908f2a758b56a47805c0e5cf5605469477d6
7
- data.tar.gz: 5ac260eae49b4b4d5d57a00a3a88956cb3c7368eb675b7331ea57af87c0c0e4d449b9e6421bab009512586b8d90ff713f477f58b43884555f267eb7dc9d32a72
6
+ metadata.gz: 2b11140dd538fef6a9b37e17d62ffe72174efe6efc723679f0b1982303a992c4de46ddd655fe1889a895dda67de6ca80bb6b6f27697e9a495692bbf81e1dfc0a
7
+ data.tar.gz: 29f7e831e2461baf974abf70fdff8ca3a21b34ff937ac993822c04da698963e6251cee1ae8abd791ef0f3493ed87924e97fb3e3316fe7e9b607b049fd835284e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flash_flow (1.2.3.alpha)
4
+ flash_flow (1.2.3)
5
5
  hipchat (~> 1.5)
6
6
  octokit (~> 4.1)
7
7
  pivotal-tracker (~> 0.5)
@@ -10,7 +10,8 @@ module FlashFlow
10
10
  extend Forwardable
11
11
 
12
12
  def_delegators :@collection, :add_story, :mergeable, :mark_deleted, :mark_success, :mark_failure,
13
- :remove_from_merge, :add_to_merge, :failures, :set_resolutions, :to_a, :can_ship?, :branch_link
13
+ :remove_from_merge, :add_to_merge, :failures, :successes, :removals, :set_resolutions,
14
+ :to_a, :can_ship?, :branch_link
14
15
 
15
16
  def initialize(branch_config, filename, git, opts={})
16
17
  @git = git
@@ -94,7 +94,15 @@ module FlashFlow
94
94
  end
95
95
 
96
96
  def failures
97
- @branches.select { |_, v| v.fail? }
97
+ current_branches.select { |branch| branch.fail? }
98
+ end
99
+
100
+ def successes
101
+ current_branches.select { |branch| branch.success? }
102
+ end
103
+
104
+ def removals
105
+ to_a.select { |branch| branch.removed? }
98
106
  end
99
107
 
100
108
  def fetch
@@ -113,12 +121,14 @@ module FlashFlow
113
121
 
114
122
  def add_to_merge(remote, ref)
115
123
  branch = record(remote, nil, ref)
124
+ branch.current_record = true
116
125
  @collection_instance.add_to_merge(branch) if @collection_instance.respond_to?(:add_to_merge)
117
126
  branch
118
127
  end
119
128
 
120
129
  def remove_from_merge(remote, ref)
121
130
  branch = record(remote, nil, ref)
131
+ branch.current_record = true
122
132
  branch.removed!
123
133
  @collection_instance.remove_from_merge(branch) if @collection_instance.respond_to?(:remove_from_merge)
124
134
  branch
@@ -51,7 +51,7 @@ module FlashFlow
51
51
  commit_rerere
52
52
  end
53
53
 
54
- @git.copy_temp_to_merge_branch
54
+ @git.copy_temp_to_merge_branch(commit_message)
55
55
  @git.delete_temp_merge_branch
56
56
  @git.push_merge_branch
57
57
  end
@@ -161,11 +161,11 @@ module FlashFlow
161
161
  def format_errors
162
162
  errors = []
163
163
  branch_not_merged = nil
164
- @data.failures.each do |full_ref, failure|
165
- if failure.ref == @local_git.working_branch
164
+ @data.failures.each do |branch|
165
+ if branch.ref == @local_git.working_branch
166
166
  branch_not_merged = "ERROR: Your branch did not merge to #{@local_git.merge_branch}. Run 'flash_flow --resolve', fix the merge conflict(s) and then re-run this script\n"
167
167
  else
168
- errors << "WARNING: Unable to merge branch #{failure.remote}/#{failure.ref} to #{@local_git.merge_branch} due to conflicts."
168
+ errors << "WARNING: Unable to merge branch #{branch.remote}/#{branch.ref} to #{@local_git.merge_branch} due to conflicts."
169
169
  end
170
170
  end
171
171
  errors << branch_not_merged if branch_not_merged
@@ -177,5 +177,21 @@ module FlashFlow
177
177
  end
178
178
  end
179
179
 
180
+ def commit_message
181
+ message =<<-EOS
182
+ Flash Flow run from branch: #{@local_git.working_branch}
183
+
184
+ Merged branches:
185
+ #{@data.successes.empty? ? 'None' : @data.successes.map(&:ref).join("\n")}
186
+
187
+ Failed branches:
188
+ #{@data.failures.empty? ? 'None' : @data.failures.map(&:ref).join("\n")}
189
+
190
+ Removed branches:
191
+ #{@data.removals.empty? ? 'None' : @data.removals.map(&:ref).join("\n")}
192
+ EOS
193
+ message.gsub(/'/, '')
194
+ end
195
+
180
196
  end
181
197
  end
@@ -68,7 +68,7 @@ module FlashFlow
68
68
  end
69
69
 
70
70
  def master_branch_contains?(ref)
71
- run("branch --contains #{ref}")
71
+ run("branch --contains #{ref}", log: CmdRunner::LOG_CMD)
72
72
  last_stdout.split("\n").detect { |str| str[2..-1] == master_branch }
73
73
  end
74
74
 
@@ -208,17 +208,13 @@ module FlashFlow
208
208
  run("push -f #{merge_remote} #{merge_branch}")
209
209
  end
210
210
 
211
- def copy_temp_to_merge_branch
211
+ def copy_temp_to_merge_branch(commit_message)
212
212
  run("checkout #{temp_merge_branch}")
213
213
  run("merge --strategy=ours --no-edit #{merge_branch}")
214
214
  run("checkout #{merge_branch}")
215
215
  run("merge #{temp_merge_branch}")
216
216
 
217
- squash_commits
218
- end
219
-
220
- def commit_message(log)
221
- "Flash Flow run from branch: #{working_branch}\n\n#{log}".gsub(/'/, '')
217
+ squash_commits(commit_message)
222
218
  end
223
219
 
224
220
  def delete_temp_merge_branch
@@ -248,11 +244,7 @@ module FlashFlow
248
244
 
249
245
  private
250
246
 
251
- def squash_commits
252
- # There are three commits created by flash flow that we don't need in the message
253
- run("log #{merge_remote}/#{merge_branch}..#{merge_branch}~3", log: CmdRunner::LOG_CMD)
254
- log = last_stdout
255
-
247
+ def squash_commits(commit_message)
256
248
  # Get all the files that differ between existing acceptance and new acceptance
257
249
  run("diff --name-only #{merge_remote}/#{merge_branch} #{merge_branch}")
258
250
  files = last_stdout.split("\n")
@@ -260,7 +252,7 @@ module FlashFlow
260
252
 
261
253
  run("add -f #{files.map { |f| "\"#{Shellwords.escape(f)}\"" }.join(" ")}")
262
254
 
263
- run("commit -m '#{commit_message(log)}'")
255
+ run("commit -m '#{commit_message}'")
264
256
  end
265
257
 
266
258
  def temp_merge_branch
@@ -16,8 +16,8 @@ module FlashFlow
16
16
  end
17
17
 
18
18
  def manual_instructions
19
- branch = check_for_conflict
20
- puts manual_not_merged_instructions(branch)
19
+ check_for_conflict
20
+ puts manual_not_merged_instructions
21
21
  end
22
22
 
23
23
  def start
@@ -60,7 +60,7 @@ module FlashFlow
60
60
  end
61
61
 
62
62
  def bash_message
63
- puts "\nPlease fix the following conflicts and then 'exit':\n#{unresolved_conflicts.join("\n")}\n\n"
63
+ puts "\nNote: You are in a special flash_flow directory (#{Dir.pwd}). The files still open in your editor will not reflect the merge conflicts, open them from this shell to get the conflicted versions.\n\nPlease fix the following conflicts and then 'exit':\n#{unresolved_conflicts.join("\n")}\n\n"
64
64
  end
65
65
 
66
66
  def launch_bash
@@ -82,7 +82,7 @@ module FlashFlow
82
82
  File.delete(filename)
83
83
  end
84
84
 
85
- def manual_not_merged_instructions(branch)
85
+ def manual_not_merged_instructions
86
86
  <<-EOS
87
87
 
88
88
  Run the following commands to fix the merge conflict and then re-run flash_flow:
@@ -1,3 +1,3 @@
1
1
  module FlashFlow
2
- VERSION = "1.2.3.alpha"
2
+ VERSION = "1.2.3"
3
3
  end
@@ -265,18 +265,54 @@ module FlashFlow
265
265
  end
266
266
 
267
267
  def test_failures
268
- branch1 = Branch.new('111', '111', '111')
269
- branch2 = Branch.new('222', '222', '222')
270
- branch3 = Branch.new('333', '333', '333')
271
- @collection.mark_failure(branch1)
272
- @collection.mark_success(branch2)
273
- @collection.mark_failure(branch3)
268
+ mark_branches
269
+
270
+ assert_equal(@collection.failures, [fail1, fail2])
271
+ end
274
272
 
275
- assert_equal(@collection.failures.values, [branch1, branch3])
273
+ def test_successes
274
+ mark_branches
275
+
276
+ assert_equal(@collection.successes, [success1, success2])
277
+ end
278
+
279
+ def test_removals
280
+ mark_branches
281
+
282
+ assert_equal(@collection.removals, [removed1])
276
283
  end
277
284
 
278
285
  private
279
286
 
287
+ def mark_branches
288
+ @collection.mark_failure(fail1)
289
+ @collection.mark_success(success1)
290
+ @collection.mark_failure(fail2)
291
+ @removed1 = @collection.remove_from_merge(removed1.remote, removed1.ref)
292
+ @collection.mark_success(success2)
293
+ @collection.mark_all_as_current
294
+ end
295
+
296
+ def fail1
297
+ @fail1 ||= Branch.new('111', '111', '111')
298
+ end
299
+
300
+ def fail2
301
+ @fail2 ||= Branch.new('333', '333', '333')
302
+ end
303
+
304
+ def success1
305
+ @success1 ||= Branch.new('222', '222', '222')
306
+ end
307
+
308
+ def success2
309
+ @success2 ||= Branch.new('555', '555', '555')
310
+ end
311
+
312
+ def removed1
313
+ @removed1 ||= Branch.new('444', '444', '444')
314
+ end
315
+
280
316
  def old_branches
281
317
  @old_branches ||= {
282
318
  'the_origin_url/some_old_branch' => Branch.from_hash({'ref' => 'some_old_branch', 'remote_url' => 'the_origin_url', 'remote' => 'origin', 'created_at' => (Time.now - 3600), 'stories' => ['111']}),
@@ -49,12 +49,12 @@ module FlashFlow
49
49
  end
50
50
 
51
51
  def test_print_errors_with_no_errors
52
- data.expect(:failures, {})
52
+ data.expect(:failures, [])
53
53
  assert_equal(@deploy.format_errors, 'Success!')
54
54
  end
55
55
 
56
56
  def test_print_errors_when_current_branch_cant_merge
57
- data.expect(:failures, {'origin/pushing_branch' => @branch})
57
+ data.expect(:failures, [@branch])
58
58
  @branch.fail!('some_random_sha')
59
59
 
60
60
  current_branch_error = "ERROR: Your branch did not merge to test_acceptance. Run 'flash_flow --resolve', fix the merge conflict(s) and then re-run this script\n"
@@ -65,7 +65,7 @@ module FlashFlow
65
65
  end
66
66
 
67
67
  def test_print_errors_when_another_branch_cant_merge
68
- data.expect(:failures, {'origin/pushing_branch' => @branch})
68
+ data.expect(:failures, [@branch])
69
69
 
70
70
  other_branch_error = "WARNING: Unable to merge branch origin/pushing_branch to test_acceptance due to conflicts."
71
71
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flash_flow
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3.alpha
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flashfunders
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-25 00:00:00.000000000 Z
11
+ date: 2015-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit
@@ -217,9 +217,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
217
217
  version: '0'
218
218
  required_rubygems_version: !ruby/object:Gem::Requirement
219
219
  requirements:
220
- - - ">"
220
+ - - ">="
221
221
  - !ruby/object:Gem::Version
222
- version: 1.3.1
222
+ version: '0'
223
223
  requirements: []
224
224
  rubyforge_project:
225
225
  rubygems_version: 2.2.2