hu 1.2.2 → 1.2.3

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 +17 -5
  3. data/lib/hu/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: efbe6862cd755894d50414fe407e2bb130f2dc44
4
- data.tar.gz: cf6a2b41e9211b07049d71849dc958e1d1fc9ed0
3
+ metadata.gz: 7a3481b94745be691e1fc4f00dd65c648d084591
4
+ data.tar.gz: e04ccde7b6b9aab97db2c1e121db046c06e046e1
5
5
  SHA512:
6
- metadata.gz: b661bea48bd6b9d90d064c737df0e8dfb9ded4f1cf978e6e978ca1155d45e703d96f0983b86fd18f522d1cb996e92c5c3771488f875403d2e25cd3fc796e589e
7
- data.tar.gz: f825acd9b672a8f64020ef0e999a845d6f2049370262ddd7b4cc02014dcac0387e1559a723a7d4479d75752fd14c4abd706bbabe687edc60777cf27640d9c7d5
6
+ metadata.gz: 9112e6e1b3b044ea865335987c1e4cd0234af0ecc116fbe2866fac9c37ac4676173347972ec665b641636f1cb56c0799f22fada3fd5c608eb5a794429e1376b2
7
+ data.tar.gz: cba66c9948857c833863937bc93550a7445c66bae5e571a867062920087062be238925261c0965918bc6e5e28cb511124327fdad4a32f4c6e8e7d0afbd81c131
@@ -17,6 +17,7 @@ module Hu
17
17
  class Cli < Optix::Cli
18
18
  class Deploy < Optix::Cli
19
19
  @@shutting_down = false
20
+ @@spinner = nil
20
21
 
21
22
  text "Interactive deployment."
22
23
  desc "Interactive deployment"
@@ -32,14 +33,25 @@ module Hu
32
33
  end
33
34
 
34
35
  def deploy(cmd, opts, argv)
35
- trap('INT') { shutdown; safe_abort }
36
+ trap('INT') { shutdown; safe_abort; exit 1 }
36
37
  at_exit {
37
38
  if 130 == $!.status
38
39
  shutdown
39
40
  puts
40
41
  safe_abort
42
+ exit $!.status
41
43
  end
42
44
  }
45
+
46
+ unless File.exists? '.git'
47
+ puts
48
+ puts "You need to be inside the working directory of the app that you wish to deploy.".color(:red)
49
+ puts
50
+ safe_abort
51
+ print TTY::Cursor.prev_line
52
+ exit 1
53
+ end
54
+
43
55
  push_url = get_heroku_git_remote
44
56
 
45
57
  wc_update = Thread.new { update_working_copy }
@@ -151,8 +163,7 @@ module Hu
151
163
  puts
152
164
  anykey
153
165
  when :abort_ask
154
- delete_branch("release/#{release_tag}")
155
- puts
166
+ puts if delete_branch("release/#{release_tag}")
156
167
  exit 0
157
168
  when :retag
158
169
  if delete_branch("release/#{release_tag}")
@@ -449,6 +460,7 @@ module Hu
449
460
  existing_branch = branches.find {|e| e.start_with? 'release/'}
450
461
  branch_already_exists = !existing_branch.nil?
451
462
  release_tag = existing_branch[8..-1] if keep_existing && branch_already_exists
463
+
452
464
  if branch_already_exists && !keep_existing
453
465
  choice = prompt.expand("The branch '"+"release/#{release_tag}".color(:red)+"' already exists. What shall we do?",
454
466
  {default: 0}) do |q|
@@ -475,6 +487,7 @@ module Hu
475
487
  release_tag = develop_tag
476
488
  else
477
489
  start_release(release_tag)
490
+ puts
478
491
  end
479
492
  end
480
493
 
@@ -566,7 +579,7 @@ module Hu
566
579
  end
567
580
 
568
581
  def safe_abort
569
- @@spinner.stop
582
+ @@spinner&.stop
570
583
  printf "\e[0m\e[?25l"
571
584
  printf '(ヘ・_・)ヘ┳━┳'
572
585
  sleep 0.5
@@ -583,7 +596,6 @@ module Hu
583
596
  printf "\e[17D "
584
597
  printf "\e[?25h"
585
598
  puts
586
- exit 1
587
599
  end
588
600
  end
589
601
  end
@@ -1,3 +1,3 @@
1
1
  module Hu
2
- VERSION = "1.2.2"
2
+ VERSION = "1.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.2
4
+ version: 1.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - moe