capistrano_multiconfig_parallel 0.30.0 → 0.30.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -1
- data/lib/capistrano_multiconfig_parallel/celluloid/terminal_table.rb +14 -8
- data/lib/capistrano_multiconfig_parallel/classes/cursor.rb +13 -11
- data/lib/capistrano_multiconfig_parallel/classes/job.rb +7 -0
- data/lib/capistrano_multiconfig_parallel/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f8bd1e8d2bba139b5f06d0d2fa855cc2a3f030a
|
4
|
+
data.tar.gz: a155314cc93bf556b955d53574f712db877e3b4b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f95cf147ee0237298c9b04a1f518cb674ebeb25585cfd6cb57a300fc302c0e8a488a6cc7619604d5f63f3015d03b09f8142b165b880b5f64d4d66f5cb36268b9
|
7
|
+
data.tar.gz: 9fef095a975df04cba640842fc9b06803b1dc27545d830a4d9556cb8dab426c307a5aef466db276ea4c599e8cb3b1e8cfd2d459dad9079a08cf4e07c917e780f
|
data/.rubocop.yml
CHANGED
@@ -8,7 +8,7 @@ module CapistranoMulticonfigParallel
|
|
8
8
|
include Celluloid::Logger
|
9
9
|
include CapistranoMulticonfigParallel::ApplicationHelper
|
10
10
|
|
11
|
-
attr_reader :options, :errors, :manager, :position, :job_manager, :terminal_rows
|
11
|
+
attr_reader :options, :errors, :manager, :position, :job_manager, :terminal_rows, :screen_erased
|
12
12
|
|
13
13
|
def self.topic
|
14
14
|
'sshkit_terminal'
|
@@ -21,6 +21,7 @@ module CapistranoMulticonfigParallel
|
|
21
21
|
@errors = []
|
22
22
|
@options = options.is_a?(Hash) ? options.stringify_keys : options
|
23
23
|
@job_manager = job_manager
|
24
|
+
@screen_erased = false
|
24
25
|
async.run
|
25
26
|
rescue => ex
|
26
27
|
rescue_exception(ex)
|
@@ -36,8 +37,8 @@ module CapistranoMulticonfigParallel
|
|
36
37
|
|
37
38
|
def notify_time_change(_channel, _message)
|
38
39
|
table = Terminal::Table.new(title: 'Deployment Status Table', headings: default_heaadings)
|
39
|
-
setup_table_jobs(table)
|
40
|
-
display_table_on_terminal(table)
|
40
|
+
jobs = setup_table_jobs(table)
|
41
|
+
display_table_on_terminal(table, jobs)
|
41
42
|
end
|
42
43
|
|
43
44
|
def rescue_exception(ex)
|
@@ -46,11 +47,15 @@ module CapistranoMulticonfigParallel
|
|
46
47
|
terminate
|
47
48
|
end
|
48
49
|
|
49
|
-
def
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
50
|
+
def fetch_table_size(jobs)
|
51
|
+
job_rows = jobs.sum { |_job_id, job| job.row_size }
|
52
|
+
(job_rows + 2)**2
|
53
|
+
end
|
54
|
+
|
55
|
+
def display_table_on_terminal(table, jobs)
|
56
|
+
table_size = fetch_table_size(jobs)
|
57
|
+
@position, @terminal_rows, @screen_erased = CapistranoMulticonfigParallel::Cursor.display_on_screen("\n#{table}\n", @options.merge(position: @position, table_size: table_size))
|
58
|
+
# puts [@position, @terminal_rows, table_size , (@terminal_rows[:rows] - @position[:row]), screen_erased].inspect
|
54
59
|
print_errors
|
55
60
|
signal_complete
|
56
61
|
end
|
@@ -65,6 +70,7 @@ module CapistranoMulticonfigParallel
|
|
65
70
|
table.add_row(job.terminal_row)
|
66
71
|
table.add_separator
|
67
72
|
end
|
73
|
+
jobs
|
68
74
|
end
|
69
75
|
|
70
76
|
def show_confirmation(message, default)
|
@@ -25,24 +25,22 @@ module CapistranoMulticonfigParallel
|
|
25
25
|
def fetch_cursor_position(table_size, position)
|
26
26
|
final_position = position
|
27
27
|
terminal_rows = fetch_terminal_size
|
28
|
-
|
28
|
+
screen_erased = refetch_position?(table_size, terminal_rows, position)
|
29
|
+
if screen_erased
|
29
30
|
move_to_home! if position.present?
|
30
31
|
final_position = fetch_position
|
31
32
|
terminal_rows = fetch_terminal_size
|
32
33
|
end
|
33
|
-
[final_position,terminal_rows]
|
34
|
+
[final_position, terminal_rows, screen_erased]
|
34
35
|
end
|
35
36
|
|
36
|
-
def refetch_position?(table_size,terminal_size, position)
|
37
|
+
def refetch_position?(table_size, terminal_size, position)
|
37
38
|
return true if position.blank?
|
38
39
|
terminal_rows = terminal_size[:rows]
|
39
40
|
row_position = position[:row]
|
40
|
-
terminal_rows.zero? || (terminal_rows.nonzero? && row_position >= (terminal_rows / 2)) || (table_size >= (terminal_rows -row_position))
|
41
|
+
terminal_rows.zero? || (terminal_rows.nonzero? && row_position >= (terminal_rows / 2)) || (table_size >= (terminal_rows - row_position))
|
41
42
|
end
|
42
43
|
|
43
|
-
private
|
44
|
-
|
45
|
-
|
46
44
|
def fetch_position
|
47
45
|
res = ''
|
48
46
|
$stdin.raw do |stdin|
|
@@ -68,11 +66,15 @@ module CapistranoMulticonfigParallel
|
|
68
66
|
end
|
69
67
|
|
70
68
|
def handle_string_display(string, options)
|
71
|
-
position = options.fetch('position',nil)
|
69
|
+
position = options.fetch('position', nil)
|
70
|
+
table_size = options.fetch('table_size', 0)
|
72
71
|
if options.fetch('clear_screen', false).to_s == 'true'
|
73
72
|
terminal_clear_display(string)
|
74
|
-
|
75
|
-
|
73
|
+
[0, 0, false]
|
74
|
+
else
|
75
|
+
new_position, terminal_rows, screen_erased = fetch_cursor_position(table_size, position)
|
76
|
+
display_string_at_position(new_position, string)
|
77
|
+
[new_position, terminal_rows, screen_erased]
|
76
78
|
end
|
77
79
|
end
|
78
80
|
|
@@ -93,7 +95,7 @@ module CapistranoMulticonfigParallel
|
|
93
95
|
end
|
94
96
|
|
95
97
|
def erase_screen
|
96
|
-
|
98
|
+
puts("\e[2J")
|
97
99
|
end
|
98
100
|
|
99
101
|
def go_to_position(position)
|
@@ -44,6 +44,13 @@ module CapistranoMulticonfigParallel
|
|
44
44
|
]
|
45
45
|
end
|
46
46
|
|
47
|
+
def row_size
|
48
|
+
longest_hash = terminal_row.max_by do |hash|
|
49
|
+
hash[:value].size
|
50
|
+
end
|
51
|
+
(longest_hash[:value].size.to_f / 80.0).ceil
|
52
|
+
end
|
53
|
+
|
47
54
|
def worker_state
|
48
55
|
default = status.to_s.upcase.red
|
49
56
|
return default unless @manager.alive?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano_multiconfig_parallel
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.30.
|
4
|
+
version: 0.30.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: celluloid-pmap
|