toolrack 0.21.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 29c4c2d083df087ab7bba41d05ba5beac17d45087497d236f30c0b90c53a9ea8
4
- data.tar.gz: d308ae597d8e5a8bdbcb9308576683fbd1814bc64ae0898a273c2b7587e72692
3
+ metadata.gz: 61af82cfa37677d8c6c2896f69b0c0469adb30906db903a6885075136c25bd93
4
+ data.tar.gz: 1687d3b4a80e392b36a1e51f24d90545e097fde2645ef6c9e3c7d57479d9fd42
5
5
  SHA512:
6
- metadata.gz: 4bfa1d16e9d560be45162a6bc432b5de2389c055eb8bd27065989858b8e7425e9ffe5cfa2a5bbc7b34d56b069d3bde04cc7dc3c2d6bc0afdacb030abb7345395
7
- data.tar.gz: 8d104b705be9921cc63f8c617b3caa3f6f37b1567d1ea608cd176f9a6d8ae54e6a03fa824047894774eb66c7d8b98f504ee9d95ee8b285f185787e2de96c207b
6
+ metadata.gz: 7a43d658eda38670b396064a5462e17321b28dac13c084654d966334dc25f090fc541fbc37055d947e8ea97e6fa2a4b9fed0ed4c2059f94358af671ebcf4802c
7
+ data.tar.gz: c1509319be87e61699c7fff10ad1034730c7ef9d87c2fa2186e66def319d984a1f2ce1586a05ec04c336d85d3842bfb06d8f9516421714e0012938510a3c5e30
data/.release_history.yml CHANGED
@@ -28,3 +28,5 @@ toolrack:
28
28
  :timestamp: 1679498219.4181716
29
29
  - :version: 0.20.2
30
30
  :timestamp: 1679815976.724487
31
+ - :version: 0.21.0
32
+ :timestamp: 1680235248.152352
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- toolrack (0.21.0)
4
+ toolrack (0.22.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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
@@ -1,6 +1,6 @@
1
1
  module Antrapol
2
2
  module ToolRack
3
- VERSION = "0.21.0"
3
+ VERSION = "0.22.0"
4
4
  end
5
5
  end
6
6
 
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.21.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-03-31 00:00:00.000000000 Z
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