capistrano_multiconfig_parallel 0.29.2 → 0.29.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.
- checksums.yaml +4 -4
- data/lib/capistrano_multiconfig_parallel/celluloid/terminal_table.rb +6 -12
- data/lib/capistrano_multiconfig_parallel/classes/cursor.rb +25 -18
- data/lib/capistrano_multiconfig_parallel/helpers/core_helper.rb +1 -1
- data/lib/capistrano_multiconfig_parallel/helpers/internal_helper.rb +1 -1
- data/lib/capistrano_multiconfig_parallel/initializers/websocket.rb +1 -1
- data/lib/capistrano_multiconfig_parallel/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b46dc59e0272cf452cd04ad75a77bd0eafa664c9
|
4
|
+
data.tar.gz: a40e63eb0a7df1f623db2262f051991f4b38eef0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
49
|
+
@position ||= CapistranoMulticonfigParallel::Cursor.fetch_cursor_position
|
59
50
|
CapistranoMulticonfigParallel::Cursor.display_on_screen("\n#{table}\n", @options.merge(position: @position))
|
60
|
-
|
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
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
-
|
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
|
-
|
44
|
-
|
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
|
49
|
-
cols =
|
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
|
@@ -50,7 +50,7 @@ module CapistranoMulticonfigParallel
|
|
50
50
|
|
51
51
|
def find_config_type(type)
|
52
52
|
type = type.to_s
|
53
|
-
|
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
|