capistrano_multiconfig_parallel 0.29.2 → 0.29.3

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: 781696cbf918698cb8fa4bb831068993a53acd56
4
- data.tar.gz: c8b0c8e165aca3b29c555406136f7bcd176e55be
3
+ metadata.gz: b46dc59e0272cf452cd04ad75a77bd0eafa664c9
4
+ data.tar.gz: a40e63eb0a7df1f623db2262f051991f4b38eef0
5
5
  SHA512:
6
- metadata.gz: f3257e284c3b77eeef486e2128b2d2bab01a8a464cefe12b2742e73a0711b991d4472bf72ac200145c237d9eccbea2f948e5a90414df974058aaedd91bf5aa9a
7
- data.tar.gz: 6156f245877f3f923747118a0585fa6f9a05559e57f4e99257cb44faa6b867081ec1f31a6f756a97ba1b278df02208a55eabb3338e01423ebf31726fce332d5c
6
+ metadata.gz: a4305d81d1a7bb49a9dc44377c9c90503e952ce54e3481fd6da7ec63342db89c683ed9426b87ac8020230d02d47a6ec0a349a9eb68684f2a7b868c914819cc10
7
+ data.tar.gz: ebc2361a965820426e792bb21c90265df0ab2ab45001940a4f759452a2e1e5d48e33a27e07d4de28ef7ab3de3dd8c9721306c6b2a66c2fbeb433824f41748ca8
@@ -45,22 +45,17 @@ module CapistranoMulticonfigParallel
45
45
  terminate
46
46
  end
47
47
 
48
- def fetch_cursor_position
49
- terminal_size = CapistranoMulticonfigParallel::Cursor.fetch_terminal_size
50
- @position ||= CapistranoMulticonfigParallel::Cursor.fetch_position
51
- return @position if terminal_size[:rows].nonzero? && position[:row] < (terminal_size[:rows] / 2)
52
- CapistranoMulticonfigParallel::Cursor.move_to_home!(0,0)
53
- @position = CapistranoMulticonfigParallel::Cursor.fetch_position
54
- @position
55
- end
56
-
57
48
  def display_table_on_terminal(table)
58
- cursor_position = fetch_cursor_position
49
+ @position ||= CapistranoMulticonfigParallel::Cursor.fetch_cursor_position
59
50
  CapistranoMulticonfigParallel::Cursor.display_on_screen("\n#{table}\n", @options.merge(position: @position))
60
- puts(@errors.join("\n")) if @errors.present? && @options.fetch('clear_screen', false).to_s == 'false'
51
+ print_errors
61
52
  signal_complete
62
53
  end
63
54
 
55
+ def print_errors
56
+ puts(@errors.join("\n")) if @errors.present? && @options.fetch('clear_screen', false).to_s == 'false'
57
+ end
58
+
64
59
  def setup_table_jobs(table)
65
60
  jobs = @manager.alive? ? @manager.jobs.dup : []
66
61
  jobs.each do |_job_id, job|
@@ -86,6 +81,5 @@ module CapistranoMulticonfigParallel
86
81
  terminate
87
82
  end
88
83
  end
89
-
90
84
  end
91
85
  end
@@ -4,6 +4,7 @@ module CapistranoMulticonfigParallel
4
4
  class Cursor
5
5
  class << self
6
6
  include CapistranoMulticonfigParallel::ApplicationHelper
7
+ attr_accessor :position
7
8
 
8
9
  def fetch_terminal_size
9
10
  size = (dynamic_size_stty || dynamic_size_tput || `echo $LINES $COLUMNS`)
@@ -11,20 +12,14 @@ module CapistranoMulticonfigParallel
11
12
  { rows: size[0].to_i, columns: size[1].to_i }
12
13
  end
13
14
 
