toys-core 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: b1888d8d6f5f4fef954b2ae2cfb6d2c7347bacc9765b771b2cd565302c8aff33
4
- data.tar.gz: 76e389e4af61edbb83832d626dbce946177eb262db260577c78d4f40b454d885
3
+ metadata.gz: 95f2b314888825bc99a288a9f6676060d10b2e00bd10f9fe665ce4c6c9f03c37
4
+ data.tar.gz: 71c89aaa21d5203eb5b8c7ae34c3fba9f408c818f3e07ca8cdc025568204fa43
5
5
  SHA512:
6
- metadata.gz: 70cb4a35ff04d345c22e19aa701148ee55cf3336ecfab68bbb524c44aaa8d1306fb8106136efa337c281110203c1559c16598c8762ff4ecfb13d36fecc15f7e0
7
- data.tar.gz: f6e5a7f8c84a7158da379707c48d2f560806285a684fb2f46a80649c4dbb0e1ed7c7ee240eb1b1825723ded8519dbcada6cd6896f48a33e9047855362c9010f5
6
+ metadata.gz: 9ee63b482c81481f02aa498aef32aa563a9d6cf6335f94b1c5820a935cb058c182dcb74572ce54f0c298e2473ca405719d50aaf11b519a592fc75ad263f53fca
7
+ data.tar.gz: 40ac439b3942f95d414d5253190491916d4c5dabbebd5bf32a262884d1dd3b6174f0f248ea3d7ef3dc86f38020752858ebd916c2cfe62d887f7fd84f53b5603b
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
  * (No significant changes)
data/lib/toys/core.rb CHANGED
@@ -9,7 +9,7 @@ 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
 
15
15
  ##
data/lib/toys/dsl/tool.rb CHANGED
@@ -1467,7 +1467,7 @@ module Toys
1467
1467
  # tool "foo" do
1468
1468
  # to_run :foo
1469
1469
  # def foo
1470
- # puts "The fool tool ran!"
1470
+ # puts "The foo tool ran!"
1471
1471
  # end
1472
1472
  # end
1473
1473
  #
@@ -1820,7 +1820,7 @@ module Toys
1820
1820
  requirement = ::Gem::Requirement.new(*requirements)
1821
1821
  unless requirement.satisfied_by?(version)
1822
1822
  raise Toys::ToolDefinitionError,
1823
- "Toys version requirements #{requirement} not satisfied by {version}"
1823
+ "Toys version requirements #{requirement} not satisfied by #{version}"
1824
1824
  end
1825
1825
  self
1826
1826
  end
@@ -1,8 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
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
  #
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.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
  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.
@@ -79,10 +79,10 @@ homepage: https://github.com/dazuma/toys
79
79
  licenses:
80
80
  - MIT
81
81
  metadata:
82
- changelog_uri: https://dazuma.github.io/toys/gems/toys-core/v0.15.3/file.CHANGELOG.html
82
+ changelog_uri: https://dazuma.github.io/toys/gems/toys-core/v0.15.4/file.CHANGELOG.html
83
83
  source_code_uri: https://github.com/dazuma/toys/tree/main/toys-core
84
84
  bug_tracker_uri: https://github.com/dazuma/toys/issues
85
- documentation_uri: https://dazuma.github.io/toys/gems/toys-core/v0.15.3
85
+ documentation_uri: https://dazuma.github.io/toys/gems/toys-core/v0.15.4
86
86
  post_install_message:
87
87
  rdoc_options: []
88
88
  require_paths:
@@ -98,7 +98,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
98
98
  - !ruby/object:Gem::Version
99
99
  version: '0'
100
100
  requirements: []
101
- rubygems_version: 3.4.10
101
+ rubygems_version: 3.5.3
102
102
  signing_key:
103
103
  specification_version: 4
104
104
  summary: Framework for creating command line executables