toolrack 0.24.0 → 0.24.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b3aa42768059ac9e8a06017cfc7f3897f20f1f9bc1e5a96636a7ac75d126837f
4
- data.tar.gz: b489cac5f26a6c7543d085b9d2a9926b76079c1114f50dc2a8aa4760613119cb
3
+ metadata.gz: 5b242048a12acd100cca08ff03850f3803e4631cd84de843795247169572f18e
4
+ data.tar.gz: b7f5ba56d61170040326c64c1b5d2c28dc7496bf89de9d915caac98919d2dd19
5
5
  SHA512:
6
- metadata.gz: aed88650f6221816a73f6be358908c838e161f0fdf757dcc4de87162bdeda217a7d6d12ea8bd947ed4cad317c305dc10d8473ee3c034edf0421b5b8e27450488
7
- data.tar.gz: a6c5a60e28a3ef9cf18af8b390bf407d9622960a40e188e6f32b2f6d4561eee41060367d1dc51ea6f64f5a789253624f5ec4782a0668df1097a6afa5d897deac
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.24.0)
4
+ toolrack (0.24.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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.24.0"
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.24.0
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-22 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