flash_flow 1.4.2 → 1.4.4

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: 82f7cd93c4e7ee082a902f0742453e7e7b187743
4
- data.tar.gz: 5e472f2e130e8e7cac9d41b4cedd930eab6a8a9a
3
+ metadata.gz: 850c7954c81a98af1fd93586fa26480206f77e1b
4
+ data.tar.gz: 84c7d961f340a47df35b7815ef8aa28b476dd044
5
5
  SHA512:
6
- metadata.gz: ec4fd9f3d07dfb14032ff017c959bcde30d050d5a2910127d03a55869966f251e29ff7f115238ae805a8882450a3dcb1517cfca0aa7a09360985f8ed0f633fb4
7
- data.tar.gz: 2b1dfbdeff424442bb95d6538c00e56f681b591711b3e09df034f1260f80bf57943eb77fe2fcec5637902d93865f61eff5d0c3ebb077202174f1cd21208ea28c
6
+ metadata.gz: 3152a86788e0a3a1ced7ce324b53de41c7675f16db7fb7c0c234be495240794e18e5e06363791082f08eb8fee9ef408bd8ad9ded1e90dcc5621f4876a6bfd00c
7
+ data.tar.gz: a24836c67acb42b3125694d48b063516393f08c83ba390ae4fef7d7d75929ff589ed4796a4ed89112a01ef1185f0254ab72b4e3365c7e68de6fe8d521b7d5637
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flash_flow (1.4.2)
4
+ flash_flow (1.4.4)
5
5
  hipchat (~> 1.5)
6
6
  octokit (~> 4.1)
7
7
  percy-client
@@ -1,4 +1,5 @@
1
1
  require 'json'
2
+ require 'flash_flow/time_helper'
2
3
  require 'flash_flow/version'
3
4
  require 'flash_flow/data/branch'
4
5
  require 'flash_flow/data/collection'
@@ -28,13 +29,16 @@ module FlashFlow
28
29
  collection = Collection.fetch(branch_config)
29
30
  # Order matters. We are marking the PRs as current, not the branches stored in the json
30
31
  collection.mark_all_as_current
31
- collection.reverse_merge(stored_collection)
32
+ collection = collection.reverse_merge(stored_collection)
32
33
 
33
34
  else
34
35
  collection = stored_collection
35
36
  collection.mark_all_as_current
36
- collection
37
37
  end
38
+
39
+ collection.branches.delete_if { |k, v| TimeHelper.massage_time(v.updated_at) < Time.now - TimeHelper.two_weeks }
40
+
41
+ collection
38
42
  end
39
43
 
40
44
  def version
@@ -1,4 +1,5 @@
1
1
  require 'json'
2
+ require 'flash_flow/time_helper'
2
3
 
3
4
  module FlashFlow
4
5
  module Data
@@ -25,22 +26,11 @@ module FlashFlow
25
26
  branch.stories = hash['stories']
26
27
  branch.metadata = hash['metadata']
27
28
  branch.conflict_sha = hash['conflict_sha'] || hash['metadata'].to_h['conflict_sha']
28
- branch.updated_at = massage_time(hash['updated_at'])
29
- branch.created_at = massage_time(hash['created_at'])
29
+ branch.updated_at = TimeHelper.massage_time(hash['updated_at'])
30
+ branch.created_at = TimeHelper.massage_time(hash['created_at'])
30
31
  branch
31
32
  end
32
33
 
33
- def self.massage_time(time)
34
- case time
35
- when Time
36
- time
37
- when NilClass
38
- Time.now
39
- else
40
- Time.parse(time)
41
- end
42
- end
43
-
44
34
  def ==(other)
45
35
  other.ref == ref
46
36
  end
@@ -1,11 +1,9 @@
1
1
  require 'pivotal-tracker'
2
- require 'time'
3
2
  require 'flash_flow/time_helper'
4
3
 
5
4
  module FlashFlow
6
5
  module IssueTracker
7
6
  class Pivotal
8
- include TimeHelper
9
7
 
10
8
  def initialize(branches, git, opts={})
11
9
  @branches = branches
@@ -125,7 +123,7 @@ module FlashFlow
125
123
  story = get_story(story_id)
126
124
  if story
127
125
  unless has_shipped_text?(story)
128
- story.notes.create(:text => with_time_zone(@timezone) { Time.now.strftime(note_time_format) })
126
+ story.notes.create(:text => TimeHelper.with_time_zone(@timezone) { Time.now.strftime(note_time_format) })
129
127
  end
130
128
  end
131
129
  end
@@ -1,4 +1,5 @@
1
1
  require 'flash_flow/merge/base'
2
+ require 'flash_flow/time_helper'
2
3
 
3
4
  module FlashFlow
4
5
  module Merge
@@ -61,16 +62,12 @@ module FlashFlow
61
62
  end
62
63
 
63
64
  def commit_rerere
64
- current_branches = @data.to_a.select { |branch| !@git.master_branch_contains?(branch.sha) && (Time.now - branch.updated_at < two_weeks) }
65
+ current_branches = @data.to_a.select { |branch| !@git.master_branch_contains?(branch.sha) && (Time.now - branch.updated_at < TimeHelper.two_weeks) }
65
66
  current_rereres = current_branches.map { |branch| branch.resolutions.to_h.values }.flatten
66
67
 
67
68
  @git.commit_rerere(current_rereres)
68
69
  end
69
70
 
70
- def two_weeks
71
- 60 * 60 * 24 * 14
72
- end
73
-
74
71
  def process_result(branch, merger)
75
72
  case merger.result
76
73
  when :deleted
@@ -48,7 +48,7 @@ module FlashFlow
48
48
 
49
49
  def merge_conflicted
50
50
  @git.run("checkout #{branch.conflict_sha}")
51
- @git.run("merge {@git.remote}/#{working_branch}")
51
+ @git.run("merge #{@git.remote}/#{working_branch}")
52
52
  end
53
53
 
54
54
  def git_reset
@@ -1,5 +1,8 @@
1
+ require 'time'
2
+
1
3
  module FlashFlow
2
4
  module TimeHelper
5
+
3
6
  def with_time_zone(tz_name)
4
7
  prev_tz = ENV['TZ']
5
8
  ENV['TZ'] = tz_name
@@ -7,5 +10,23 @@ module FlashFlow
7
10
  ensure
8
11
  ENV['TZ'] = prev_tz
9
12
  end
13
+
14
+ def massage_time(time)
15
+ case time
16
+ when Time
17
+ time
18
+ when NilClass
19
+ Time.now
20
+ else
21
+ Time.parse(time)
22
+ end
23
+ end
24
+
25
+ def two_weeks
26
+ 60 * 60 * 24 * 14
27
+ end
28
+
29
+ module_function :with_time_zone, :massage_time, :two_weeks
30
+
10
31
  end
11
32
  end
@@ -1,3 +1,3 @@
1
1
  module FlashFlow
2
- VERSION = "1.4.2"
2
+ VERSION = "1.4.4"
3
3
  end
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.4.2
4
+ version: 1.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Flashfunders
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-11 00:00:00.000000000 Z
11
+ date: 2016-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit