flash_flow 1.4.13 → 1.4.14

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: b9668bebe0723a492e320111ab89f3d46f15ddb1
4
- data.tar.gz: 14505cce79f449ed28992b66acfa45f63f25cd17
3
+ metadata.gz: 66d16b9e43df289304d066479e3a46b650f0f9e5
4
+ data.tar.gz: e30417e519a29160954eada65ff131ddc342f059
5
5
  SHA512:
6
- metadata.gz: fb2404b4d297947afcda81d1e8da2fb7fc3ec01698cca67bdeef94409c5e570a68ce98979df5b59915c23060d067c646e77d90ee574b689c10ea13781890347a
7
- data.tar.gz: b93e838c8db3ded79fd694562eb8ea716e25559a3c311694088274021c8429131094c0f77d717087c8b6affa122a3f9faf5d08a55836ad4ab45b103c86c6c402
6
+ metadata.gz: 61e991d545bf08e34cabc752d95502dbe607edcac1979baba3d8c827b78062862d5d97153c1089a6573bd8484fdda727da9e5e4e7c85213ee91a418414d7d515
7
+ data.tar.gz: cb351083d67e184c6829f671e05ac4ee0df92c486e751cf582f349739ee96943ba4556a2a27485f7529188b8781112e402e53c52acb6d42b422e95877839bd36
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- flash_flow (1.4.13)
4
+ flash_flow (1.4.14)
5
5
  google-api-client
6
6
  hipchat (~> 1.5)
7
7
  mail
@@ -34,6 +34,8 @@ case
34
34
  FlashFlow::Merge::Release.new(options).run
35
35
  when options[:gen_pdf_diffs]
36
36
  FlashFlow::Release::Base.new(FlashFlow::Config.configuration.release).gen_pdf_diffs(*options[:gen_pdf_diffs])
37
+ when options[:merge_release_email]
38
+ FlashFlow::Merge::Master.new(options).send_mail
37
39
  when options[:merge_release]
38
40
  FlashFlow::Merge::Master.new(options).run
39
41
  when options[:notify_compliance]
@@ -80,6 +80,10 @@ module FlashFlow
80
80
  def pending_release
81
81
  releases.detect { |r| r['status'] == 'Pending' }
82
82
  end
83
+
84
+ def ready_to_merge_release
85
+ releases.detect { |r| r['status'] == 'Ready to merge' }
86
+ end
83
87
  end
84
88
  end
85
89
  end
@@ -75,6 +75,10 @@ module FlashFlow
75
75
  @data.pending_release
76
76
  end
77
77
 
78
+ def ready_to_merge_release
79
+ @data.ready_to_merge_release
80
+ end
81
+
78
82
  def release_ahead_of_master?
79
83
  @git.ahead_of_master?("#{@git.remote}/#{@git.release_branch}")
80
84
  end
@@ -13,28 +13,39 @@ module FlashFlow
13
13
  @data = Data::Base.new({}, Config.configuration.branch_info_file, @git, logger: logger)
14
14
  end
15
15
 
16
+ def send_mail
17
+ check_version
18
+ puts "Checking #{@git.release_branch} QA approval"
19
+ logger.info "\n\n### Beginning check of #{@git.release_branch} QA ###\n\n"
20
+
21
+ @lock.with_lock do
22
+ release = pending_release
23
+ ready!(release)
24
+
25
+ send_release_ready_email(release)
26
+ end
27
+
28
+ logger.info "### Sent release email ###"
29
+ rescue Lock::Error, NothingToMergeError, FlashFlow::Release::QAError, VersionError => e
30
+ puts 'Failure!'
31
+ puts e.message
32
+ ensure
33
+ @local_git.run("checkout #{@local_git.working_branch}")
34
+ end
35
+
16
36
  def run
17
37
  begin
18
38
  check_version
19
- # puts "Merging #{@git.release_branch} into #{@git.master_branch}"
20
- # logger.info "\n\n### Beginning merge of #{@git.release_branch} into #{@git.master_branch} ###\n\n"
21
- puts "Checking #{@git.release_branch} QA approval"
22
- logger.info "\n\n### Beginning check of #{@git.release_branch} QA ###\n\n"
39
+ puts "Merging #{@git.release_branch} into #{@git.master_branch}"
40
+ logger.info "\n\n### Beginning merge of #{@git.release_branch} into #{@git.master_branch} ###\n\n"
23
41
 
