toolrack 0.24.0 → 0.24.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/toolrack/terminal_utils.rb +32 -29
- data/lib/toolrack/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b242048a12acd100cca08ff03850f3803e4631cd84de843795247169572f18e
|
4
|
+
data.tar.gz: b7f5ba56d61170040326c64c1b5d2c28dc7496bf89de9d915caac98919d2dd19
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dc06409e83ea792078da8de3b80672004c144b4cdc3ce8ae77bfad17e19c084ecde3507ec0ee34a7888e981015539863c1497241a04690bdc300af50b5ecd078
|
7
|
+
data.tar.gz: e07a2d305631045a651a14f6094cc581b04fae39d9ca763cfd3af47ffc0dc83cac3dcb4b1e92687fd0b1deecd78c3a544db09f70f28f56537a49b6e8bf9a3325
|
data/Gemfile.lock
CHANGED
@@ -1,70 +1,73 @@
|
|
1
|
-
|
2
1
|
require_relative 'runtime_utils'
|
3
2
|
|
4
3
|
module Antrapol
|
5
4
|
module ToolRack
|
6
|
-
|
7
5
|
class TerminalUtilsException < StandardError; end
|
8
6
|
|
9
7
|
module TerminalUtils
|
10
|
-
|
11
8
|
def tu_new_terminal(terminal, cmd)
|
12
|
-
|
13
|
-
cmd = [cmd] if not cmd.is_a?(Array)
|
9
|
+
cmd = [cmd] unless cmd.is_a?(Array)
|
14
10
|
|
15
11
|
case terminal
|
16
|
-
when
|
17
|
-
|
12
|
+
when 'terminator'
|
13
|
+
ToolRack.logger("termutils").debug "Command to be run in terminal '#{terminal}' : #{cmd.join(" ")}"
|
14
|
+
`#{terminal} -x "#{cmd.join(' ')}"`
|
18
15
|
|
19
|
-
when
|
20
|
-
|
16
|
+
when 'gnome-terminal'
|
17
|
+
ToolRack.logger("termutils").debug "Command to be run in terminal '#{terminal}' : #{cmd.join(" ")}"
|
18
|
+
`#{terminal} -- bash -c "#{cmd.join(' ')}; exec bash"`
|
19
|
+
|
20
|
+
when 'iTerm2'
|
21
|
+
|
22
|
+
ToolRack.logger("termutils").debug "Command to be run in terminal '#{terminal}' : #{cmd.join(" ").gsub("\"","\\\"")}"
|
21
23
|
|
22
|
-
when "iTerm2"
|
23
24
|
`osascript -e \
|
24
|
-
|
25
|
-
|
25
|
+
'tell application "iTerm"
|
26
|
+
activate
|
26
27
|
|
27
|
-
|
28
|
-
|
28
|
+
create window with default profile
|
29
|
+
delay 0.5
|
29
30
|
|
30
|
-
|
31
|
+
set currentWindow to current window
|
31
32
|
|
32
|
-
|
33
|
-
|
34
|
-
|
33
|
+
tell current session of currentWindow
|
34
|
+
write text "#{cmd.join(' ').gsub("\"","\\\"")}"
|
35
|
+
end tell
|
35
36
|
|
36
|
-
|
37
|
+
end tell'
|
37
38
|
`
|
38
|
-
when
|
39
|
+
when 'Terminal'
|
40
|
+
|
41
|
+
ToolRack.logger("termutils").debug "Command to be run in terminal '#{terminal}' : #{cmd.join(" ").gsub("\"","\\\"")}"
|
42
|
+
|
39
43
|
`osascript -e \
|
40
44
|
'tell application "Terminal"
|
41
45
|
activate
|
42
|
-
do script "#{cmd.join(
|
46
|
+
do script "#{cmd.join(' ').gsub("\"","\\\"")}"
|
43
47
|
end tell'
|
44
48
|
`
|
45
49
|
|
46
50
|
else
|
47
|
-
raise TerminalUtilsException,
|
51
|
+
raise TerminalUtilsException,
|
52
|
+
"Terminal '#{terminal}' not supported. Supported terminal are : #{tu.possible_terminal.join(', ')}"
|
48
53
|
end
|
49
|
-
|
50
54
|
end
|
51
55
|
|
52
56
|
def tu_possible_terminal
|
53
57
|
avail = []
|
54
58
|
if RuntimeUtils.on_linux?
|
55
|
-
possible = [
|
59
|
+
possible = %w[gnome-terminal konsole tilix terminator]
|
56
60
|
possible.each do |app|
|
57
|
-
avail << app
|
61
|
+
avail << app unless File.which(app).nil?
|
58
62
|
end
|
59
63
|
elsif RuntimeUtils.on_windows?
|
60
|
-
avail <<
|
64
|
+
avail << 'cmd.exe'
|
61
65
|
elsif RuntimeUtils.on_mac?
|
62
|
-
avail <<
|
63
|
-
avail <<
|
66
|
+
avail << 'Terminal'
|
67
|
+
avail << 'iTerm2'
|
64
68
|
end
|
65
69
|
avail
|
66
70
|
end # tu_possible_terminal
|
67
|
-
|
68
71
|
end
|
69
72
|
end
|
70
73
|
end
|
data/lib/toolrack/version.rb
CHANGED
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.24.
|
4
|
+
version: 0.24.1
|
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-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
100
|
- !ruby/object:Gem::Version
|
101
101
|
version: '0'
|
102
102
|
requirements: []
|
103
|
-
rubygems_version: 3.4.
|
103
|
+
rubygems_version: 3.4.22
|
104
104
|
signing_key:
|
105
105
|
specification_version: 4
|
106
106
|
summary: Collection of simple utilities but I find it increase clarity
|