toolrack 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/toolrack.rb +1 -1
- data/lib/toolrack/process_utils.rb +28 -0
- data/lib/toolrack/runtime_utils.rb +19 -14
- data/lib/toolrack/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a314f6fdcefecc70740c69187204bcdcf16924ee2bf13845831a0f67cf5c357
|
4
|
+
data.tar.gz: 3127b384041d20294eccc27335f0996825232d69dc3c6ac0c0d6035d0feab9e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48ce83ab6d84b1aea27f6743d4330f6849bd09da2316f695250ebdab376bc29722cbdc5667ee13e4a7dbe22aa0f95685d4bff959274b7f03339019c50479038f
|
7
|
+
data.tar.gz: 1be997f86cd433d3a9d02c5ffe2bc5dae517bb3d9ac62fe1e91787ed7a07dc75e2deb6b05d94af0c411a05644fb235859c89434f9791a2f41e65cce1bb353566
|
data/lib/toolrack.rb
CHANGED
@@ -5,7 +5,7 @@ require 'singleton'
|
|
5
5
|
|
6
6
|
require_relative 'toolrack/exception_utils'
|
7
7
|
require_relative 'toolrack/condition_utils'
|
8
|
-
|
8
|
+
require_relative 'toolrack/process_utils'
|
9
9
|
require_relative 'toolrack/runtime_utils'
|
10
10
|
|
11
11
|
module Antrapol
|
@@ -10,6 +10,34 @@ module Antrapol
|
|
10
10
|
module ToolRack
|
11
11
|
module ProcessUtils
|
12
12
|
|
13
|
+
def exec(cmd, opts = { }, &block)
|
14
|
+
type = opts[:exec_type]
|
15
|
+
if not type.nil?
|
16
|
+
exec2(type, cmd, opts, &block)
|
17
|
+
else
|
18
|
+
exec2(:basic, cmd, opts, &block)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def exec2(type, cmd, opts = { }, &block)
|
23
|
+
case type
|
24
|
+
when :basic
|
25
|
+
Antrapol::ToolRack::Logger.instance.glogger.debug "Basic execution"
|
26
|
+
basic_exec(cmd)
|
27
|
+
when :system
|
28
|
+
Antrapol::ToolRack::Logger.instance.glogger.debug "System execution"
|
29
|
+
system_exec(cmd, opts, &block)
|
30
|
+
when :popen3
|
31
|
+
Antrapol::ToolRack::Logger.instance.glogger.debug "Popen3 execution"
|
32
|
+
popen3_exec(cmd, opts, &block)
|
33
|
+
else
|
34
|
+
Antrapol::ToolRack::Logger.instance.glogger.debug "Basic (fallback) execution"
|
35
|
+
# basic
|
36
|
+
basic_exec(cmd)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
13
41
|
# backtick
|
14
42
|
# backtick will only return at the end of the process.
|
15
43
|
# If in the event there is a prompt to user, this should nto be used.
|
@@ -4,21 +4,26 @@ module Antrapol
|
|
4
4
|
module ToolRack
|
5
5
|
module RuntimeUtils
|
6
6
|
|
7
|
-
def
|
8
|
-
|
9
|
-
when /cygwin|mswin|mingw|bccwin|wince|emx/
|
10
|
-
:win
|
11
|
-
when /darwin|mac/
|
12
|
-
:mac
|
13
|
-
else
|
14
|
-
:linux
|
15
|
-
end
|
7
|
+
def RuntimeUtils.on_window?
|
8
|
+
(RbConfig::CONFIG['host_os'] =~ /cygwin|mswin|mingw|bccwin|wince|emx/) != nil
|
16
9
|
end
|
17
10
|
|
18
|
-
def
|
19
|
-
|
11
|
+
def RuntimeUtils.on_mac?
|
12
|
+
(RbConfig::CONFIG['host_os'] =~ /darwin|mac/) != nil
|
20
13
|
end
|
21
14
|
|
22
|
-
|
23
|
-
|
24
|
-
end
|
15
|
+
def RuntimeUtils.on_linux?
|
16
|
+
(RbConfig::CONFIG['host_os'] =~ /linux/) != nil
|
17
|
+
end
|
18
|
+
|
19
|
+
def RuntimeUtils.on_ruby?
|
20
|
+
not on_jruby?
|
21
|
+
end
|
22
|
+
|
23
|
+
def RuntimeUtils.on_jruby?
|
24
|
+
(RUBY_PLATFORM =~ /java/) != nil
|
25
|
+
end
|
26
|
+
|
27
|
+
end # RuntimeUtils
|
28
|
+
end # ToolRack
|
29
|
+
end #Antrapol
|
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.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-10-
|
11
|
+
date: 2020-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tlogger
|
@@ -55,7 +55,7 @@ licenses: []
|
|
55
55
|
metadata:
|
56
56
|
homepage_uri: https://github.com/chrisliaw/toolrack
|
57
57
|
source_code_uri: https://github.com/chrisliaw/toolrack
|
58
|
-
post_install_message:
|
58
|
+
post_install_message:
|
59
59
|
rdoc_options: []
|
60
60
|
require_paths:
|
61
61
|
- lib
|
@@ -70,8 +70,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '0'
|
72
72
|
requirements: []
|
73
|
-
rubygems_version: 3.1.
|
74
|
-
signing_key:
|
73
|
+
rubygems_version: 3.1.2
|
74
|
+
signing_key:
|
75
75
|
specification_version: 4
|
76
76
|
summary: Collection of simple utilities but I find it increase clarity
|
77
77
|
test_files: []
|