hu 1.4.2 → 1.4.4

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/hu/deploy.rb +51 -1
  3. data/lib/hu/version.rb +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c52de3790edcdcef2f449d3aff6a7dd083d06c99
4
- data.tar.gz: 2c9929a304844d941ed96cff16db3a329eccb598
3
+ metadata.gz: ab85216f272433e54ed07a51cbfcb16b3af59b65
4
+ data.tar.gz: 13d3ade3dfd5f3ce55b98d55630fa603f15157d2
5
5
  SHA512:
6
- metadata.gz: 3fe692a4de2f703438e2fcfaa195cb3d5be96f51e933ade01cb1c289d3907e5cca88ccea28f8fb74d0cbfaeb7175da96bce7c0cf68618b74677f21f6af808d11
7
- data.tar.gz: 80254aec7c7e99fbcb29dde38676de98576d1c67a3859682757cbfcebdb7d8fa8c2c9f139ee77f3210a95fd73430d30cc0e31bf3a47109b17acb8f6ad86459cb
6
+ metadata.gz: 70526faca386e04a0207e6f80096c6a193f3ad38e5fd2ab911e70b8f138e3be6c311a1823f4318f354077bf60026b5f30b9267a8fa005f18cc47eeb5603f45b2
7
+ data.tar.gz: f3734f5b47903fc965efc705545032357c706e48b78215e3482c68adb013eca7c8acdd6d74ccb7cc5b1b08f275dac4a28de71d8ab0bf9344266da2cbc8688294
@@ -29,6 +29,9 @@ module Hu
29
29
  $stdout.sync
30
30
  @@shutting_down = false
31
31
  @@spinner = nil
32
+ @@home_branch = nil
33
+
34
+ MINIMUM_GIT_VERSION = Versionomy.parse('2.9.0')
32
35
 
33
36
  text 'Interactive deployment.'
34
37
  desc 'Interactive deployment'
@@ -52,6 +55,7 @@ module Hu
52
55
  end
53
56
  Hu::Tm.flush!
54
57
  shutdown
58
+ return_to_home_branch
55
59
  print "\e[0m\e[?25h"
56
60
  end
57
61
 
@@ -103,6 +107,7 @@ module Hu
103
107
  end
104
108
 
105
109
  push_url = heroku_git_remote
110
+ @@home_branch = current_branch_name
106
111
 
107
112
  wc_update = Thread.new { update_working_copy }
108
113
 
@@ -145,6 +150,14 @@ module Hu
145
150
  wc_update.join
146
151
  unbusy
147
152
 
153
+ unless develop_can_be_merged_into_master?
154
+ puts
155
+ puts "ERROR: It seems like a merge of 'develop' into 'master' would fail.".color(:red)
156
+ puts " Aborting early to prevent a merge conflict.".color(:red)
157
+ puts
158
+ exit 1
159
+ end
160
+
148
161
  highest_version = find_highest_version_tag
149
162
  begin
150
163
  highest_versionomy = Versionomy.parse(highest_version)
@@ -434,8 +447,13 @@ module Hu
434
447
  table << r
435
448
  end
436
449
 
450
+ git_version_warning = ''
451
+ if current_git_version < MINIMUM_GIT_VERSION
452
+ git_version_warning = " (your git is outdated. please upgrade to v#{MINIMUM_GIT_VERSION}!)".color(:black).bright
453
+ end
454
+
437
455
  puts "\e[H\e[2J" if clear
438
- puts " PIPELINE #{pipeline_name} ".inverse
456
+ puts " PIPELINE #{pipeline_name} ".inverse+git_version_warning
439
457
  puts
440
458
 
441
459
  puts table.render(:unicode, padding: [0, 1, 0, 1], multiline: true)
@@ -836,6 +854,38 @@ module Hu
836
854
  Hu::Tm.t(:abort_merge, cmd: 'deploy')
837
855
  end
838
856
 
857
+ def return_to_home_branch
858
+ return if @@home_branch.nil? or @@home_branch == current_branch_name
859
+ run_each <<-EOS.strip_heredoc
860
+ :quiet
861
+ :nospinner
862
+ :return
863
+ # Return to home branch
864
+ git checkout #{@@home_branch}
865
+ EOS
866
+ Hu::Tm.t(:return_home, cmd: 'deploy')
867
+ end
868
+
869
+ def develop_can_be_merged_into_master?
870
+ status = run_each <<-EOS.strip_heredoc
871
+ :quiet
872
+ :nospinner
873
+ :return
874
+ git checkout develop
875
+ git diff --exit-code --quiet develop..master || { git format-patch master --stdout >/tmp/hu.diff.tmp && git checkout master && git apply --check </tmp/hu.diff.tmp ; }
876
+ rm -f /tmp/hu.diff.tmp
877
+ EOS
878
+ status == 0
879
+ end
880
+
881
+ def current_branch_name
882
+ @git.head.name.sub(/^refs\/heads\//, '')
883
+ end
884
+
885
+ def current_git_version
886
+ Versionomy.parse(`git --version`.chomp.split(' ')[-1])
887
+ end
888
+
839
889
  def create_changelog(env)
840
890
  if File.executable? '.hu/hooks/changelog'
841
891
  env.each { |k, v| ENV[k] = v }
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Hu
3
- VERSION = '1.4.2'
3
+ VERSION = '1.4.4'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hu
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
  - moe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-16 00:00:00.000000000 Z
11
+ date: 2016-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler