toys 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1219a7aaa39a426ad3df4a1206620094d8f23a0080a6f021fdfc008b3bac57e0
4
- data.tar.gz: 481a4b1ff80f776d04093a74f3e0b0b3946148c584793a5c8258aa9681f11bf8
3
+ metadata.gz: 5866812d1c711bf0870e0608fa2f8758de52f659bcda167d13590f5d6ad9d5c1
4
+ data.tar.gz: b68fc387ce5a624101b384e1c62b1f1229936a8dd2474bc61b15e58fb578917f
5
5
  SHA512:
6
- metadata.gz: 545e3b289191f13b001e5ba0c1e36c23d69b81e533413b3680b672daf9f99a05e944721abc6fcb82a5456588969451ac14f44b833ae610b7eef0abd2de6a805f
7
- data.tar.gz: '0480a435d1730c3ea06148a7f8d991454b7c5ee96e8732eb30291a0a14637650574ce53ad07e051b6d324193396369e351bf9ee1a6d7ab814c9be5c16f6be798'
6
+ metadata.gz: a0637d7bad711309be05fbc443127fb5e6545db4e20ca4d60eb466fba971ed7c5490d2c81d5d07e0b4c059305e0bcaeb5cd03c68048487298756c2bbdfe5173e
7
+ data.tar.gz: d0f8a09727f39aeec544e78334db551bf8c94ed0b681eb2201de8445e12341fd2249e5be7748ba4e905c0ade5a3f497c468c5b1487cd3429d8b89502d5941f71
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Release History
2
2
 
3
+ ### v0.19.0 / 2025-12-22
4
+
5
+ Compatibility update for Ruby 4.0, including:
6
+
7
+ * The logger gem is now an explicit dependency
8
+ * Calling a tool via exec no longer disables rubygems
9
+ * Bundler integration does a better job of cleaning up temporary lockfiles under bundler 4
10
+
11
+ Additionally, this release includes updates to readmes and users guides
12
+
3
13
  ### v0.18.0 / 2025-12-05
4
14
 
5
15
  * ADDED: The load_gem directive can now take version requirements as positional arguments
data/README.md CHANGED
@@ -9,10 +9,10 @@ users who want to write and organize scripts to automate their workflows. It
9
9
  can also be used as a replacement for Rake, providing a more natural command
10
10
  line interface for your project's build tasks.
11
11
 
12
- Unlike most command line frameworks, Toys is *not primarily* designed to help
13
- you build and ship a custom command line executable written in Ruby. However,
14
- you *can* use it in that way with the "toys-core" API, available as a separate
15
- gem. For more info on using toys-core, see
12
+ Unlike most command line frameworks, Toys is *not primarily* designed for
13
+ building and shipping a custom command line executable written in Ruby.
14
+ However, you *can* use it in that way with the "toys-core" API, available as a
15
+ separate gem. For more info on using toys-core, see
16
16
  [its documentation](https://dazuma.github.io/toys/gems/toys-core/latest).
17
17
 
18
18
  ## Introductory tutorial
@@ -125,7 +125,7 @@ module Toys
125
125
  # Optional. If not provided, defaults to the set of standard template
126
126
  # classes provided by toys core, as defined by
127
127
  # {Toys::CLI.default_template_lookup}. If you explicitly want no
128
- # standard tenokates, pass an empty instance of {Toys::ModuleLookup}.
128
+ # standard templates, pass an empty instance of {Toys::ModuleLookup}.
129
129
  #
130
130
  # @param config_dir_name [String] A directory with this name that appears
131
131
  # in the loader path, is treated as a configuration directory whose
@@ -9,6 +9,6 @@ module Toys
9
9
  # Current version of Toys core.
10
10
  # @return [String]
11
11
  #
12
- VERSION = "0.18.0"
12
+ VERSION = "0.19.0"
13
13
  end
14
14
  end
@@ -179,7 +179,22 @@ module Toys
179
179
  # Source available in the toys-core gem
180
180
  end
181
181
 
182
+ # @private
183
+ def self.find_gemfile(search_dir, gemfile_names: nil)
184
+ # Source available in the toys-core gem
185
+ end
186
+
182
187
  @global_mutex = ::Monitor.new
188
+
189
+ # @private
190
+ def self.synchronize(&block)
191
+ # Source available in the toys-core gem
192
+ end
193
+
194
+ # @private
195
+ def self.delete_at_exit(path)
196
+ # Source available in the toys-core gem
197
+ end
183
198
  end
184
199
  end
185
200
  end
data/docs/guide.md CHANGED
@@ -13,10 +13,10 @@ users who want to write and organize scripts to automate their workflows. It
13
13
  can also be used as a replacement for Rake, providing a more natural command
14
14
  line interface for your project's build tasks.
15
15
 
16
- Unlike most command line frameworks, Toys is *not primarily* designed to help
17
- you build and ship a custom command line executable written in Ruby. Rather, it
18
- provides a single executable called `toys` whose functionality you can define
19
- by writing configuration files. (You can, however, build your own custom
16
+ Unlike most command line frameworks, Toys is *not primarily* designed for
17
+ building and shipping a custom command line executable written in Ruby. Rather,
18
+ it provides a single executable called `toys` whose functionality you can
19
+ define by writing configuration files. (You can, however, build your own custom
20
20
  command line executable using the related **toys-core** library.)
21
21
 
22
22
  If this is your first time using Toys, we recommend starting with the
@@ -122,7 +122,7 @@ This displays the **online help screen** for the `system` namespace, which
122
122
  includes a list of all its subtools and what they do.
123
123
 
124
124
  It is also legitimate for the tool name to be empty. This invokes the **root
125
- tool**, the toplevel namespace:
125
+ tool**, the top level namespace:
126
126
 
127
127
  $ toys
128
128
 
@@ -133,7 +133,7 @@ One last example:
133
133
 
134
134
  $ toys frodo
135
135
 
136
- If there is no tool called `frodo` in the toplevel namespace, then once again,
136
+ If there is no tool called `frodo` in the top level namespace, then once again,
137
137
  `frodo` is interpreted as an argument to the root tool. The root tool responds
138
138
  by printing an error message that the `frodo` tool does not exist.
139
139
 
@@ -145,7 +145,7 @@ options for a tool.
145
145
  Each tool recognizes a specific set of flags. If you pass an unknown flag to a
146
146
  tool, the tool will generally display an error message.
147
147
 
148
- Toys follows the typical unix conventions for flags, specifically those covered
148
+ Toys follows the typical Unix conventions for flags, specifically those covered
149
149
  by Ruby's OptionParser library. You can provide short (single-character) flags
150
150
  with a single hyphen, or long flags with a double hyphen. Some flags can also
151
151
  take **values**. Following are a few examples.
@@ -1366,7 +1366,7 @@ When Toys runs, it looks for tools in a **search path**. Specifically:
1366
1366
  3. It looks in a list of *global directories*, specified in the environment
1367
1367
  variable `TOYS_PATH`. This variable can contain a colon-delimited list of
1368
1368
  directory paths. If the variable is not set, the current user's *home
1369
- directory*, and the system configuration directory (`/etc` on unix systems)
1369
+ directory*, and the system configuration directory (`/etc` on Unix systems)
1370
1370
  are used by default. Toys does *not* search parents of global directories.
1371
1371
 
1372
1372
  It uses the *first* implementation that it finds for the requested tool. For
@@ -1608,8 +1608,8 @@ set the gem's `"toys_dir"` metadata to a different directory name. If this
1608
1608
  metadata is set, `load_gem` will use it as the toys top level directory for
1609
1609
  that gem.
1610
1610
 
1611
- Additionally, you can pass a top level directory name in the `load_gem`
1612
- directive itself. This can be useful if a gem has multiple toys directories:
1611
+ You can also specify a different toys top level directory in the `load_gem`
1612
+ directive. This can be useful if a gem has multiple toys directories:
1613
1613
 
1614
1614
  # .toys.rb
1615
1615
  load_gem "my-tools", toys_dir: "uncommon-tools"
@@ -1624,6 +1624,13 @@ files can be used in the tools' implementations. When `load_gem` is run, the
1624
1624
  gem is activated so its library directory is made available in the require
1625
1625
  path. This may be simpler than using `.lib` directories as described later.
1626
1626
 
1627
+ By default, the `load_gem` mechanism expects toys files to live inside the
1628
+ `toys` top level directory of the gem. Although this is not recommended, if you
1629
+ need to change this default, you can set the gem's `"toys_dir"` metadata to a
1630
+ different directory name. If this metadata is set, `load_gem` will use it as
1631
+ the toys top level directory for that gem. In either case, the caller of the
1632
+ `load_gem` directive can still override it by passing the `:toys_dir` argument.
1633
+
1627
1634
  ## The execution environment
1628
1635
 
1629
1636
  This section describes the context and resources available to your tool when it
@@ -2672,14 +2679,14 @@ focus on a few tests.
2672
2679
  ## Using third-party gems
2673
2680
 
2674
2681
  The toys executable itself uses only two gems: **toys** and **toys-core**. It
2675
- has no other gem dependencies. However, the Ruby community has developed many
2676
- resources for building command line tools, including a variety of gems that
2677
- provide alternate command line parsing, control of the ANSI terminal, formatted
2678
- output such as trees and tables, and effects such as hidden input, progress
2679
- bars, various ways to spawn and control subprocesses, and so forth. You may
2680
- find some of these gems useful when writing your tools. Additionally, if you
2681
- are using Toys for your project's build scripts, it might be necessary to
2682
- install your bundle when running some tools.
2682
+ has no other gem dependencies besides standard gems bundled with Ruby. However,
2683
+ the Ruby community has developed many resources for building command line
2684
+ tools, including a variety of gems that provide alternate command line parsing,
2685
+ control of the ANSI terminal, formatted output such as trees and tables, and
2686
+ effects such as hidden input, progress bars, various ways to spawn and control
2687
+ subprocesses, and so forth. You may find some of these gems useful when writing
2688
+ your tools. Additionally, if you are using Toys for your project's build
2689
+ scripts, it might be necessary to install your bundle when running some tools.
2683
2690
 
2684
2691
  This section describes how to manage and use external gems with Toys. Note that
2685
2692
  running Toys with `bundle exec` is generally *not* recommended. We'll discuss
@@ -3054,7 +3061,7 @@ how to use Toys for some of the things traditionally done with Rake.
3054
3061
  Although Toys and Rake serve many of the same use cases, they have very
3055
3062
  different design goals, and it is useful to understand the differences.
3056
3063
 
3057
- Rake's design is based on the classic "make" tool often provided in unix
3064
+ Rake's design is based on the classic "make" tool often provided in Unix
3058
3065
  development environments. This design focuses on *targets* and *dependencies*,
3059
3066
  and is meant for a world where you invoke an external compiler tool whenever
3060
3067
  changes are made to an individual source file or any of its dependencies. This
@@ -3075,10 +3082,10 @@ syntax for describing targets and dependencies, since we generally don't have
3075
3082
  them in Ruby programs. Instead, it is optimized for writing imperative tools.
3076
3083
 
3077
3084
  For example, Rake provides a primitive mechanism for passing arguments to a
3078
- task, but it is clumsy and quite different from most unix programs. However, to
3085
+ task, but it is clumsy and quite different from most Unix programs. However, to
3079
3086
  do otherwise would clash with Rake's design goal of treating tasks as targets
3080
3087
  and dependencies. Toys does not have those design goals, so it is able to
3081
- embrace the familiar unix conventions for command line arguments.
3088
+ embrace the familiar Unix conventions for command line arguments.
3082
3089
 
3083
3090
  Toys actually borrows some of its design from the "mix" build tool used for
3084
3091
  Elixir and Erlang programs. Unlike C, the Erlang and Elixir compilers do their
@@ -3559,7 +3566,7 @@ simplified excerpt from the implementation that tool:
3559
3566
 
3560
3567
  ### Requiring exact flag matches
3561
3568
 
3562
- By default, tools will recognized "shortened" forms of long flags. For example,
3569
+ By default, tools will recognize "shortened" forms of long flags. For example,
3563
3570
  most suppose you are defining a tool with long flags:
3564
3571
 
3565
3572
  tool "my-tool" do
@@ -3645,8 +3652,9 @@ following takes place:
3645
3652
 
3646
3653
  1. Ruby will terminate the tool's `run` method by raising a `SignalException`
3647
3654
  Any `ensure` blocks in the tool will be called.
3648
- 2. Toys will call the signal handler, either a method or a block. If the
3649
- handler takes an argument, Toys will pass it the `SignalException` object.
3655
+ 2. Toys will rescue the `SignalException` and call the signal handler, either
3656
+ a method or a block. If the handler takes an argument, Toys will pass it
3657
+ the `SignalException` object.
3650
3658
  3. The signal handler is then responsible for tool execution from that
3651
3659
  point. It can terminate execution by returning or calling `exit`, or it can
3652
3660
  restart or resume processing (perhaps by calling the `run` method again).
@@ -3902,7 +3910,7 @@ overriding file under `.toys/test/.data`.
3902
3910
 
3903
3911
  ### The context directory
3904
3912
 
3905
- The **context directory** for a tool is the directory containing the toplevel
3913
+ The **context directory** for a tool is the directory containing the top level
3906
3914
  `.toys.rb` file or the `.toys` directory within which the tool is defined. It
3907
3915
  is sometimes useful for tools that expect to be run from a specific working
3908
3916
  directory.
@@ -3942,7 +3950,7 @@ directory containing the `.toys.rb` file, i.e. the `my-project` directory.)
3942
3950
 
3943
3951
  tool "list-tests" do
3944
3952
  def run
3945
- Dir.chdir context_directory do
3953
+ Dir.chdir(context_directory) do
3946
3954
  puts Dir.glob("test/**/*.rb").join("\n")
3947
3955
  end
3948
3956
  end
@@ -4008,8 +4016,8 @@ context directory to `my-repo/gem1`. Here's what that could look like:
4008
4016
  # .toys.rb content
4009
4017
 
4010
4018
  require "pathname"
4011
- base_dir = Pathname.new context_directory
4012
- cur_dir = Pathname.new Dir.getwd
4019
+ base_dir = Pathname.new(context_directory)
4020
+ cur_dir = Pathname.new(Dir.getwd)
4013
4021
 
4014
4022
  # The gem name is the first segment of the relative path from the context
4015
4023
  # directory to the current directory.
@@ -4020,7 +4028,7 @@ context directory to `my-repo/gem1`. Here's what that could look like:
4020
4028
  if gem_name && gem_name != "." && gem_name != ".."
4021
4029
 
4022
4030
  # Now set the context directory to the gem directory.
4023
- set_context_directory base_dir.join(gem_name).to_s
4031
+ set_context_directory(base_dir.join(gem_name).to_s)
4024
4032
 
4025
4033
  # Define the build tools. Each of these uses the custom context directory
4026
4034
  # set above, and thus runs for the selected gem.
@@ -4065,8 +4073,8 @@ To update Toys to the latest released version, run:
4065
4073
  This will determine the latest version from Rubygems, and update your Toys
4066
4074
  installation if it is not already current.
4067
4075
 
4068
- Normall it asks you for confirmation before downloading. To disable interactive
4069
- confirmation, pass the `--yes` flag.
4076
+ Normally it asks you for confirmation before downloading. To disable
4077
+ interactive confirmation, pass the `--yes` flag.
4070
4078
 
4071
4079
  A similar effect can of course be obtained by running `gem install toys`.
4072
4080
 
@@ -4126,6 +4134,13 @@ To display general information and a list of tools, run:
4126
4134
 
4127
4135
  toys system git-cache --help
4128
4136
 
4137
+ By default, files in the Git Cache are read-only. This is to prevent code that
4138
+ uses the cache from modifying those files in place and thus causing problems
4139
+ for other users of the cache. However, some environments that auto-delete cache
4140
+ directories might have a problem with this behavior, so the Git Cache supports
4141
+ an environment variable `TOYS_GIT_CACHE_WRITABLE` which, if set to a nonempty
4142
+ value, causes cache files to be writable.
4143
+
4129
4144
  ## Writing your own CLI using Toys
4130
4145
 
4131
4146
  Although Toys is not primarily designed to help you write a custom command-line
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.18.0"
8
+ VERSION = "0.19.0"
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toys
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: 0.18.0
18
+ version: 0.19.0
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: 0.18.0
25
+ version: 0.19.0
26
26
  description: Toys is a configurable command line tool. Write commands in Ruby using
27
27
  a simple DSL, and Toys will provide the command line executable and take care of
28
28
  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.18.0/file.CHANGELOG.html
123
+ changelog_uri: https://dazuma.github.io/toys/gems/toys/v0.19.0/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.18.0
126
+ documentation_uri: https://dazuma.github.io/toys/gems/toys/v0.19.0
127
127
  rdoc_options: []
128
128
  require_paths:
129
129
  - lib