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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 37117af06be544465a07f95706310e3b8de1ad4dbc58f53e113b2595eed70e47
4
- data.tar.gz: 6e27a716c74435ff2060838dbde56af35b4df93dcdc671051397755f478cc233
3
+ metadata.gz: 2345d22178ad2ca256a6099f3b359abaf6641248c3a29256000e40204c618802
4
+ data.tar.gz: e9874795dd5057d7eca70164f221ec923c0ac17862146f1a9f15cba3c1cfc4e8
5
5
  SHA512:
6
- metadata.gz: a9dc2dc2e8287fbdb1c7695ed9111360d7bfcfc17167c6b790b170843988acb198daa8d99050d910ee5ea41876b2bb6c2e22cbab9629e322c9e7687f90a34c99
7
- data.tar.gz: '03283300b1140b477ae56276a066953eb4fc6c71aa2a14b2e0fbe66cc9934c3afbd30862349ee922d98c4e0b9e80e74e50ba180bddc939dec99ead630eb7ddf2'
6
+ metadata.gz: 852717f2545a44143185d168c374d871ba9495ccece98161b880d8fdf75b0f5929a97998f3d193c700963717c406567f3f365d73f9c6ad5af13270317b2a5a74
7
+ data.tar.gz: 3c2bb70a9512f058a9ead3feb55c4c658f7ac3357c51f39c47cb9bef081c1c5f876d08f8f45a2d0d716e6a884d22b156c64664177306041e85e411a18075ebd0
@@ -1,5 +1,9 @@
1
1
  # Release History
2
2
 
3
+ ### v0.11.3 / 2020-09-13
4
+
5
+ * FIXED: The Exec library recognizes the argv0 option, and logs it appropriately
6
+
3
7
  ### v0.11.2 / 2020-09-06
4
8
 
5
9
  * FIXED: Fix a JRuby-specific race condition when capturing exec streams
@@ -9,7 +9,7 @@ module Toys
9
9
  # Current version of Toys core.
10
10
  # @return [String]
11
11
  #
12
- VERSION = "0.11.2"
12
+ VERSION = "0.11.3"
13
13
  end
14
14
 
15
15
  ## @private deprecated
@@ -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 == 1 && cmd.first.is_a?(::String)
254
- [[cmd.first, exec_opts.config_opts[:argv0] || cmd.first]]
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.2
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-06 00:00:00.000000000 Z
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.2/file.CHANGELOG.html
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.2
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: