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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e808befd2776655ed65712c81083cad5fe610691
4
- data.tar.gz: f81ccce076a838663e3ebd1fa3c2e8519bac2248
3
+ metadata.gz: 118d3709eeb7c3e3eb27958392d9e97d1ebe1fff
4
+ data.tar.gz: 88309d280c122e2ef5a824597fbb61278cf69eee
5
5
  SHA512:
6
- metadata.gz: 87feebb58a8820da7507971b7ebe80046588c846e8e6496f4e7f40bd0b730efc96986b45cfcb84263257fe498be0d4840c5b71f6e1f26025e5e48cde871a1dc9
7
- data.tar.gz: 4cdffabb0cebdd758228c12b13beec3deb8fcbfbd7f741898f9db9be479e581249b4b90cada701c45d2096e135616ab9b7c417b0c3181c32a609a022ad0b0d55
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
- terminal_clear
44
- puts "\n#{table}\n"
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
@@ -7,8 +7,8 @@ module CapistranoMulticonfigParallel
7
7
  # module used for generating the version
8
8
  module VERSION
9
9
  MAJOR = 0
10
- MINOR = 27
11
- TINY = 2
10
+ MINOR = 28
11
+ TINY = 0
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.27.2
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