capistrano_multiconfig_parallel 2.7.1 → 2.8.0

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: 0ed328fa0087e607d4ceea9e7252aaab777af0b2
4
- data.tar.gz: 2a33e3fa7789d488509f3954985fe3a08b13ea8f
3
+ metadata.gz: c0c51f13a444f7f6dec0885bfb772ed94b30c75a
4
+ data.tar.gz: c48a808ce7a4ab1b1080a9c684a6f15de0fa5533
5
5
  SHA512:
6
- metadata.gz: cd51b1440e0c5e35d5d8f6533c009b40e55a7010554c13a73a2002c6896d52bd4e20771e591685f76373906d5ea04d57eeaf14bf62c3fbc50c9ab6192a1dab53
7
- data.tar.gz: 064c770db3662fd8830f46718bd5158b0c46c3ba0f23a430f5879a7ac0b9ef360598ca42ec6c1d9b3d43b981720f779b3b96bda64a9704e2596a6f41c1c60604
6
+ metadata.gz: 58237118c9429a9388020f6153c7bc462394fb5f2b59cf0a521e984f2b98bf9087db6f998583f05b724b50c500a38d1d6a833ed74d734e104b89fff79716c16c
7
+ data.tar.gz: c8196672583a80018516959201e05259f269106c7135154d00f4160ef4a5345248409f7f5282197ed5ba435dba183e0552b84d6fc6bb74a08a0e03041d17a97c
@@ -34,7 +34,7 @@ require 'forwardable'
34
34
  require 'English'
35
35
 
36
36
  # fix error with not files that can not be found
37
- Gem.find_files('composable_state_machine/**/*.rb').each { |path| require path }
37
+ Gem.find_files('composable_state_machine/**/*.rb').each { |path| require path }
38
38
 
39
39
  require_relative './helpers/base_actor_helper'
40
40
 
@@ -45,5 +45,3 @@ end
45
45
  %w(version base application).each do |filename|
46
46
  Gem.find_files("capistrano_multiconfig_parallel/#{filename}.rb").each { |path| require path }
47
47
  end
48
-
49
- Terminal::Table::Style.defaults = {:width => 140}
@@ -33,7 +33,7 @@ module CapistranoMulticonfigParallel
33
33
  else
34
34
  @progress_bar ||= PowerBar.new
35
35
  @progress_bar.define_singleton_method :terminal_width do
36
- 36
36
+ CapistranoMulticonfigParallel::ApplicationHelper::DEFAULT_TEXT_LENGTH
37
37
  end
38
38
  @progress_bar.settings.tty.finite.template.main = \
39
39
  "${<msg>} ${<bar> } ${<percent>%}" # + "${<rate>/s} ${<elapsed>}${ ETA: <eta>}"
@@ -43,7 +43,8 @@ module CapistranoMulticonfigParallel
43
43
  @progress_bar.settings.tty.finite.template.close = "\e[?25h\e[0mFINISHED \n" # clean up after us
44
44
  @progress_bar.settings.tty.finite.output = Proc.new{ |data|
45
45
  if data.present? && data.include?("Error") || data.include?("Installing")
46
- @job.bundler_check_status = data.include?("Error") ? data.to_s.red : data.to_s.green
46
+ @job.bundler_check_status_colour = data.include?("Error") ? :red : :green
47
+ @job.bundler_check_status = data.to_s
47
48
  send_msg(CapistranoMulticonfigParallel::BundlerTerminalTable.topic, type: 'event', data: data.to_s.uncolorize )
48
49
  end
49
50
  }
@@ -51,10 +51,18 @@ module CapistranoMulticonfigParallel
51
51
 
52
52
  def worker_state
53
53
  if job.status.to_s.downcase != 'dead' && Actor.current.alive?
54
- @machine.state.to_s.green
54
+ @machine.state.to_s
55
55
  else
56
56
  job.status = 'dead'
57
- job.status.upcase.red
57
+ job.status.upcase
58
+ end
59
+ end
60
+
61
+ def state_colour
62
+ if job.status.to_s.downcase != 'dead' && Actor.current.alive?
63
+ return :green
64
+ else
65
+ return :red
58
66
  end
59
67
  end
60
68
 
@@ -25,7 +25,7 @@ module CapistranoMulticonfigParallel
25
25
 
26
26
  def on_read_stdout(data)
27
27
  @show_bundler = false if data.to_s.include?("The Gemfile's dependencies are satisfied") || data.to_s.include?("Bundle complete")
28
- @actor.async.update_machine_state(truncate(data, 36), :bundler => true) if @show_bundler == true && data.strip.present? && data.strip != '.'
28
+ @actor.async.update_machine_state(truncate(data, CapistranoMulticonfigParallel::ApplicationHelper::DEFAULT_TEXT_LENGTH), :bundler => true) if @show_bundler == true && data.strip.present? && data.strip != '.'
29
29
  io_callback('stdout', data)