14
- def fetch_position
15
- res = ''
16
- $stdin.raw do |stdin|
17
- $stdout << "\e[6n"
18
- $stdout.flush
19
- while (line = stdin.getc) != 'R'
20
- res << line if line
21
- end
22
- end
23
- position = res.match(/(?<row>\d+);(?<column>\d+)/)
24
- { row: position[:row].to_i, column: position[:column].to_i }
15
+ def fetch_cursor_position
16
+ terminal_size = fetch_terminal_size
17
+ position = fetch_position
18
+ return position if terminal_size[:rows].nonzero? && position[:row] < (terminal_size[:rows] / 2)
19
+ move_to_home!(0, 0)
20
+ fetch_position
25
21
  end
26
22
 
27
-
28
23
  def display_on_screen(string, options = {})
29
24
  options = options.is_a?(Hash) ? options.stringify_keys : {}
30
25
  position = options.fetch('position', nil)
@@ -37,16 +32,29 @@ module CapistranoMulticonfigParallel
37
32
  erase_from_current_line_to_bottom
38
33
  end
39
34
 
40
- private
35
+ private
36
+
37
+ def fetch_position
38
+ res = ''
39
+ $stdin.raw do |stdin|
40
+ $stdout << "\e[6n"
41
+ $stdout.flush
42
+ while (line = stdin.getc) != 'R'
43
+ res << line if line
44
+ end
45
+ end
46
+ position = res.match(/(?<row>\d+);(?<column>\d+)/)
47
+ { row: position[:row].to_i, column: position[:column].to_i }
48
+ end
41
49
 
42
50
  def dynamic_size_stty
43
- size = %x{stty size 2>/dev/null}
44
- size.present? ? size : nil
51
+ size = `stty size 2>/dev/null`
52
+ size.present? ? size : nil
45
53
  end
46
54
 
47
55
  def dynamic_size_tput
48
- lines %x{tput lines 2>/dev/null}
49
- cols = %x{tput cols 2>/dev/null}
56
+ lines `tput lines 2>/dev/null`
57
+ cols = `tput cols 2>/dev/null`
50
58
  lines.present? && cols.present? ? "#{lines} #{cols}" : nil
51
59
  end
52
60
 
@@ -85,7 +93,6 @@ module CapistranoMulticonfigParallel
85
93
  def terminal_clear
86
94
  system('cls') || system('clear') || puts("\e[H\e[2J")
87
95
  end
88
-
89
96
  end
90
97
  end
91
98
  end
@@ -1,7 +1,7 @@
1
1
  module CapistranoMulticonfigParallel
2
2
  # class that holds the options that are configurable for this gem
3
3
  module CoreHelper
4
- module_function
4
+ module_function
5
5
 
6
6
  def app_debug_enabled?
7
7
  configuration.multi_debug.to_s.downcase == 'true'
@@ -50,7 +50,7 @@ module CapistranoMulticonfigParallel
50
50
 
51
51
  def find_config_type(type)
52
52
  type = type.to_s
53
- ['boolean', 'filename'].include?(type) ? type.delete(':').to_sym : type.constantize
53
+ %w(boolean filename).include?(type) ? type.delete(':').to_sym : type.constantize
54
54
  end
55
55
 
56
56
  def find_env_multi_cap_root
@@ -13,7 +13,7 @@ Celluloid::WebSocket::Client::Connection.class_eval do
13
13
  'HTTP_SEC_WEBSOCKET_KEY' => SecureRandom.uuid,
14
14
  'HTTP_SEC_WEBSOCKET_PROTOCAL' => 'ws',
15
15
  'HTTP_SEC_WEBSOCKET_VERSION' => '13'
16
- )
16
+ )
17
17
  ::Rack::MockRequest.env_for(@url, env_hash)
18
18
  end
19
19
  end
@@ -8,7 +8,7 @@ module CapistranoMulticonfigParallel
8
8
  module VERSION
9
9
  MAJOR = 0
10
10
  MINOR = 29
11
- TINY = 2
11
+ TINY = 3
12
12
  PRE = nil
13
13
 
14
14
  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: 0.29.2
4
+ version: 0.29.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - bogdanRada