toys 0.15.3 → 0.15.4

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: 57b1253240949a832b30bab7889080d57c7a756f30d2db5aa3f639c86190ea45
4
- data.tar.gz: bf4a045fcef88634614042023c58dbb2ccc48e4992fb23935ae0c13dcd1ff695
3
+ metadata.gz: dde2dacbdd40f393c28b751ae14b40d1b8348e790f36a82e4dec6c5d36b9efec
4
+ data.tar.gz: 18ab3366caa4264a3b5ca322f87f095258c5298a423af1d90c6f86c76a979d93
5
5
  SHA512:
6
- metadata.gz: c1acf98ea97a5b08f03b703ac7caeb0a9a329f507717a516833bd60a53f8f3ae506aa3d91d23d0da4a213ceccffd67c6acf427e4cbeff37a9ce85a45bcd20587
7
- data.tar.gz: 837994ddbe9dd840bb59499e6676b0446058a5c9598536328455d4724948ebfe5736b6842295c9519f26fba6a276f41a50391c8e4c50219ef4f957ebdff93687
6
+ metadata.gz: 9524f54ede25c686d56d13e838cca9582bb31d2e2c9533fdf17c70d9ec80459abd897641442cfd5fed03d51078ff2ec17d70b02d7ddccabe27b03ae6ba40ff1c
7
+ data.tar.gz: 5c83c1f88969a64ea75f5dd6bff60bb681004221091eb6fc0b6a57e49593d8fabb1fa24f310e09e5779301ac9939387ba5fe51b20cd02d59dd383b953b7417ea
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Release History
2
2
 
3
+ ### v0.15.4 / 2024-01-04
4
+
5
+ * FIXED: Fix error message when failing assertion of the toys version
6
+ * DOCS: Various documentation improvements
7
+
3
8
  ### v0.15.3 / 2023-10-31
4
9
 
5
10
  * FIXED: Minitest template defers calling autorun until after tests are loaded, which should eliminate stringio warnings when running Rails tests without bundler integration
@@ -9,6 +9,6 @@ module Toys
9
9
  # Current version of Toys core.
10
10
  # @return [String]
11
11
  #
12
- VERSION = "0.15.3"
12
+ VERSION = "0.15.4"
13
13
  end
14
14
  end
@@ -1310,7 +1310,7 @@ module Toys
1310
1310
  # tool "foo" do
1311
1311
  # to_run :foo
1312
1312
  # def foo
1313
- # puts "The fool tool ran!"
1313
+ # puts "The foo tool ran!"
1314
1314
  # end
1315
1315
  # end
1316
1316
  #
@@ -1,8 +1,11 @@
1
1
  ##
2
2
  # **_Defined in the toys-core gem_**
3
3
  #
4
- # This module is a namespace for constant scopes. Whenever a configuration file
5
- # is parsed, a module is created under this parent for that file's constants.
4
+ # This module is the root namespace for tool definitions loaded from files.
5
+ # Whenever a toys configuration file is parsed, a module is created under this
6
+ # parent for that file's contents. Tool classes defined in that file, along
7
+ # with mixins and templates, and any other classes, modules, and constants
8
+ # defined, are located within that file's module.
6
9
  #
7
10
  module Toys::InputFile # rubocop:disable Style/ClassAndModuleChildren
8
11
  ##
@@ -5,17 +5,49 @@ module Toys
5
5
  # Information about the source of a tool, such as the file, git repository,
6
6
  # or block that defined it.
7
7
  #
8
+ # This object represents a source of tool information and definitions. Such a
9
+ # source could include:
10
+ #
11
+ # * A toys directory
12
+ # * A single toys file
13
+ # * A file or directory loaded from git
14
+ # * A config block passed directly to the CLI
15
+ # * A tool block within a toys file
16
+ #
17
+ # The SourceInfo provides information such as the tool's context directory,
18
+ # and locates data and lib directories appropriate to the tool. It also
19
+ # locates the tool's source code so it can be reported when an error occurs.
20
+ #
21
+ # Each tool has a unique SourceInfo with all the information specific to that
22
+ # tool. Additionally, SourceInfo objects are arranged in a containment
23
+ # hierarchy. For example, a SourceInfo object representing a toys files could
24
+ # have a parent representing a toys directory, and an object representing a
25
+ # tool block could have a parent representing an enclosing block or a file.
26
+ #
27
+ # Child SourceInfo objects generally inherit some attributes of their parent.
28
+ # For example, the `.toys` directory in a project directory defines the
29
+ # context directory as that project directory. Then all tools defined under
30
+ # that directory will share that context directory, so all SourceInfo objects
31
+ # descending from that root will inherit that value (unless it's changed
32
+ # explicitly).
33
+ #
34
+ # SourceInfo objects can be obtained in the DSL from
35
+ # {Toys::DSL::Tool#source_info} or at runtime by getting the
36
+ # {Toys::Context::Key::TOOL_SOURCE} key. However, they are created internally
37
+ # by the Loader and should not be created manually.
38
+ #
8
39
  class SourceInfo
9
40
  ##
10
41
  # The parent of this SourceInfo.
11
42
  #
12
43
  # @return [Toys::SourceInfo] The parent.
13
- # @return [nil] if this SourceInfo is the root.
44
+ # @return [nil] if this SourceInfo is a root.
14
45
  #
