toolrack 0.23.3 → 0.24.1

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: 4ba701f80c017de64b440dfbd5388aef7ecf9e08200cf7fe4413a1e495ba5d27
4
- data.tar.gz: 3d043a9e921cbec66a9c3fb760a10187cea1dcc0b25c990b66825b91eb051b43
3
+ metadata.gz: 5b242048a12acd100cca08ff03850f3803e4631cd84de843795247169572f18e
4
+ data.tar.gz: b7f5ba56d61170040326c64c1b5d2c28dc7496bf89de9d915caac98919d2dd19
5
5
  SHA512:
6
- metadata.gz: 56664034a546c17cfc0f58e6c4c220da5de164c4513d240ed2152c5cd1b3291f05ab1d662a6c1c1f8f53fa5a7a1e82fac105722cecc96f3bc773f58be04ec779
7
- data.tar.gz: 439aaa664c77d76a334d6730bba5fa44a23aae15b0ca00fa8b3d41da93b06b5affc64fed2cd7acb53207ddb3cbe306cee2f5db92dc6ac9fd25d212ebdb0cd069
6
+ metadata.gz: dc06409e83ea792078da8de3b80672004c144b4cdc3ce8ae77bfad17e19c084ecde3507ec0ee34a7888e981015539863c1497241a04690bdc300af50b5ecd078
7
+ data.tar.gz: e07a2d305631045a651a14f6094cc581b04fae39d9ca763cfd3af47ffc0dc83cac3dcb4b1e92687fd0b1deecd78c3a544db09f70f28f56537a49b6e8bf9a3325
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- toolrack (0.23.3)
4
+ toolrack (0.24.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -53,6 +53,8 @@ GEM
53
53
  wisper (2.0.1)
54
54
 
55
55
  PLATFORMS
56
+ arm64-darwin-23
57
+ universal-java-11
56
58
  x86_64-linux
57
59
 
58
60
  DEPENDENCIES
@@ -2,10 +2,10 @@
2
2
  require_relative 'global'
3
3
  require_relative 'runtime_utils'
4
4
 
5
- if Antrapol::ToolRack::RuntimeUtils.on_windows?
5
+ if Antrapol::ToolRack::RuntimeUtils.on_windows? or Antrapol::ToolRack::RuntimeUtils.on_mac?
6
6
  # pty causing "function 'openpty' not found in msvcrt.dll" in some
7
7
  # windows platform. Due to patches?
8
- Antrapol::ToolRack::Logger.instance.glogger.debug "On Windows. Not going to load gem 'pty'"
8
+ Antrapol::ToolRack::Logger.instance.glogger.debug "On Windows or Mac. Not going to have gem 'pty' support"
9
9
  else
10
10
  require 'pty'
11
11
  end
@@ -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 "terminator"
17
- `#{terminal} -x "#{cmd.join(" ")}"`
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 "gnome-terminal"
20
- `#{terminal} -- bash -c "#{cmd.join(" ")}; exec bash"`
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
- 'tell application "iTerm"
25
- activate
25
+ 'tell application "iTerm"
26
+ activate
26
27
 
27
- create window with default profile
28
- delay 0.5
28
+ create window with default profile
29
+ delay 0.5
29
30
 
30
- set currentWindow to current window
31
+ set currentWindow to current window
31
32
 
32
- tell current session of currentWindow
33
- write text "#{cmd.join(" ")}"
34
- end tell
33
+ tell current session of currentWindow
34
+ write text "#{cmd.join(' ').gsub("\"","\\\"")}"
35
+ end tell
35
36
 
36
- end tell'
37
+ end tell'
37
38
  `
38
- when "Terminal"
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, "Terminal '#{terminal}' not supported. Supported terminal are : #{tu.possible_terminal.join(", ")}"
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 = [ "gnome-terminal","konsole","tilix", "terminator" ]
59
+ possible = %w[gnome-terminal konsole tilix terminator]
56
60
  possible.each do |app|
57
- avail << app if not File.which(app).nil?
61
+ avail << app unless File.which(app).nil?
58
62
  end
59
63
  elsif RuntimeUtils.on_windows?
60
- avail << "cmd.exe"
64
+ avail << 'cmd.exe'
61
65
  elsif RuntimeUtils.on_mac?
62
- avail << "Terminal"
63
- avail << "iTerm2"
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
@@ -1,6 +1,6 @@
1
1
  module Antrapol
2
2
  module ToolRack
3
- VERSION = "0.23.3"
3
+ VERSION = "0.24.1"
4
4
  end
5
5
  end
6
6
 
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.23.3
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-10-05 00:00:00.000000000 Z
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.6
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