toolrack 0.21.0 → 0.22.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/.release_history.yml +2 -0
- data/Gemfile.lock +1 -1
- data/lib/toolrack/terminal_utils.rb +70 -0
- data/lib/toolrack/version.rb +1 -1
- data/lib/toolrack.rb +3 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61af82cfa37677d8c6c2896f69b0c0469adb30906db903a6885075136c25bd93
|
4
|
+
data.tar.gz: 1687d3b4a80e392b36a1e51f24d90545e097fde2645ef6c9e3c7d57479d9fd42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7a43d658eda38670b396064a5462e17321b28dac13c084654d966334dc25f090fc541fbc37055d947e8ea97e6fa2a4b9fed0ed4c2059f94358af671ebcf4802c
|
7
|
+
data.tar.gz: c1509319be87e61699c7fff10ad1034730c7ef9d87c2fa2186e66def319d984a1f2ce1586a05ec04c336d85d3842bfb06d8f9516421714e0012938510a3c5e30
|
data/.release_history.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -0,0 +1,70 @@
|
|
1
|
+
|
2
|
+
require_relative 'runtime_utils'
|
3
|
+
|
4
|
+
module Antrapol
|
5
|
+
module ToolRack
|
6
|
+
|
7
|
+
class TerminalUtilsException < StandardError; end
|
8
|
+
|
9
|
+
module TerminalUtils
|
10
|
+
|
11
|
+
def tu_new_terminal(terminal, cmd)
|
12
|
+
|
13
|
+
cmd = [cmd] if not cmd.is_a?(Array)
|
14
|
+
|
15
|
+
case terminal
|
16
|
+
when "terminator"
|
17
|
+
`#{terminal} -x "#{cmd.join(" ")}"`
|
18
|
+
|
19
|
+
when "gnome-terminal"
|
20
|
+
`#{terminal} -- bash -c "#{cmd.join(" ")}; exec bash"`
|
21
|
+
|
22
|
+
when "iTerm2"
|
23
|
+
`osascript -e \
|
24
|
+
'tell application "iTerm"
|
25
|
+
activate
|
26
|
+
|
27
|
+
create window with default profile
|
28
|
+
delay 0.5
|
29
|
+
|
30
|
+
set currentWindow to current window
|
31
|
+
|
32
|
+
tell current session of currentWindow
|
33
|
+
write text "#{cmd.join(" ")}"
|
34
|
+
end tell
|
35
|
+
|
36
|
+
end tell'
|
37
|
+
`
|
38
|
+
when "Terminal"
|
39
|
+
`osascript -e \
|
40
|
+
'tell application "Terminal"
|
41
|
+
activate
|
42
|
+
do script "#{cmd.join(" ")}"
|
43
|
+
end tell'
|
44
|
+
`
|
45
|
+
|
46
|
+
else
|
47
|
+
raise TerminalUtilsException, "Terminal '#{terminal}' not supported. Supported terminal are : #{tu.possible_terminal.join(", ")}"
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
52
|
+
def tu_possible_terminal
|
53
|
+
avail = []
|
54
|
+
if RuntimeUtils.on_linux?
|
55
|
+
possible = [ "gnome-terminal","konsole","tilix", "terminator" ]
|
56
|
+
possible.each do |app|
|
57
|
+
avail << app if not File.which(app).nil?
|
58
|
+
end
|
59
|
+
elsif RuntimeUtils..on_windows?
|
60
|
+
avail << "cmd.exe"
|
61
|
+
elsif RuntimeUtils.on_mac?
|
62
|
+
avail << "Terminal"
|
63
|
+
avail << "iTerm2"
|
64
|
+
end
|
65
|
+
avail
|
66
|
+
end # tu_possible_terminal
|
67
|
+
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/lib/toolrack/version.rb
CHANGED
data/lib/toolrack.rb
CHANGED
@@ -18,6 +18,7 @@ require_relative 'toolrack/null_output'
|
|
18
18
|
require_relative 'toolrack/version_utils'
|
19
19
|
require_relative 'toolrack/file_utils'
|
20
20
|
require_relative 'toolrack/block_params_utils'
|
21
|
+
require_relative 'toolrack/terminal_utils'
|
21
22
|
|
22
23
|
module Antrapol
|
23
24
|
module ToolRack
|
@@ -65,3 +66,5 @@ TR::FileUtils = ToolRack::FileUtils
|
|
65
66
|
|
66
67
|
TR::BlockParamsUtils = ToolRack::BlockParamsUtils
|
67
68
|
|
69
|
+
TR::TerminalUtils = ToolRack::TerminalUtils
|
70
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toolrack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.22.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: devops_assist
|
@@ -70,6 +70,7 @@ files:
|
|
70
70
|
- lib/toolrack/password_utils.rb
|
71
71
|
- lib/toolrack/process_utils.rb
|
72
72
|
- lib/toolrack/runtime_utils.rb
|
73
|
+
- lib/toolrack/terminal_utils.rb
|
73
74
|
- lib/toolrack/utils.rb
|
74
75
|
- lib/toolrack/version.rb
|
75
76
|
- lib/toolrack/version_utils.rb
|