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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b242048a12acd100cca08ff03850f3803e4631cd84de843795247169572f18e
4
- data.tar.gz: b7f5ba56d61170040326c64c1b5d2c28dc7496bf89de9d915caac98919d2dd19
3
+ metadata.gz: 7420fd4956d202b1735958d06acae528fb80d290b641b62d34699b39b4355d52
4
+ data.tar.gz: cb69b34f6e0c646d2460ae5d547d222afd2c33295c31d67127f319689f9e135a
5
5
  SHA512:
6
- metadata.gz: dc06409e83ea792078da8de3b80672004c144b4cdc3ce8ae77bfad17e19c084ecde3507ec0ee34a7888e981015539863c1497241a04690bdc300af50b5ecd078
7
- data.tar.gz: e07a2d305631045a651a14f6094cc581b04fae39d9ca763cfd3af47ffc0dc83cac3dcb4b1e92687fd0b1deecd78c3a544db09f70f28f56537a49b6e8bf9a3325
6
+ metadata.gz: 91ff390b103beb9745e2e8315326c2e6e889541b0e96f31447d84c00be72477bf2cf66ddfa2d58c0d601b1b28e8ae4ffe98af3cf83d9a512f22125260c5e06e4
7
+ data.tar.gz: 1ce7374e16867a09726303d40e752dff593acdc5717bbbb36bf9770341f9af684decf5d8955c08de6137444fccf3ef27a75ae8b96a33be765796f2d982c8b8c7
data/.rubocop.yml ADDED
@@ -0,0 +1,3 @@
1
+
2
+ AllCops:
3
+ DisabledByDefault: true
@@ -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
- case terminal
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
- 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"`
15
+ case terminal
16
+ when "terminator", "tilix"
17
+ #`#{terminal} -x "#{cmd.join(" ")}"`
18
+ `#{terminal} -e "bash -c '#{cmd.join(" ")}'" &`
19
19
 
20
- when 'iTerm2'
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
- 'tell application "iTerm"
26
- activate
25
+ 'tell application "iTerm"
26
+ activate
27
27
 
28
- create window with default profile
29
- delay 0.5
28
+ create window with default profile
29
+ delay 0.5
30
30
 
31
- set currentWindow to current window
31
+ set currentWindow to current window
32
32
 
33
- tell current session of currentWindow
34
- write text "#{cmd.join(' ').gsub("\"","\\\"")}"
35
- end tell
33
+ tell current session of currentWindow
34
+ write text "#{cmd.join(" ")}"
35
+ end tell
36
36
 
37
- end tell'
37
+ end tell'
38
38
  `
39
- when 'Terminal'
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(' ').gsub("\"","\\\"")}"
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 = %w[gnome-terminal konsole tilix terminator]
56
+ possible = [ "gnome-terminal","konsole","tilix", "terminator" ]
60
57
  possible.each do |app|
61
- avail << app unless File.which(app).nil?
58
+ avail << app if not File.which(app).nil?
62
59
  end
63
60
  elsif RuntimeUtils.on_windows?
64
- avail << 'cmd.exe'
61
+ avail << "cmd.exe"
65
62
  elsif RuntimeUtils.on_mac?
66
- avail << 'Terminal'
67
- avail << 'iTerm2'
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
@@ -1,6 +1,6 @@
1
1
  module Antrapol
2
2
  module ToolRack
3
- VERSION = "0.24.1"
3
+ VERSION = "0.24.2"
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.1
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: 2023-12-10 00:00:00.000000000 Z
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.4.22
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: []