15
46
  attr_reader :parent
16
47
 
17
48
  ##
18
- # The root ancestor of this SourceInfo.
49
+ # The root ancestor of this SourceInfo. This generally represents a source
50
+ # that was added directly to a CLI in code.
19
51
  #
20
52
  # @return [Toys::SourceInfo] The root ancestor.
21
53
  #
@@ -33,14 +65,16 @@ module Toys
33
65
  # The context directory path (normally the directory containing the
34
66
  # toplevel toys file or directory).
35
67
  #
68
+ # This is not affected by setting a custom context directory for a tool.
69
+ #
36
70
  # @return [String] The context directory path.
37
- # @return [nil] if there is no context directory (perhaps because the tool
38
- # is being defined from a block)
71
+ # @return [nil] if there is no context directory (perhaps because the root
72
+ # source was a block)
39
73
  #
40
74
  attr_reader :context_directory
41
75
 
42
76
  ##
43
- # The source, which may be a path or a proc.
77
+ # The source, which may be a path or a proc depending on the {#source_type}.
44
78
  #
45
79
  # @return [String] Path to the source file or directory.
46
80
  # @return [Proc] The block serving as the source.
@@ -48,7 +82,15 @@ module Toys
48
82
  attr_reader :source
49
83
 
50
84
  ##
51
- # Return the type of source.
85
+ # The type of source. This could be:
86
+ #
87
+ # * `:file`, representing a single toys file. The {#source} will be the
88
+ # filesystem path to that file.
89
+ # * `:directory`, representing a toys directory. The {#source} will be the
90
+ # filesystem path to that directory.
91
+ # * `:proc`, representing a proc, which could be a toplevel block added
92
+ # directly to a CLI, a `tool` block within a toys file, or a block within
93
+ # another block. The {#source} will be the proc itself.
52
94
  #
53
95
  # @return [:file,:directory,:proc]
54
96
  #
@@ -57,13 +99,17 @@ module Toys
57
99
  ##
58
100
  # The path of the current source file or directory.
59
101
  #
102
+ # This could be set even if {#source_type} is `:proc`, if that proc is
103
+ # defined within a toys file. The only time this is not set is if the
104
+ # source is added directly to a CLI in a code block.
105
+ #
60
106
  # @return [String] The source path
61
107
  # @return [nil] if this source has no file system path.
62
108
  #
63
109
  attr_reader :source_path
64
110
 
65
111
  ##
66
- # The source proc.
112
+ # The source proc. This is set if {#source_type} is `:proc`.
67
113
  #
68
114
  # @return [Proc] The source proc
69
115
  # @return [nil] if this source has no proc.
@@ -71,7 +117,8 @@ module Toys
71
117
  attr_reader :source_proc
72
118
 
73
119
  ##
74
- # The git remote.
120
+ # The git remote. This is set if the source, or one of its ancestors, comes
121
+ # from git.
75
122
  #
76
123
  # @return [String] The git remote
77
124
  # @return [nil] if this source is not fron git.
@@ -79,7 +126,8 @@ module Toys
79
126
  attr_reader :git_remote
80
127
 
81
128
  ##
82
- # The git path.
129
+ # The git path. This is set if the source, or one of its ancestors, comes
130
+ # from git.
83
131
  #
84
132
  # @return [String] The git path. This could be the empty string.
85
133
  # @return [nil] if this source is not fron git.
@@ -87,7 +135,8 @@ module Toys
87
135
  attr_reader :git_path
88
136
 
89
137
  ##
90
- # The git commit.
138
+ # The git commit. This is set if the source, or one of its ancestors, comes
139
+ # from git.
91
140
  #
92
141
  # @return [String] The git commit.
93
142
  # @return [nil] if this source is not fron git.
@@ -95,7 +144,7 @@ module Toys
95
144
  attr_reader :git_commit
96
145
 
97
146
  ##
98
- # The user-visible name of this source.
147
+ # A user-visible name of this source.
99
148
  #
100
149
  # @return [String]
101
150
  #
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.15.3"
8
+ VERSION = "0.15.4"
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.15.3
4
+ version: 0.15.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Azuma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-31 00:00:00.000000000 Z
11
+ date: 2024-01-04 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.15.3
19
+ version: 0.15.4
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.15.3
26
+ version: 0.15.4
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
@@ -121,10 +121,10 @@ homepage: https://github.com/dazuma/toys
121
121
  licenses:
122
122
  - MIT
123
123
  metadata:
124
- changelog_uri: https://dazuma.github.io/toys/gems/toys/v0.15.3/file.CHANGELOG.html
124
+ changelog_uri: https://dazuma.github.io/toys/gems/toys/v0.15.4/file.CHANGELOG.html
125
125
  source_code_uri: https://github.com/dazuma/toys/tree/main/toys
126
126
  bug_tracker_uri: https://github.com/dazuma/toys/issues
127
- documentation_uri: https://dazuma.github.io/toys/gems/toys/v0.15.3
127
+ documentation_uri: https://dazuma.github.io/toys/gems/toys/v0.15.4
128
128
  post_install_message:
129
129
  rdoc_options: []
130
130
  require_paths:
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
- rubygems_version: 3.4.10
143
+ rubygems_version: 3.5.3
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: A configurable command line tool