30
30
  end
31
31
 
@@ -51,7 +51,7 @@ module CapistranoMulticonfigParallel
51
51
  { value: wrap_string(job_stage_for_terminal) },
52
52
  { value: wrap_string(capistrano_action) },
53
53
  { value: terminal_env_variables.map { |str| wrap_string(str) }.join("\n") },
54
- { value: wrap_string(worker_state) }
54
+ { value: wrap_coloured_string(*worker_state) }
55
55
  ]
56
56
  end
57
57
  end
@@ -61,7 +61,7 @@ module CapistranoMulticonfigParallel
61
61
  { value: wrap_string(id.to_s) },
62
62
  { value: wrap_string(File.basename(job.job_path)) },
63
63
  { value: wrap_string("bundle check || bundle install") },
64
- { value: wrap_string(bundler_check_status.to_s) }
64
+ { value: wrap_coloured_string(bundler_check_status.to_s, color: bundler_check_status_colour) }
65
65
  ]
66
66
  end
67
67
 
@@ -71,7 +71,7 @@ module CapistranoMulticonfigParallel
71
71
  { value: wrap_string(job_stage_for_terminal) },
72
72
  { value: wrap_string("Setting up gems..") },
73
73
  { value: terminal_env_variables.map { |str| wrap_string(str) }.join("\n") },
74
- { value: wrap_string(status.to_s.green) }
74
+ { value: wrap_coloured_string(status.to_s, color: :green) }
75
75
  ]
76
76
  end
77
77
 
@@ -89,8 +89,12 @@ module CapistranoMulticonfigParallel
89
89
 
90
90
  def worker_state
91
91
  worker_obj = worker
92
- default = status.to_s.upcase.red
93
- worker_died? ? default : worker_obj.worker_state
92
+ default = status.to_s.upcase
93
+ if worker_died?
94
+ [default, color: :red]
95
+ else
96
+ [worker_obj.worker_state, color: worker.state_colour]
97
+ end
94
98
  end
95
99
 
96
100
  def id
@@ -108,6 +112,7 @@ module CapistranoMulticonfigParallel
108
112
  { name: 'exit_status', default: nil },
109
113
  { name: 'bundler_status', default: nil },
110
114
  { name: 'bundler_check_status', default: nil },
115
+ { name: 'bundler_check_status_colour', default: :green },
111
116
  { name: 'new_jobs_dispatched', default: [] },
112
117
  { name: 'will_dispatch_new_job', default: nil },
113
118
  ].each do |hash|
@@ -7,6 +7,8 @@ require_relative './capistrano_helper'
7
7
  module CapistranoMulticonfigParallel
8
8
  # class that holds the options that are configurable for this gem
9
9
  module ApplicationHelper
10
+ DEFAULT_TEXT_LENGTH = 22
11
+
10
12
  include CapistranoMulticonfigParallel::InternalHelper
11
13
  include CapistranoMulticonfigParallel::CoreHelper
12
14
  include CapistranoMulticonfigParallel::ParseHelper
@@ -78,9 +80,20 @@ module CapistranoMulticonfigParallel
78
80
  [args.select(&:present?), options]
79
81
  end
80
82
 
81
- def wrap_string(string, options = {})
83
+ def internal_wrap_string(string, options = {})
82
84
  options.stringify_keys!
83
- string.scan(/.{#{options.fetch('length', 36)}}|.+/).map(&:strip).join(options.fetch('character', $INPUT_RECORD_SEPARATOR))
85
+ string.scan(/.{#{options.fetch('length', CapistranoMulticonfigParallel::ApplicationHelper::DEFAULT_TEXT_LENGTH)}}|.+/).map(&:strip)
86
+ end
87
+
88
+ def wrap_string(string, options = {})
89
+ internal_wrap_string(string, options).join(options.fetch('character', $INPUT_RECORD_SEPARATOR))
90
+ end
91
+
92
+ def wrap_coloured_string(string, options = {})
93
+ new_array = internal_wrap_string(string, options).collect do |str|
94
+ str.colorize(options["color"].to_s.to_sym)
95
+ end
96
+ new_array.join(options.fetch('character', $INPUT_RECORD_SEPARATOR))
84
97
  end
85
98
 
86
99
  def percent_of(index, total)
@@ -8,8 +8,8 @@ module CapistranoMulticonfigParallel
8
8
  module VERSION
9
9
 
10
10
  MAJOR = 2
11
- MINOR = 7
12
- TINY = 1
11
+ MINOR = 8
12
+ TINY = 0
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano_multiconfig_parallel
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.1
4
+ version: 2.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - bogdanRada