toolrack 0.24.1 → 0.24.2
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/.rubocop.yml +3 -0
- data/lib/toolrack/terminal_utils.rb +30 -32
- data/lib/toolrack/version.rb +1 -1
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7420fd4956d202b1735958d06acae528fb80d290b641b62d34699b39b4355d52
|
4
|
+
data.tar.gz: cb69b34f6e0c646d2460ae5d547d222afd2c33295c31d67127f319689f9e135a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91ff390b103beb9745e2e8315326c2e6e889541b0e96f31447d84c00be72477bf2cf66ddfa2d58c0d601b1b28e8ae4ffe98af3cf83d9a512f22125260c5e06e4
|
7
|
+
data.tar.gz: 1ce7374e16867a09726303d40e752dff593acdc5717bbbb36bf9770341f9af684decf5d8955c08de6137444fccf3ef27a75ae8b96a33be765796f2d982c8b8c7
|
data/.rubocop.yml
ADDED
@@ -1,73 +1,71 @@
|
|
1
|
+
|
1
2
|
require_relative 'runtime_utils'
|
2
3
|
|
3
4
|
module Antrapol
|
4
5
|
module ToolRack
|
6
|
+
|
5
7
|
class TerminalUtilsException < StandardError; end
|
6
8
|
|
7
9
|
module TerminalUtils
|
10
|
+
|
8
11
|
def tu_new_terminal(terminal, cmd)
|
9
|
-
cmd = [cmd] unless cmd.is_a?(Array)
|
10
12
|
|
11
|
-
|
12
|
-
when 'terminator'
|
13
|
-
ToolRack.logger("termutils").debug "Command to be run in terminal '#{terminal}' : #{cmd.join(" ")}"
|
14
|
-
`#{terminal} -x "#{cmd.join(' ')}"`
|
13
|
+
cmd = [cmd] if not cmd.is_a?(Array)
|
15
14
|
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
case terminal
|
16
|
+
when "terminator", "tilix"
|
17
|
+
#`#{terminal} -x "#{cmd.join(" ")}"`
|
18
|
+
`#{terminal} -e "bash -c '#{cmd.join(" ")}'" &`
|
19
19
|
|
20
|
-
when
|
21
|
-
|
22
|
-
ToolRack.logger("termutils").debug "Command to be run in terminal '#{terminal}' : #{cmd.join(" ").gsub("\"","\\\"")}"
|
20
|
+
when "gnome-terminal"
|
21
|
+
`#{terminal} -- bash -c "#{cmd.join(" ")}; exec bash"`
|
23
22
|
|
23
|
+
when "iTerm2"
|
24
24
|
`osascript -e \
|
25
|
-
|
26
|
-
|
25
|
+
'tell application "iTerm"
|
26
|
+
activate
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
create window with default profile
|
29
|
+
delay 0.5
|
30
30
|
|
31
|
-
|
31
|
+
set currentWindow to current window
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
33
|
+
tell current session of currentWindow
|
34
|
+
write text "#{cmd.join(" ")}"
|
35
|
+
end tell
|
36
36
|
|
37
|
-
|
37
|
+
end tell'
|
38
38
|
`
|
39
|
-
when
|
40
|
-
|
41
|
-
ToolRack.logger("termutils").debug "Command to be run in terminal '#{terminal}' : #{cmd.join(" ").gsub("\"","\\\"")}"
|
42
|
-
|
39
|
+
when "Terminal"
|
43
40
|
`osascript -e \
|
44
41
|
'tell application "Terminal"
|
45
42
|
activate
|
46
|
-
do script "#{cmd.join(
|
43
|
+
do script "#{cmd.join(" ")}"
|
47
44
|
end tell'
|
48
45
|
`
|
49
46
|
|
50
47
|
else
|
51
|
-
raise TerminalUtilsException,
|
52
|
-
"Terminal '#{terminal}' not supported. Supported terminal are : #{tu.possible_terminal.join(', ')}"
|
48
|
+
raise TerminalUtilsException, "Terminal '#{terminal}' not supported. Supported terminal are : #{tu_possible_terminal.join(", ")}"
|
53
49
|
end
|
50
|
+
|
54
51
|
end
|
55
52
|
|
56
53
|
def tu_possible_terminal
|
57
54
|
avail = []
|
58
55
|
if RuntimeUtils.on_linux?
|
59
|
-
possible =
|
56
|
+
possible = [ "gnome-terminal","konsole","tilix", "terminator" ]
|
60
57
|
possible.each do |app|
|
61
|
-
avail << app
|
58
|
+
avail << app if not File.which(app).nil?
|
62
59
|
end
|
63
60
|
elsif RuntimeUtils.on_windows?
|
64
|
-
avail <<
|
61
|
+
avail << "cmd.exe"
|
65
62
|
elsif RuntimeUtils.on_mac?
|
66
|
-
avail <<
|
67
|
-
avail <<
|
63
|
+
avail << "Terminal"
|
64
|
+
avail << "iTerm2"
|
68
65
|
end
|
69
66
|
avail
|
70
67
|
end # tu_possible_terminal
|
68
|
+
|
71
69
|
end
|
72
70
|
end
|
73
71
|
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.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- ".gitignore"
|
49
49
|
- ".release_history.yml"
|
50
50
|
- ".rspec"
|
51
|
+
- ".rubocop.yml"
|
51
52
|
- ".travis.yml"
|
52
53
|
- ".version_history.yml"
|
53
54
|
- CODE_OF_CONDUCT.md
|
@@ -85,7 +86,7 @@ licenses: []
|
|
85
86
|
metadata:
|
86
87
|
homepage_uri: https://github.com/chrisliaw/toolrack
|
87
88
|
source_code_uri: https://github.com/chrisliaw/toolrack
|
88
|
-
post_install_message:
|
89
|
+
post_install_message:
|
89
90
|
rdoc_options: []
|
90
91
|
require_paths:
|
91
92
|
- lib
|
@@ -100,8 +101,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
100
101
|
- !ruby/object:Gem::Version
|
101
102
|
version: '0'
|
102
103
|
requirements: []
|
103
|
-
rubygems_version: 3.
|
104
|
-
signing_key:
|
104
|
+
rubygems_version: 3.5.3
|
105
|
+
signing_key:
|
105
106
|
specification_version: 4
|
106
107
|
summary: Collection of simple utilities but I find it increase clarity
|
107
108
|
test_files: []
|