capistrano_multiconfig_parallel 0.27.2 → 0.28.0
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/README.md +16 -0
- data/lib/capistrano_multiconfig_parallel/celluloid/celluloid_manager.rb +1 -1
- data/lib/capistrano_multiconfig_parallel/celluloid/terminal_table.rb +5 -6
- data/lib/capistrano_multiconfig_parallel/classes/cursor.rb +62 -0
- data/lib/capistrano_multiconfig_parallel/configuration/default.yml +7 -0
- data/lib/capistrano_multiconfig_parallel/helpers/configuration.rb +1 -1
- data/lib/capistrano_multiconfig_parallel/version.rb +2 -2
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 118d3709eeb7c3e3eb27958392d9e97d1ebe1fff
|
4
|
+
data.tar.gz: 88309d280c122e2ef5a824597fbb61278cf69eee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e756c63ef3aa2a96bfa92a2c122e68b7082bb363123e6fcee0447d29357cc6e9f2c554637e4e9945e5cffc1c25b2aebc1969866a9cd1173ffefac034e06e5741
|
7
|
+
data.tar.gz: 220d8c84a377e8ad9e9c70f99629492a5354ccd296542096c7b9a61b05b957dbcf2c8b6ca7a0d5f1eeb77cd12fd449699afeaa18a6b8c4b3770e3c5cc3e08635
|
data/README.md
CHANGED
@@ -72,6 +72,10 @@ multi_debug: true
|
|
72
72
|
multi_secvential: false
|
73
73
|
websocket_server:
|
74
74
|
enable_debug: false
|
75
|
+
use_redis: false
|
76
|
+
log_file_path: './log/multi_cap_websocket.log'
|
77
|
+
terminal:
|
78
|
+
clear_screen: false
|
75
79
|
|
76
80
|
development_stages:
|
77
81
|
- development
|
@@ -101,6 +105,18 @@ Available command line options when executing a command
|
|
101
105
|
|
102
106
|
- if option is present and has value TRUE, will enable debugging of websocket communication between the workers
|
103
107
|
|
108
|
+
- --websocket_server.use_redis
|
109
|
+
|
110
|
+
- Enables use of redis reactor for publish subscribe communication
|
111
|
+
|
112
|
+
- --websocket_server.log_file_path
|
113
|
+
|
114
|
+
- Enables the logging of websocket communication into a different file -
|
115
|
+
|
116
|
+
- --terminal.clear_screen
|
117
|
+
|
118
|
+
- Enables the clear screen to happen before the table status is displayed on screen
|
119
|
+
|
104
120
|
- --development_stages
|
105
121
|
|
106
122
|
- if option is present and has value an ARRAY of STRINGS, each of them will be used as a development stage
|
@@ -25,7 +25,7 @@ module CapistranoMulticonfigParallel
|
|
25
25
|
# http://rubydoc.info/gems/celluloid/Celluloid/SupervisionGroup/Member
|
26
26
|
@workers = @worker_supervisor.pool(CapistranoMulticonfigParallel::CelluloidWorker, as: :workers, size: 10)
|
27
27
|
Actor.current.link @workers
|
28
|
-
@worker_supervisor.supervise_as(:terminal_server, CapistranoMulticonfigParallel::TerminalTable, Actor.current, @job_manager)
|
28
|
+
@worker_supervisor.supervise_as(:terminal_server, CapistranoMulticonfigParallel::TerminalTable, Actor.current, @job_manager, configuration.fetch(:terminal, {}))
|
29
29
|
@worker_supervisor.supervise_as(:web_server, CapistranoMulticonfigParallel::WebServer, [websocket_config])
|
30
30
|
|
31
31
|
# Get a handle on the PoolManager
|
@@ -11,8 +11,10 @@ module CapistranoMulticonfigParallel
|
|
11
11
|
'sshkit_terminal'
|
12
12
|
end
|
13
13
|
|
14
|
-
def initialize(manager, job_manager)
|
14
|
+
def initialize(manager, job_manager, options = {})
|
15
15
|
@manager = manager
|
16
|
+
@position = nil
|
17
|
+
@options = options.is_a?(Hash) ? options.stringify_keys : options
|
16
18
|
@job_manager = job_manager
|
17
19
|
async.run
|
18
20
|
rescue => ex
|
@@ -40,8 +42,8 @@ module CapistranoMulticonfigParallel
|
|
40
42
|
end
|
41
43
|
|
42
44
|
def display_table_on_terminal(table)
|
43
|
-
|
44
|
-
|
45
|
+
@position ||= Cursor.fetch_position
|
46
|
+
Cursor.display_on_screen("\n#{table}\n", @options.merge(position: @position))
|
45
47
|
signal_complete
|
46
48
|
end
|
47
49
|
|
@@ -71,8 +73,5 @@ module CapistranoMulticonfigParallel
|
|
71
73
|
end
|
72
74
|
end
|
73
75
|
|
74
|
-
def terminal_clear
|
75
|
-
system('cls') || system('clear') || puts("\e[H\e[2J")
|
76
|
-
end
|
77
76
|
end
|
78
77
|
end
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'io/console'
|
2
|
+
module CapistranoMulticonfigParallel
|
3
|
+
# class used to fetch cursor position before displaying terminal table
|
4
|
+
class Cursor
|
5
|
+
class << self
|
6
|
+
|
7
|
+
def fetch_position
|
8
|
+
res = ''
|
9
|
+
$stdin.raw do |stdin|
|
10
|
+
$stdout << "\e[6n"
|
11
|
+
$stdout.flush
|
12
|
+
while (line = stdin.getc) != 'R'
|
13
|
+
res << line if line
|
14
|
+
end
|
15
|
+
end
|
16
|
+
position = res.match(/(?<row>\d+);(?<column>\d+)/)
|
17
|
+
{ row: position[:row].to_i, column: position[:column].to_i }
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
def display_on_screen(string, options = {})
|
22
|
+
options = options.is_a?(Hash) ? options.stringify_keys : {}
|
23
|
+
position = options.fetch('position', nil)
|
24
|
+
clear_scren = options.fetch('clear_screen', false)
|
25
|
+
handle_string_display(position, clear_scren, string)
|
26
|
+
end
|
27
|
+
|
28
|
+
def handle_string_display(position, clear_scren, string)
|
29
|
+
if clear_scren.to_s == 'true'
|
30
|
+
terminal_clear_display(string)
|
31
|
+
elsif position.present?
|
32
|
+
display_string_at_position(position, string)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def terminal_clear_display(string)
|
37
|
+
terminal_clear
|
38
|
+
puts string
|
39
|
+
end
|
40
|
+
|
41
|
+
def display_string_at_position(position, string)
|
42
|
+
position_cursor(position[:row], position[:column])
|
43
|
+
erase_from_current_line_to_bottom
|
44
|
+
position_cursor(position[:row], position[:column])
|
45
|
+
puts string
|
46
|
+
end
|
47
|
+
|
48
|
+
def erase_from_current_line_to_bottom
|
49
|
+
puts "\e[J"
|
50
|
+
end
|
51
|
+
|
52
|
+
def position_cursor(line, column)
|
53
|
+
puts("\e[#{line};#{column}H")
|
54
|
+
end
|
55
|
+
|
56
|
+
def terminal_clear
|
57
|
+
system('cls') || system('clear') || puts("\e[H\e[2J")
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -51,6 +51,13 @@ default_config:
|
|
51
51
|
- deploy:symlink:release
|
52
52
|
required: false
|
53
53
|
|
54
|
+
- name: 'terminal.clear_screen'
|
55
|
+
type: 'boolean'
|
56
|
+
description: >-
|
57
|
+
Enables the clear screen to happen before the table status is displayed on screen
|
58
|
+
default: 'false'
|
59
|
+
required: false
|
60
|
+
|
54
61
|
|
55
62
|
- name: 'apply_stage_confirmation'
|
56
63
|
type: 'Array'
|
@@ -87,7 +87,7 @@ module CapistranoMulticonfigParallel
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def check_configuration
|
90
|
-
check_boolean_props(%w(multi_debug multi_secvential websocket_server.enable_debug websocket_server.use_redis))
|
90
|
+
check_boolean_props(%w(multi_debug multi_secvential websocket_server.enable_debug websocket_server.use_redis terminal.clear_screen))
|
91
91
|
check_array_props(%w(task_confirmations development_stages apply_stage_confirmation))
|
92
92
|
verify_application_dependencies(@check_config['application_dependencies'], %w(app priority dependencies))
|
93
93
|
end
|
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.
|
4
|
+
version: 0.28.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bogdanRada
|
@@ -668,6 +668,7 @@ files:
|
|
668
668
|
- lib/capistrano_multiconfig_parallel/celluloid/state_machine.rb
|
669
669
|
- lib/capistrano_multiconfig_parallel/celluloid/terminal_table.rb
|
670
670
|
- lib/capistrano_multiconfig_parallel/celluloid/web_server.rb
|
671
|
+
- lib/capistrano_multiconfig_parallel/classes/cursor.rb
|
671
672
|
- lib/capistrano_multiconfig_parallel/classes/dependency_tracker.rb
|
672
673
|
- lib/capistrano_multiconfig_parallel/classes/input_stream.rb
|
673
674
|
- lib/capistrano_multiconfig_parallel/classes/interactive_menu.rb
|