toys-core 0.14.7 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -0
- data/LICENSE.md +1 -1
- data/README.md +10 -5
- data/docs/guide.md +534 -39
- data/lib/toys/cli.rb +76 -172
- data/lib/toys/compat.rb +15 -30
- data/lib/toys/context.rb +51 -0
- data/lib/toys/core.rb +1 -1
- data/lib/toys/dsl/flag.rb +40 -2
- data/lib/toys/dsl/flag_group.rb +15 -5
- data/lib/toys/dsl/internal.rb +23 -8
- data/lib/toys/dsl/positional_arg.rb +32 -1
- data/lib/toys/dsl/tool.rb +174 -68
- data/lib/toys/errors.rb +2 -2
- data/lib/toys/middleware.rb +3 -2
- data/lib/toys/settings.rb +1 -1
- data/lib/toys/standard_mixins/bundler.rb +16 -1
- data/lib/toys/standard_mixins/exec.rb +29 -8
- data/lib/toys/standard_mixins/gems.rb +17 -3
- data/lib/toys/standard_mixins/highline.rb +12 -12
- data/lib/toys/standard_mixins/terminal.rb +7 -7
- data/lib/toys/tool_definition.rb +153 -50
- data/lib/toys/utils/exec.rb +22 -1
- data/lib/toys/utils/gems.rb +3 -0
- data/lib/toys/utils/standard_ui.rb +261 -0
- data/lib/toys-core.rb +51 -3
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcf2b7517a237c398d900d9635fcb1cd95b00afff0df2e1e87253274ce038109
|
4
|
+
data.tar.gz: 291eb95c1deaeae4056f553f43dae8af016e89269c6c3f3d8e7e1872ce73c777
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82c2f97733439d9af71c3636a01b972c5ac890160fd67a7b6cd5959efd3f30d4eeac8fc72b01e93c179d02f21cfbb60e4e21d5978633e79ce07972719ade80a6
|
7
|
+
data.tar.gz: 696580a980190abc08686545f0ed44d8b145508aa3fc8094fbacb941125df312a0848819ce608515a481753edeb4c0924b5b8c5af872c2c81f08db605394b18c
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,33 @@
|
|
1
1
|
# Release History
|
2
2
|
|
3
|
+
### v0.15.0 / 2023-10-12
|
4
|
+
|
5
|
+
Toys-Core 0.15.0 is a major release that overhauls error and signal handling, cleans up some warts around entrypoint and method definition, and fixes a few long-standing issues.
|
6
|
+
|
7
|
+
Breaking changes:
|
8
|
+
|
9
|
+
* The default error_handler for Toys::CLI now simply reraises the unhandled exception out of Toys::CLI#run. This was done to simplify the default behavior and reduce its dependencies. Additionally, the Toys::CLI::DefaultErrorHandler class has been removed, and replaced with the Toys::CLI.default_error_handler class method implementing the simplified behavior. You can restore the old behavior by passing Toys::Utils::StandardUI#error_handler to the CLI.
|
10
|
+
* The default logger_factory for Toys::CLI now uses a simple bare-bones logger instead of the nicely formatted logger previously used as default. This was done to simplify the default behavior and reduce its dependencies. You can restore the old behavior by passing Toys::Utils::StandardUI#logger_factory to the CLI.
|
11
|
+
* The Toys::CLI::DefaultCompletion class has been removed, and replaced with the Toys::CLI.default_completion class method.
|
12
|
+
* Passing a proc to Toys::ToolDefinition#run_handler= now sets the run handler directly to the proc rather than defining the run method.
|
13
|
+
* The default algorithm for determining whether flags and arguments add methods now allows overriding of methods of Toys::Context and any other included modules, but prevents collisions with private methods defined in the tool. (It continues to prevent overriding of public methods of Object and BasicObject.)
|
14
|
+
|
15
|
+
New functionality:
|
16
|
+
|
17
|
+
* New DSL directive on_signal lets tools provide signal handlers.
|
18
|
+
* New utility Toys::Utils::StandardUI implements the error handling and logger formatting used by the toys executable. (These implementations were moved out of the Toys::CLI base class.)
|
19
|
+
* Toys::ToolDefinition provides methods for managing signal handlers.
|
20
|
+
* Passing a symbol to Toys::ToolDefinition#run_handler= can set the run entrypoint to a method other than "run".
|
21
|
+
* Flags and arguments can be configured explicitly to add methods or not add methods, overriding the default behavior.
|
22
|
+
|
23
|
+
Fixes and other changes:
|
24
|
+
|
25
|
+
* The Bundler integration prevents Bundler from attempting to self-update to the version specified in a lockfile (which would often cause problems when Bundler is called from Toys).
|
26
|
+
* If a missing delegate or a delegation loop is detected, ToolDefinitionError is raised instead of RuntimeError.
|
27
|
+
* Some cleanup of various mixins to prevent issues if their methods ever get overridden.
|
28
|
+
* Progress on the toys-core user guide. It's not yet complete, but getting closer.
|
29
|
+
* Various improvements and clarifications in the reference documentation.
|
30
|
+
|
3
31
|
### v0.14.7 / 2023-07-19
|
4
32
|
|
5
33
|
* FIXED: Fixed an exception when passing a non-string to puts in the terminal mixin
|
data/LICENSE.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# License
|
2
2
|
|
3
|
-
Copyright 2019-
|
3
|
+
Copyright 2019-2023 Daniel Azuma and the Toys contributors
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -321,16 +321,21 @@ Clean up by uninstalling the gem:
|
|
321
321
|
### Learning more
|
322
322
|
|
323
323
|
This introduction should be enough to get you started. However, Toys-Core is a
|
324
|
-
deep framework with many more features.
|
325
|
-
|
326
|
-
using
|
327
|
-
|
324
|
+
deep framework with many more features.
|
325
|
+
|
326
|
+
Learn about how to write tools using the Toys DSL, including validating and
|
327
|
+
interpreting command line arguments, using templates and mixins, controlling
|
328
|
+
subprocesses, and producing nice styled output, in the
|
328
329
|
[Toys User Guide](https://dazuma.github.io/toys/gems/toys/latest/file.guide.html).
|
330
|
+
|
329
331
|
Learn more about how to customize and package your own executable, including
|
330
332
|
handling errors, controlling log output, and providing your own mixins,
|
331
333
|
templates, and middleware, in the
|
332
334
|
[Toys-Core User Guide](https://dazuma.github.io/toys/gems/toys-core/latest/file.guide.html).
|
333
335
|
|
336
|
+
Detailed usage information can be found in the
|
337
|
+
[class reference documentation](https://dazuma.github.io/toys/gems/toys-core/lateset/Toys.html)
|
338
|
+
|
334
339
|
## System requirements
|
335
340
|
|
336
341
|
Toys-Core requires Ruby 2.4 or later.
|
@@ -343,7 +348,7 @@ recommended because it has a few known bugs that affect Toys.
|
|
343
348
|
|
344
349
|
## License
|
345
350
|
|
346
|
-
Copyright 2019-
|
351
|
+
Copyright 2019-2023 Daniel Azuma and the Toys contributors
|
347
352
|
|
348
353
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
349
354
|
of this software and associated documentation files (the "Software"), to deal
|