toolrack 0.24.1 → 0.24.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Gemfile.lock +1 -1
- data/lib/toolrack/terminal_utils.rb +30 -32
- data/lib/toolrack/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60af4706c7414b6f953d4fda9f2bf17785bf7f08bc3ca75cb01781e1d7c767f2
|
4
|
+
data.tar.gz: 1408079923d70a64fe66c51ca0bffa58d4c20a3f73152eea01e18b2dee16bf1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c5a9fa715ac0b3e80933d271ef2db063b25775df33d2928439418b358da5074931ead8888a3e42c01789d1d1c0537c1ec888d049c8b7a136e1276c3d562ce2f
|
7
|
+
data.tar.gz: 3561c7ad91ff0895dd70c86e7517af0856fb66345fad4d7ec7a23e02f9392c1a3ae43964614b8ad4e51ccc30e30824ee2feb307c8b7f1bead4175388cbf13598
|
data/.rubocop.yml
ADDED
data/Gemfile.lock
CHANGED
@@ -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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-04-24 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
|
@@ -100,7 +101,7 @@ 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
|
+
rubygems_version: 3.5.1
|
104
105
|
signing_key:
|
105
106
|
specification_version: 4
|
106
107
|
summary: Collection of simple utilities but I find it increase clarity
|