toys 0.14.1 → 0.14.2

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: fc447cfb397077cb652af00a19031a4b1c439ed483117fecf9e855bf286dbeb5
4
- data.tar.gz: 951fb9c8104eb35ac1275efd2c0e7e0c784538b9b878b560861ea7bcb380144a
3
+ metadata.gz: 5605477c7993fad15f1c79740f8de6b90f4aef19becdc00a236e71853cb4d9a8
4
+ data.tar.gz: 1c63369d5c4302356f412e25904bd6db43ca93b9896c687c6ae5bbfd4fe24fc8
5
5
  SHA512:
6
- metadata.gz: 1fcdf6af97a7c1516f37760206aa67445f522df7fe0898e61a0ddbc568411b404bab109e68cbdedf21e755bf7a2bf6e3be7c4deb3a52a9e8e36fe29db0148e6b
7
- data.tar.gz: fbaaea69be3d5ebffe89167ab01bd51dcab5006239fb20ba00dab31c14f3d0f335cac57c81aad541519e355ae699a5b8c2ed23f8c8ab4db8b8ed64ff239c2c9b
6
+ metadata.gz: c312c18f2fa8d57f6dbeb8def6b434a611030387e289a370bcb96faadf90a49b948cfc7ac17b14f9e7b97a942a85b133d384ad37705aed9b833fca3f650517d1
7
+ data.tar.gz: 1f7125dbf036acb25b0352de30b68f95c229610572c754b8cdf3e1c633e03f5a6318eeb5de56df1d229402f4915d16aacb794d62fcd571007a604aec4ad6070f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Release History
2
2
 
3
+ ### v0.14.2 / 2022-10-09
4
+
5
+ * ADDED: The tool directive supports the delegate_relative argument, as a preferred alternative over alias_tool.
6
+ * FIXED: The toys file reference now properly appears in error messages on Ruby 3.1.
7
+ * FIXED: Error messages show the correct toys file line number on TruffleRuby.
8
+ * FIXED: Inspect strings for tool classes are less opaque and include the tool name.
9
+ * FIXED: The presence of an acceptor forces an ambiguous flag to take a value rather than erroring.
10
+
3
11
  ### v0.14.1 / 2022-10-03
4
12
 
5
13
  * FIXED: Fixed a crash due to a missing file in the gem
@@ -9,6 +9,6 @@ module Toys
9
9
  # Current version of Toys core.
10
10
  # @return [String]
11
11
  #
12
- VERSION = "0.14.1"
12
+ VERSION = "0.14.2"
13
13
  end
14
14
  end
@@ -263,7 +263,8 @@ module Toys
263
263
  # end
264
264
  # end
265
265
  #
266
- # The following example defines a tool that runs one of its subtools.
266
+ # The following example uses `delegate_to` to define a tool that runs one
267
+ # of its subtools.
267
268
  #
268
269
  # tool "test", delegate_to: ["test", "unit"] do
269
270
  # tool "unit" do
@@ -284,19 +285,22 @@ module Toys
284
285
  # delegate to another tool, specified by the full path. This path may
285
286
  # be given as an array of strings, or a single string possibly
286
287
  # delimited by path separators.
288
+ # @param delegate_relative [String,Array<String>] Optional. Similar to
289
+ # delegate_to, but takes a delegate name relative to the context in
290
+ # which this tool is being defined.
287
291
  # @param block [Proc] Defines the subtool.
288
292
  # @return [self]
289
293
  #
290
- def tool(words, if_defined: :combine, delegate_to: nil, &block)
294
+ def tool(words, if_defined: :combine, delegate_to: nil, delegate_relative: nil, &block)
291
295
  # Source available in the toys-core gem
292
296
  end
293
297
 
294
298
  ##
295
299
  # Create an alias, representing an "alternate name" for a tool.
296
300
  #
297
- # This is functionally equivalent to creating a subtool with the
298
- # `delegate_to` option, except that `alias_tool` takes a _relative_ name
299
- # for the delegate.
301
+ # Note: This is functionally equivalent to creating a tool with the
302
+ # `:delegate_relative` option. As such, `alias_tool` is considered
303
+ # deprecated.
300
304
  #
301
305
  # ### Example
302
306
  #
@@ -309,20 +313,24 @@ module Toys
309
313
  # end
310
314
  # end
311
315
  # alias_tool "t", "test"
316
+ # # Note: the following is preferred over alias_tool:
317
+ # # tool "t", delegate_relative: "test"
312
318
  #
313
319
  # @param word [String] The name of the alias
314
320
  # @param target [String,Array<String>] Relative path to the target of the
315
321
  # alias. This path may be given as an array of strings, or a single
316
322
  # string possibly delimited by path separators.
317
323
  # @return [self]
324
+ # @deprecated Use {#tool} and pass `:delegate_relative` instead
318
325
  #
319
326
  def alias_tool(word, target)
320
327
  # Source available in the toys-core gem
321
328
  end
322
329
 
323
330
  ##
324
- # Causes the current tool to delegate to another tool. When run, it
325
- # simply invokes the target tool with the same arguments.
331
+ # Causes the current tool to delegate to another tool, specified by the
332
+ # full tool name. When run, it simply invokes the target tool with the
333
+ # same arguments.
326
334
  #
327
335
  # ### Example
328
336
  #
data/docs/guide.md CHANGED
@@ -3171,6 +3171,10 @@ a namespace to delegate to one of its subtools:
3171
3171
 
3172
3172
  Now `toys test` delegates to, and thus has the same effect as `toys test unit`.
3173
3173
 
3174
+ It is also possible to specify the delegate via _relative_ name, using the
3175
+ `:delegate_relative` keyword argument. This can be helpful if you have a set of
3176
+ tools and delegates that are meant to be reused under different namespaces.
3177
+
3174
3178
  ### Applying directives to multiple tools
3175
3179
 
3176
3180
  Sometimes a group of tools are set up similarly or share a set of flags,
data/lib/toys/version.rb CHANGED
@@ -5,5 +5,5 @@ module Toys
5
5
  # Current version of the Toys command line executable.
6
6
  # @return [String]
7
7
  #
8
- VERSION = "0.14.1"
8
+ VERSION = "0.14.2"
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.1
4
+ version: 0.14.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-03 00:00:00.000000000 Z
11
+ date: 2022-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: toys-core
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.14.1
19
+ version: 0.14.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 0.14.1
26
+ version: 0.14.2
27
27
  description: Toys is a configurable command line tool. Write commands in Ruby using
28
28
  a simple DSL, and Toys will provide the command line executable and take care of
29
29
  all the details such as argument parsing, online help, and error reporting. Toys
@@ -120,10 +120,10 @@ homepage: https://github.com/dazuma/toys
120
120
  licenses:
121
121
  - MIT
122
122
  metadata:
123
- changelog_uri: https://dazuma.github.io/toys/gems/toys/v0.14.1/file.CHANGELOG.html
123
+ changelog_uri: https://dazuma.github.io/toys/gems/toys/v0.14.2/file.CHANGELOG.html
124
124
  source_code_uri: https://github.com/dazuma/toys/tree/main/toys
125
125
  bug_tracker_uri: https://github.com/dazuma/toys/issues
126
- documentation_uri: https://dazuma.github.io/toys/gems/toys/v0.14.1
126
+ documentation_uri: https://dazuma.github.io/toys/gems/toys/v0.14.2
127
127
  post_install_message:
128
128
  rdoc_options: []
129
129
  require_paths: