capistrano_multiconfig_parallel 0.28.5 → 0.29.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 660d0cf7532dbcd193a3f3613c7159b5eeb6c578
|
4
|
+
data.tar.gz: 51019e097631dedf3919bdbdc40a5d2fb3693c96
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b7ba4b612bf0e868053342799e49f997f4e69118fdc6d48827fdf878ed34bc15cf5bd351c4f2814ffd06bc2d15ff911c50a32a192830a30bd2e42ead108729c
|
7
|
+
data.tar.gz: 5e475541a89d3c395c0740f11f6df42757781141f3ce88f4edd2b7b25df960043fde83b99c0bb43624b2d481273fc06ba701da8e2070dc90b911dadebc281a89
|
@@ -45,8 +45,17 @@ module CapistranoMulticonfigParallel
|
|
45
45
|
terminate
|
46
46
|
end
|
47
47
|
|
48
|
-
def
|
48
|
+
def fetch_cursor_position
|
49
|
+
terminal_size = CapistranoMulticonfigParallel::Cursor.fetch_terminal_size
|
49
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
|
+
def display_table_on_terminal(table)
|
58
|
+
cursor_position = fetch_cursor_position
|
50
59
|
CapistranoMulticonfigParallel::Cursor.display_on_screen("\n#{table}\n", @options.merge(position: @position))
|
51
60
|
puts(@errors.join("\n")) if @errors.present? && options.fetch('clear_screen', false).to_s == 'false'
|
52
61
|
signal_complete
|
@@ -1,8 +1,15 @@
|
|
1
|
-
|
1
|
+
require_relative '../helpers/application_helper'
|
2
2
|
module CapistranoMulticonfigParallel
|
3
3
|
# class used to fetch cursor position before displaying terminal table
|
4
4
|
class Cursor
|
5
5
|
class << self
|
6
|
+
include CapistranoMulticonfigParallel::ApplicationHelper
|
7
|
+
|
8
|
+
def fetch_terminal_size
|
9
|
+
size = (dynamic_size_stty || dynamic_size_tput || `echo $LINES $COLUMNS`)
|
10
|
+
size = strip_characters_from_string(size).split(' ')
|
11
|
+
{ rows: size[0].to_i, columns: size[1].to_i }
|
12
|
+
end
|
6
13
|
|
7
14
|
def fetch_position
|
8
15
|
res = ''
|
@@ -25,13 +32,24 @@ module CapistranoMulticonfigParallel
|
|
25
32
|
handle_string_display(position, clear_scren, string)
|
26
33
|
end
|
27
34
|
|
28
|
-
def move_to_home!
|
29
|
-
position_cursor(
|
35
|
+
def move_to_home!(row = 2, column = 1)
|
36
|
+
position_cursor(row, column)
|
30
37
|
erase_from_current_line_to_bottom
|
31
38
|
end
|
32
39
|
|
33
40
|
private
|
34
41
|
|
42
|
+
def dynamic_size_stty
|
43
|
+
size = %x{stty size 2>/dev/null}
|
44
|
+
size.present? ? size : nil
|
45
|
+
end
|
46
|
+
|
47
|
+
def dynamic_size_tput
|
48
|
+
lines %x{tput lines 2>/dev/null}
|
49
|
+
cols = %x{tput cols 2>/dev/null}
|
50
|
+
lines.present? && cols.present? ? "#{lines} #{cols}" : nil
|
51
|
+
end
|
52
|
+
|
35
53
|
def handle_string_display(position, clear_scren, string)
|
36
54
|
if clear_scren.to_s == 'true'
|
37
55
|
terminal_clear_display(string)
|