24
- mergers, errors = [], []
42
+ errors = []
25
43
 
26
44
  @lock.with_lock do
27
- release = pending_release
28
- if !release
29
- raise NothingToMergeError.new("There is no pending release.")
30
- elsif !release_ahead_of_master?
31
- raise NothingToMergeError.new("The release branch '#{@git.release_branch}' has no commits that are not in master")
32
- elsif !release_qa_approved?
33
- raise FlashFlow::Release::QAError.new("The release build '#{get_release_sha(short: true)}' has not been approved for release")
34
- end
35
-
36
- # errors = merge_master(release)
37
- send_release_ready_email(release)
45
+ release = pending_release || ready_to_merge_release
46
+ ready!(release)
47
+
48
+ errors = merge_master(release)
38
49
  end
39
50
 
40
51
  if errors.empty?
@@ -57,6 +68,8 @@ module FlashFlow
57
68
  @git.initialize_rerere
58
69
  end
59
70
 
71
+ mergers = []
72
+
60
73
  @git.in_branch(@git.master_branch) do
61
74
  @git.run("reset --hard origin/master")
62
75
  merge_branches([Data::Branch.new(@git.release_branch)]) do |branch, merger|
@@ -71,17 +84,22 @@ module FlashFlow
71
84
  raise GitPushFailure.new("Unable to push to #{@git.master_branch}. See log for details.")
72
85
  end
73
86
 
74
- mark_release_success(release, @git.get_sha(@git.master_branch))
87
+ release['status'] = 'Success'
88
+ release['released_sha'] = @git.get_sha("#{@git.remote}/#{@git.master_branch}")
89
+ write_data('Release info updated [ci skip]')
75
90
  end
76
91
 
77
92
  errors
78
93
  end
79
94
 
80
- def mark_release_success(release, sha)
81
- release['status'] = 'Success'
82
- release['released_sha'] = sha
83
-
84
- write_data('Release merged [ci skip]')
95
+ def ready!(release)
96
+ if !release
97
+ raise NothingToMergeError.new("There is no pending release.")
98
+ elsif !release_ahead_of_master?
99
+ raise NothingToMergeError.new("The release branch '#{@git.release_branch}' has no commits that are not in master")
100
+ elsif !release_qa_approved?
101
+ raise FlashFlow::Release::QAError.new("The release build '#{get_release_sha(short: true)}' has not been approved for release")
102
+ end
85
103
  end
86
104
 
87
105
  def release_qa_approved?
@@ -93,7 +111,9 @@ module FlashFlow
93
111
  begin
94
112
  mailer = FlashFlow::Mailer::Base.new(Config.configuration.smtp)
95
113
  mailer.deliver!(:release_ready, { approved_sha: get_release_sha(short: true) })
96
- mark_release_success(release, get_release_sha)
114
+
115
+ release['status'] = 'Ready to merge'
116
+ write_data('Release info updated [ci skip]')
97
117
  rescue ArgumentError => e
98
118
  raise FlashFlow::Release::QAError.new("Cannot send the email: #{e}")
99
119
  end
@@ -26,6 +26,7 @@ module FlashFlow
26
26
  opts.on('--merge-status-html', 'Show status of all branches and their stories in html format and exit') { |v| options[:merge_status_html] = true }
27
27
  opts.on('--make-release branch1,branch2', 'Comma-delimited list of branches to merge to the release branch. Run "--merge-release ready" to merge all ready to ship branches') { |v| options[:release_branches] = v.split(',') }
28
28
  opts.on('--gen-pdf-diffs output_file,build_id,threshold', 'Generate a pdf file with screenshot differences for the specified (latest) build. output_file is required. build_id defaults to the latest build. threshold defaults to 0') { |v| options[:gen_pdf_diffs] = v.split(',') }
29
+ opts.on('--merge-release-email', 'Send an email if the release is ready to be merged to master') { |v| options[:merge_release_email] = true }
29
30
  opts.on('--merge-release', 'Merge the release branch into the master branch and push') { |v| options[:merge_release] = true }
30
31
  opts.on('--notify-compliance', 'Send the compliance notification email if everything is ready') { |v| options[:notify_compliance] = true }
31
32
 
@@ -1,3 +1,3 @@
1
1
  module FlashFlow
2
- VERSION = '1.4.13'
2
+ VERSION = '1.4.14'
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.13
4
+ version: 1.4.14
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-22 00:00:00.000000000 Z
11
+ date: 2016-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: octokit