toys-core 0.11.2 → 0.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/toys/core.rb +1 -1
- data/lib/toys/utils/exec.rb +25 -6
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2345d22178ad2ca256a6099f3b359abaf6641248c3a29256000e40204c618802
|
4
|
+
data.tar.gz: e9874795dd5057d7eca70164f221ec923c0ac17862146f1a9f15cba3c1cfc4e8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 852717f2545a44143185d168c374d871ba9495ccece98161b880d8fdf75b0f5929a97998f3d193c700963717c406567f3f365d73f9c6ad5af13270317b2a5a74
|
7
|
+
data.tar.gz: 3c2bb70a9512f058a9ead3feb55c4c658f7ac3357c51f39c47cb9bef081c1c5f876d08f8f45a2d0d716e6a884d22b156c64664177306041e85e411a18075ebd0
|
data/CHANGELOG.md
CHANGED
data/lib/toys/core.rb
CHANGED
data/lib/toys/utils/exec.rb
CHANGED
@@ -250,13 +250,14 @@ module Toys
|
|
250
250
|
exec_opts = Opts.new(@default_opts).add(opts)
|
251
251
|
spawn_cmd =
|
252
252
|
if cmd.is_a?(::Array)
|
253
|
-
if cmd.size
|
254
|
-
|
253
|
+
if cmd.size > 1
|
254
|
+
binary = canonical_binary_spec(cmd.first, exec_opts)
|
255
|
+
[binary] + cmd[1..-1].map(&:to_s)
|
255
256
|
else
|
256
|
-
cmd
|
257
|
+
[canonical_binary_spec(Array(cmd.first), exec_opts)]
|
257
258
|
end
|
258
259
|
else
|
259
|
-
[cmd]
|
260
|
+
[cmd.to_s]
|
260
261
|
end
|
261
262
|
executor = Executor.new(exec_opts, spawn_cmd, block)
|
262
263
|
executor.execute
|
@@ -968,12 +969,19 @@ module Toys
|
|
968
969
|
def log_command
|
969
970
|
logger = @config_opts[:logger]
|
970
971
|
if logger && @config_opts[:log_level] != false
|
971
|
-
cmd_str = @config_opts[:log_cmd]
|
972
|
-
cmd_str ||= @spawn_cmd.size == 1 ? @spawn_cmd.first : @spawn_cmd.inspect if @spawn_cmd
|
972
|
+
cmd_str = @config_opts[:log_cmd] || default_log_str(@spawn_cmd)
|
973
973
|
logger.add(@config_opts[:log_level] || ::Logger::INFO, cmd_str) if cmd_str
|
974
974
|
end
|
975
975
|
end
|
976
976
|
|
977
|
+
def default_log_str(spawn_cmd)
|
978
|
+
return nil unless spawn_cmd
|
979
|
+
return spawn_cmd.first if spawn_cmd.size == 1 && spawn_cmd.first.is_a?(::String)
|
980
|
+
cmd_binary = spawn_cmd.first
|
981
|
+
cmd_binary = cmd_binary.first if cmd_binary.is_a?(::Array)
|
982
|
+
([cmd_binary] + spawn_cmd[1..-1]).inspect
|
983
|
+
end
|
984
|
+
|
977
985
|
def start_with_controller
|
978
986
|
pid =
|
979
987
|
begin
|
@@ -1300,6 +1308,17 @@ module Toys
|
|
1300
1308
|
end
|
1301
1309
|
end
|
1302
1310
|
end
|
1311
|
+
|
1312
|
+
private
|
1313
|
+
|
1314
|
+
def canonical_binary_spec(cmd, exec_opts)
|
1315
|
+
config_argv0 = exec_opts.config_opts[:argv0]
|
1316
|
+
return cmd.to_s if !config_argv0 && !cmd.is_a?(::Array)
|
1317
|
+
cmd = Array(cmd)
|
1318
|
+
actual_cmd = cmd.first
|
1319
|
+
argv0 = cmd[1] || config_argv0 || actual_cmd
|
1320
|
+
[actual_cmd.to_s, argv0.to_s]
|
1321
|
+
end
|
1303
1322
|
end
|
1304
1323
|
end
|
1305
1324
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toys-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.11.
|
4
|
+
version: 0.11.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Toys-Core is the command line tool framework underlying Toys. It can
|
14
14
|
be used to create command line executables using the Toys DSL and classes.
|
@@ -69,10 +69,10 @@ homepage: https://github.com/dazuma/toys
|
|
69
69
|
licenses:
|
70
70
|
- MIT
|
71
71
|
metadata:
|
72
|
-
changelog_uri: https://dazuma.github.io/toys/gems/toys-core/v0.11.
|
72
|
+
changelog_uri: https://dazuma.github.io/toys/gems/toys-core/v0.11.3/file.CHANGELOG.html
|
73
73
|
source_code_uri: https://github.com/dazuma/toys
|
74
74
|
bug_tracker_uri: https://github.com/dazuma/toys/issues
|
75
|
-
documentation_uri: https://dazuma.github.io/toys/gems/toys-core/v0.11.
|
75
|
+
documentation_uri: https://dazuma.github.io/toys/gems/toys-core/v0.11.3
|
76
76
|
post_install_message:
|
77
77
|
rdoc_options: []
|
78
78
|
require_paths:
|