toys 0.12.2 → 0.13.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 +4 -4
- data/.yardopts +2 -0
- data/CHANGELOG.md +35 -0
- data/LICENSE.md +1 -1
- data/README.md +7 -4
- data/builtins/system/git-cache.rb +238 -0
- data/builtins/system/test.rb +37 -2
- data/core-docs/toys/acceptor.rb +432 -0
- data/core-docs/toys/arg_parser.rb +397 -0
- data/core-docs/toys/cli.rb +493 -0
- data/core-docs/toys/compat.rb +2 -0
- data/core-docs/toys/completion.rb +329 -0
- data/core-docs/toys/context.rb +321 -0
- data/core-docs/toys/core.rb +14 -0
- data/core-docs/toys/dsl/base.rb +56 -0
- data/core-docs/toys/dsl/flag.rb +261 -0
- data/core-docs/toys/dsl/flag_group.rb +259 -0
- data/core-docs/toys/dsl/internal.rb +4 -0
- data/core-docs/toys/dsl/positional_arg.rb +139 -0
- data/core-docs/toys/dsl/tool.rb +1530 -0
- data/core-docs/toys/errors.rb +93 -0
- data/core-docs/toys/flag.rb +549 -0
- data/core-docs/toys/flag_group.rb +186 -0
- data/core-docs/toys/input_file.rb +8 -0
- data/core-docs/toys/loader.rb +222 -0
- data/core-docs/toys/middleware.rb +295 -0
- data/core-docs/toys/mixin.rb +142 -0
- data/core-docs/toys/module_lookup.rb +75 -0
- data/core-docs/toys/positional_arg.rb +145 -0
- data/core-docs/toys/settings.rb +507 -0
- data/core-docs/toys/source_info.rb +127 -0
- data/core-docs/toys/standard_middleware/add_verbosity_flags.rb +49 -0
- data/core-docs/toys/standard_middleware/apply_config.rb +24 -0
- data/core-docs/toys/standard_middleware/handle_usage_errors.rb +33 -0
- data/core-docs/toys/standard_middleware/set_default_descriptions.rb +222 -0
- data/core-docs/toys/standard_middleware/show_help.rb +190 -0
- data/core-docs/toys/standard_middleware/show_root_version.rb +45 -0
- data/core-docs/toys/standard_mixins/bundler.rb +83 -0
- data/core-docs/toys/standard_mixins/exec.rb +645 -0
- data/core-docs/toys/standard_mixins/fileutils.rb +18 -0
- data/core-docs/toys/standard_mixins/gems.rb +48 -0
- data/core-docs/toys/standard_mixins/git_cache.rb +41 -0
- data/core-docs/toys/standard_mixins/highline.rb +133 -0
- data/core-docs/toys/standard_mixins/terminal.rb +135 -0
- data/core-docs/toys/standard_mixins/xdg.rb +49 -0
- data/core-docs/toys/template.rb +112 -0
- data/core-docs/toys/tool_definition.rb +926 -0
- data/core-docs/toys/utils/completion_engine.rb +49 -0
- data/core-docs/toys/utils/exec.rb +721 -0
- data/core-docs/toys/utils/gems.rb +185 -0
- data/core-docs/toys/utils/git_cache.rb +353 -0
- data/core-docs/toys/utils/help_text.rb +134 -0
- data/core-docs/toys/utils/terminal.rb +310 -0
- data/core-docs/toys/utils/xdg.rb +253 -0
- data/core-docs/toys/wrappable_string.rb +120 -0
- data/core-docs/toys-core.rb +63 -0
- data/docs/guide.md +497 -156
- data/lib/toys/standard_cli.rb +50 -36
- data/lib/toys/templates/clean.rb +18 -0
- data/lib/toys/templates/gem_build.rb +24 -0
- data/lib/toys/templates/minitest.rb +21 -0
- data/lib/toys/templates/rake.rb +23 -3
- data/lib/toys/templates/rdoc.rb +29 -0
- data/lib/toys/templates/rspec.rb +32 -4
- data/lib/toys/templates/rubocop.rb +14 -1
- data/lib/toys/templates/yardoc.rb +55 -0
- data/lib/toys/testing.rb +186 -109
- data/lib/toys/version.rb +1 -1
- data/lib/toys.rb +4 -2
- metadata +56 -6
@@ -326,67 +326,122 @@ module Toys
|
|
326
326
|
self
|
327
327
|
end
|
328
328
|
|
329
|
+
##
|
329
330
|
# @private
|
331
|
+
#
|
330
332
|
attr_reader :generate_output
|
333
|
+
|
334
|
+
##
|
331
335
|
# @private
|
336
|
+
#
|
332
337
|
attr_reader :generate_output_flag
|
338
|
+
|
339
|
+
##
|
333
340
|
# @private
|
341
|
+
#
|
334
342
|
attr_reader :fail_on_warning
|
343
|
+
|
344
|
+
##
|
335
345
|
# @private
|
346
|
+
#
|
336
347
|
attr_reader :fail_on_undocumented_objects
|
348
|
+
|
349
|
+
##
|
337
350
|
# @private
|
351
|
+
#
|
338
352
|
attr_reader :show_public
|
353
|
+
|
354
|
+
##
|
339
355
|
# @private
|
356
|
+
#
|
340
357
|
attr_reader :show_protected
|
358
|
+
|
359
|
+
##
|
341
360
|
# @private
|
361
|
+
#
|
342
362
|
attr_reader :show_private
|
363
|
+
|
364
|
+
##
|
343
365
|
# @private
|
366
|
+
#
|
344
367
|
attr_reader :hide_private_tag
|
368
|
+
|
369
|
+
##
|
345
370
|
# @private
|
371
|
+
#
|
346
372
|
attr_reader :readme
|
373
|
+
|
374
|
+
##
|
347
375
|
# @private
|
376
|
+
#
|
348
377
|
attr_reader :markup
|
378
|
+
|
379
|
+
##
|
349
380
|
# @private
|
381
|
+
#
|
350
382
|
attr_reader :template
|
383
|
+
|
384
|
+
##
|
351
385
|
# @private
|
386
|
+
#
|
352
387
|
attr_reader :template_path
|
388
|
+
|
389
|
+
##
|
353
390
|
# @private
|
391
|
+
#
|
354
392
|
attr_reader :format
|
393
|
+
|
394
|
+
##
|
355
395
|
# @private
|
396
|
+
#
|
356
397
|
attr_reader :context_directory
|
357
398
|
|
399
|
+
##
|
358
400
|
# @private
|
401
|
+
#
|
359
402
|
def name
|
360
403
|
@name || DEFAULT_TOOL_NAME
|
361
404
|
end
|
362
405
|
|
406
|
+
##
|
363
407
|
# @private
|
408
|
+
#
|
364
409
|
def gem_version
|
365
410
|
return Array(@gem_version) if @gem_version
|
366
411
|
@bundler ? [] : DEFAULT_GEM_VERSION_REQUIREMENTS
|
367
412
|
end
|
368
413
|
|
414
|
+
##
|
369
415
|
# @private
|
416
|
+
#
|
370
417
|
def files
|
371
418
|
@files ? Array(@files) : DEFAULT_FILES
|
372
419
|
end
|
373
420
|
|
421
|
+
##
|
374
422
|
# @private
|
423
|
+
#
|
375
424
|
def output_dir
|
376
425
|
@output_dir || DEFAULT_OUTPUT_DIR
|
377
426
|
end
|
378
427
|
|
428
|
+
##
|
379
429
|
# @private
|
430
|
+
#
|
380
431
|
def options
|
381
432
|
Array(@options)
|
382
433
|
end
|
383
434
|
|
435
|
+
##
|
384
436
|
# @private
|
437
|
+
#
|
385
438
|
def stats_options
|
386
439
|
Array(@stats_options)
|
387
440
|
end
|
388
441
|
|
442
|
+
##
|
389
443
|
# @private
|
444
|
+
#
|
390
445
|
def bundler_settings
|
391
446
|
if @bundler && !@bundler.is_a?(::Hash)
|
392
447
|
{}
|
data/lib/toys/testing.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "shellwords"
|
4
|
+
|
3
5
|
module Toys
|
4
6
|
##
|
5
7
|
# Helpers for writing tool tests.
|
@@ -18,174 +20,249 @@ module Toys
|
|
18
20
|
end
|
19
21
|
|
20
22
|
##
|
21
|
-
#
|
22
|
-
#
|
23
|
+
# Prepares the tool corresponding to the given command line, but instead of
|
24
|
+
# running it, yields the execution context to the given block. This can be
|
25
|
+
# used to test individual methods in a tool.
|
23
26
|
#
|
24
27
|
# By default, a single CLI is shared among the tests in each test class or
|
25
28
|
# _describe_ block. Thus, tools are loaded only once, and the loader is
|
26
29
|
# shared across the tests. If you need to isolate loading for a test,
|
27
30
|
# create a separate CLI and pass it in using the `:cli` keyword argument.
|
28
31
|
#
|
29
|
-
#
|
30
|
-
#
|
31
|
-
#
|
32
|
-
#
|
33
|
-
#
|
34
|
-
#
|
35
|
-
# without "fork" support, such as JRuby or Ruby on Windows, consider
|
36
|
-
# {#exec_separate_tool}.
|
32
|
+
# Note: this method runs the given block in-process. This means you can
|
33
|
+
# test assertions within the block, but any input or output performed by
|
34
|
+
# the tool's methods that you call, will manifest during your test. If this
|
35
|
+
# is a problem, you might consider redirecting the standard streams when
|
36
|
+
# calling this method, for example by using
|
37
|
+
# [capture_subprocess_io](https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-capture_subprocess_io).
|
37
38
|
#
|
38
39
|
# @param cmd [String,Array<String>] The command to execute.
|
39
|
-
# @
|
40
|
-
# @
|
41
|
-
#
|
40
|
+
# @yieldparam tool [Toys::Context] The tool context.
|
41
|
+
# @return [Object] The value returned from the block.
|
42
|
+
#
|
43
|
+
# @example
|
44
|
+
# # Given the following tool:
|
45
|
+
#
|
46
|
+
# tool "hello" do
|
47
|
+
# flag :shout
|
48
|
+
# def run
|
49
|
+
# puts message
|
50
|
+
# end
|
51
|
+
# def message
|
52
|
+
# shout ? "HELLO" : "hello"
|
53
|
+
# end
|
54
|
+
# end
|
55
|
+
#
|
56
|
+
# # You can test the `message` method as follows:
|
42
57
|
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
58
|
+
# class MyTest < Minitest::Test
|
59
|
+
# include Toys::Testing
|
60
|
+
# def test_message_without_shout
|
61
|
+
# toys_load_tool(["hello"]) do |tool|
|
62
|
+
# assert_equal("hello", tool.message)
|
63
|
+
# end
|
64
|
+
# end
|
65
|
+
# def test_message_with_shout
|
66
|
+
# toys_load_tool(["hello", "--shout"]) do |tool|
|
67
|
+
# assert_equal("HELLO", tool.message)
|
68
|
+
# end
|
69
|
+
# end
|
70
|
+
# end
|
47
71
|
#
|
48
|
-
def
|
49
|
-
cli
|
72
|
+
def toys_load_tool(cmd, cli: nil, &block)
|
73
|
+
cli ||= toys_cli
|
50
74
|
cmd = ::Shellwords.split(cmd) if cmd.is_a?(::String)
|
51
|
-
cli.
|
52
|
-
tool_caller = proc { ::Kernel.exit(cli.run(*cmd)) }
|
53
|
-
self.class.toys_exec.exec_proc(tool_caller, **opts, &block)
|
75
|
+
cli.load_tool(*cmd, &block)
|
54
76
|
end
|
55
77
|
|
56
78
|
##
|
57
|
-
# Runs the tool corresponding to the given command line,
|
58
|
-
#
|
59
|
-
# {Toys::Exec::Result}.
|
79
|
+
# Runs the tool corresponding to the given command line, in-process, and
|
80
|
+
# returns the result code.
|
60
81
|
#
|
61
|
-
#
|
62
|
-
#
|
63
|
-
#
|
64
|
-
#
|
82
|
+
# By default, a single CLI is shared among the tests in each test class or
|
83
|
+
# _describe_ block. Thus, tools are loaded only once, and the loader is
|
84
|
+
# shared across the tests. If you need to isolate loading for a test,
|
85
|
+
# create a separate CLI and pass it in using the `:cli` keyword argument.
|
65
86
|
#
|
66
|
-
#
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
87
|
+
# Note: This method runs the tool in-process. This is often faster than
|
88
|
+
# running it in a separate process with {#toys_exec_tool}, but it also
|
89
|
+
# means any input or output performed by the tool, will manifest during
|
90
|
+
# your test. If this is a problem, you might consider redirecting the
|
91
|
+
# standard streams when calling this method, for example by using
|
92
|
+
# [capture_subprocess_io](https://docs.seattlerb.org/minitest/Minitest/Assertions.html#method-i-capture_subprocess_io).
|
70
93
|
#
|
71
94
|
# @param cmd [String,Array<String>] The command to execute.
|
72
|
-
# @
|
73
|
-
# @yieldparam controller [Toys::Utils::Exec::Controller] A controller
|
74
|
-
# for the subprocess streams.
|
75
|
-
#
|
76
|
-
# @return [Toys::Utils::Exec::Controller] The subprocess controller, if
|
77
|
-
# the process is running in the background.
|
78
|
-
# @return [Toys::Utils::Exec::Result] The result, if the process ran in
|
79
|
-
# the foreground.
|
95
|
+
# @return [Integer] The integer result code (i.e. 0 for success).
|
80
96
|
#
|
81
|
-
def
|
97
|
+
def toys_run_tool(cmd, cli: nil)
|
98
|
+
cli ||= toys_cli
|
82
99
|
cmd = ::Shellwords.split(cmd) if cmd.is_a?(::String)
|
83
|
-
|
84
|
-
self.class.toys_exec.exec(cmd, **opts, &block)
|
100
|
+
cli.run(*cmd)
|
85
101
|
end
|
86
102
|
|
87
103
|
##
|
88
|
-
# Runs the tool corresponding to the given command line,
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
# Note: this method uses "fork" to execute the tool. If you are using an
|
94
|
-
# environment without "fork" support, such as JRuby oor Ruby on Windows,
|
95
|
-
# consider {#capture_separate_tool}.
|
104
|
+
# Runs the tool corresponding to the given command line, in a separate
|
105
|
+
# forked process, and returns a {Toys::Exec::Result}. You can either
|
106
|
+
# provide a block to control the process, or simply let it run and capture
|
107
|
+
# its output.
|
96
108
|
#
|
97
|
-
#
|
98
|
-
#
|
99
|
-
#
|
100
|
-
#
|
101
|
-
#
|
102
|
-
# @return [Toys::Utils::Exec::Controller] The subprocess controller, if
|
103
|
-
# the process is running in the background.
|
104
|
-
# @return [Toys::Utils::Exec::Result] The result, if the process ran in
|
105
|
-
# the foreground.
|
109
|
+
# By default, a single CLI is shared among the tests in each test class or
|
110
|
+
# _describe_ block. Thus, tools are loaded only once, and the loader is
|
111
|
+
# shared across the tests. If you need to isolate loading for a test,
|
112
|
+
# create a separate CLI and pass it in using the `:cli` keyword argument.
|
106
113
|
#
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
##
|
113
|
-
# Runs the tool corresponding to the given command line, and returns the
|
114
|
-
# data written to `STDOUT`. This is equivalent to calling
|
115
|
-
# {#exec_separate_tool} with the keyword arguments
|
116
|
-
# `out: :capture, background: false`, and calling `#captured_out` on the
|
117
|
-
# result.
|
114
|
+
# All other keyword arguments are the same as those defined by the
|
115
|
+
# {Toys::Utils::Exec} class. If a block is given, all streams are directed
|
116
|
+
# to a {Toys::Utils::Exec::Controller} which is yielded to the block. If no
|
117
|
+
# block is given, the output and error streams are captured and the input
|
118
|
+
# stream is closed.
|
118
119
|
#
|
119
|
-
#
|
120
|
-
#
|
120
|
+
# This method uses "fork" to isolate the run of the tool. It will not work
|
121
|
+
# on environments such as JRuby or Ruby on Windows that do not support
|
122
|
+
# process forking.
|
121
123
|
#
|
122
124
|
# @param cmd [String,Array<String>] The command to execute.
|
123
125
|
# @param opts [keywords] The command options.
|
124
126
|
# @yieldparam controller [Toys::Utils::Exec::Controller] A controller
|
125
127
|
# for the subprocess streams.
|
128
|
+
# @return [Toys::Utils::Exec::Result] The process result.
|
126
129
|
#
|
127
|
-
# @
|
128
|
-
#
|
129
|
-
# @return [Toys::Utils::Exec::Result] The result, if the process ran in
|
130
|
-
# the foreground.
|
131
|
-
#
|
132
|
-
def capture_separate_tool(cmd, **opts, &block)
|
133
|
-
opts = opts.merge(out: :capture, background: false)
|
134
|
-
exec_separate_tool(cmd, **opts, &block).captured_out
|
135
|
-
end
|
136
|
-
|
137
|
-
##
|
138
|
-
# Runs the tool corresponding to the given command line, managing streams
|
139
|
-
# using a controller. This is equivalent to calling {#exec_tool} with the
|
140
|
-
# keyword arguments:
|
130
|
+
# @example
|
131
|
+
# # Given the following tool:
|
141
132
|
#
|
142
|
-
#
|
143
|
-
#
|
144
|
-
#
|
145
|
-
#
|
133
|
+
# tool "hello" do
|
134
|
+
# flag :shout
|
135
|
+
# def run
|
136
|
+
# puts message
|
137
|
+
# end
|
138
|
+
# def message
|
139
|
+
# shout ? "HELLO" : "hello"
|
140
|
+
# end
|
141
|
+
# end
|
146
142
|
#
|
147
|
-
#
|
148
|
-
# controller is passed to the block during the run, and a result object is
|
149
|
-
# returned. If no block is given, the command is run in the background, and
|
150
|
-
# the controller object is returned.
|
143
|
+
# # You can test the tool's output as follows:
|
151
144
|
#
|
152
|
-
#
|
153
|
-
#
|
154
|
-
#
|
155
|
-
#
|
145
|
+
# class MyTest < Minitest::Test
|
146
|
+
# include Toys::Testing
|
147
|
+
# def test_output_without_shout
|
148
|
+
# result = toys_exec_tool(["hello"])
|
149
|
+
# assert_equal("hello hello\n", result.captured_out)
|
150
|
+
# end
|
151
|
+
# def test_with_shout
|
152
|
+
# result = toys_exec_tool(["hello", "--shout"])
|
153
|
+
# assert_equal("HELLO HELLO\n", result.captured_out)
|
154
|
+
# end
|
155
|
+
# end
|
156
156
|
#
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
157
|
+
def toys_exec_tool(cmd, cli: nil, **opts, &block)
|
158
|
+
cli ||= toys_cli
|
159
|
+
cmd = ::Shellwords.split(cmd) if cmd.is_a?(::String)
|
160
|
+
opts =
|
161
|
+
if block
|
162
|
+
{
|
163
|
+
out: :controller,
|
164
|
+
err: :controller,
|
165
|
+
in: :controller,
|
166
|
+
}.merge(opts)
|
167
|
+
else
|
168
|
+
{
|
169
|
+
out: :capture,
|
170
|
+
err: :capture,
|
171
|
+
in: :close,
|
172
|
+
}.merge(opts)
|
173
|
+
end
|
174
|
+
cli.loader.lookup(cmd)
|
175
|
+
tool_caller = proc { ::Kernel.exit(cli.run(*cmd)) }
|
176
|
+
self.class.toys_exec.exec_proc(tool_caller, **opts, &block)
|
165
177
|
end
|
178
|
+
alias exec_tool toys_exec_tool
|
166
179
|
|
167
180
|
@toys_mutex = ::Mutex.new
|
168
181
|
|
182
|
+
##
|
169
183
|
# @private
|
184
|
+
#
|
170
185
|
def self.included(klass)
|
171
186
|
klass.extend(ClassMethods)
|
172
187
|
end
|
173
188
|
|
189
|
+
##
|
174
190
|
# @private
|
191
|
+
#
|
175
192
|
def self.toys_mutex
|
176
193
|
@toys_mutex
|
177
194
|
end
|
178
195
|
|
196
|
+
##
|
179
197
|
# @private
|
198
|
+
#
|
199
|
+
def self.toys_custom_paths(paths = :read)
|
200
|
+
@toys_custom_paths = paths unless paths == :read
|
201
|
+
@toys_custom_paths
|
202
|
+
end
|
203
|
+
|
204
|
+
##
|
205
|
+
# @private
|
206
|
+
#
|
207
|
+
def self.toys_include_builtins(value = :read)
|
208
|
+
@toys_include_builtins = value unless value == :read
|
209
|
+
@toys_include_builtins
|
210
|
+
end
|
211
|
+
|
212
|
+
@toys_custom_paths = nil
|
213
|
+
@toys_include_builtins = true
|
214
|
+
|
215
|
+
##
|
216
|
+
# Class methods added to a test class or describe block when
|
217
|
+
# {Toys::Testing} is included. Generally, these are methods that configure
|
218
|
+
# the load path for the CLI in scope for the block.
|
219
|
+
#
|
180
220
|
module ClassMethods
|
221
|
+
##
|
222
|
+
# Configure the Toys CLI to load tools from the given paths, and ignore
|
223
|
+
# the current directory and global paths.
|
224
|
+
#
|
225
|
+
# @param paths [String,Array<String>] The paths to load from.
|
226
|
+
#
|
227
|
+
def toys_custom_paths(paths = :read)
|
228
|
+
@toys_custom_paths = paths unless paths == :read
|
229
|
+
return @toys_custom_paths if defined?(@toys_custom_paths)
|
230
|
+
begin
|
231
|
+
super
|
232
|
+
rescue ::NoMethodError
|
233
|
+
Testing.toys_custom_paths
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
237
|
+
##
|
238
|
+
# Configure the Toys CLI to include or exclude builtins. Normally
|
239
|
+
# builtins are included unless false is passed to this method.
|
240
|
+
#
|
241
|
+
# @param value [boolean] Whether to include builtins.
|
242
|
+
#
|
243
|
+
def toys_include_builtins(value = :read)
|
244
|
+
@toys_include_builtins = value unless value == :read
|
245
|
+
return @toys_include_builtins if defined?(@toys_include_builtins)
|
246
|
+
begin
|
247
|
+
super
|
248
|
+
rescue ::NoMethodError
|
249
|
+
Testing.toys_include_builtins
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
##
|
181
254
|
# @private
|
255
|
+
#
|
182
256
|
def toys_cli
|
183
257
|
Testing.toys_mutex.synchronize do
|
184
|
-
@toys_cli ||= StandardCLI.new
|
258
|
+
@toys_cli ||= StandardCLI.new(custom_paths: toys_custom_paths,
|
259
|
+
include_builtins: toys_include_builtins)
|
185
260
|
end
|
186
261
|
end
|
187
262
|
|
263
|
+
##
|
188
264
|
# @private
|
265
|
+
#
|
189
266
|
def toys_exec
|
190
267
|
Testing.toys_mutex.synchronize do
|
191
268
|
require "toys/utils/exec"
|
data/lib/toys/version.rb
CHANGED
data/lib/toys.rb
CHANGED
@@ -6,7 +6,7 @@ require "toys/version"
|
|
6
6
|
# environment variable explicitly, but in production, we get it from rubygems.
|
7
7
|
# We prepend to $LOAD_PATH directly rather than calling Kernel.gem, so that we
|
8
8
|
# don't get clobbered in case someone sets up bundler later.
|
9
|
-
::ENV
|
9
|
+
unless ::ENV.key?("TOYS_CORE_LIB_PATH")
|
10
10
|
path = ::File.expand_path("../../toys-core-#{::Toys::VERSION}/lib", __dir__)
|
11
11
|
unless path && ::File.directory?(path)
|
12
12
|
require "rubygems"
|
@@ -14,7 +14,7 @@ require "toys/version"
|
|
14
14
|
path = dep.to_spec.full_require_paths.first
|
15
15
|
end
|
16
16
|
abort "Unable to find toys-core gem!" unless path && ::File.directory?(path)
|
17
|
-
path
|
17
|
+
::ENV.store("TOYS_CORE_LIB_PATH", path)
|
18
18
|
end
|
19
19
|
|
20
20
|
$LOAD_PATH.delete(::ENV["TOYS_CORE_LIB_PATH"])
|
@@ -39,7 +39,9 @@ module Toys
|
|
39
39
|
#
|
40
40
|
EXECUTABLE_PATH = ::ENV["TOYS_BIN_PATH"]
|
41
41
|
|
42
|
+
##
|
42
43
|
# @private
|
44
|
+
#
|
43
45
|
LIB_PATH = __dir__
|
44
46
|
|
45
47
|
##
|
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.
|
4
|
+
version: 0.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-08 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.
|
19
|
+
version: 0.13.0
|
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.
|
26
|
+
version: 0.13.0
|
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
|
@@ -45,8 +45,58 @@ files:
|
|
45
45
|
- bin/toys
|
46
46
|
- builtins/do.rb
|
47
47
|
- builtins/system/bash-completion.rb
|
48
|
+
- builtins/system/git-cache.rb
|
48
49
|
- builtins/system/test.rb
|
49
50
|
- builtins/system/update.rb
|
51
|
+
- core-docs/toys-core.rb
|
52
|
+
- core-docs/toys/acceptor.rb
|
53
|
+
- core-docs/toys/arg_parser.rb
|
54
|
+
- core-docs/toys/cli.rb
|
55
|
+
- core-docs/toys/compat.rb
|
56
|
+
- core-docs/toys/completion.rb
|
57
|
+
- core-docs/toys/context.rb
|
58
|
+
- core-docs/toys/core.rb
|
59
|
+
- core-docs/toys/dsl/base.rb
|
60
|
+
- core-docs/toys/dsl/flag.rb
|
61
|
+
- core-docs/toys/dsl/flag_group.rb
|
62
|
+
- core-docs/toys/dsl/internal.rb
|
63
|
+
- core-docs/toys/dsl/positional_arg.rb
|
64
|
+
- core-docs/toys/dsl/tool.rb
|
65
|
+
- core-docs/toys/errors.rb
|
66
|
+
- core-docs/toys/flag.rb
|
67
|
+
- core-docs/toys/flag_group.rb
|
68
|
+
- core-docs/toys/input_file.rb
|
69
|
+
- core-docs/toys/loader.rb
|
70
|
+
- core-docs/toys/middleware.rb
|
71
|
+
- core-docs/toys/mixin.rb
|
72
|
+
- core-docs/toys/module_lookup.rb
|
73
|
+
- core-docs/toys/positional_arg.rb
|
74
|
+
- core-docs/toys/settings.rb
|
75
|
+
- core-docs/toys/source_info.rb
|
76
|
+
- core-docs/toys/standard_middleware/add_verbosity_flags.rb
|
77
|
+
- core-docs/toys/standard_middleware/apply_config.rb
|
78
|
+
- core-docs/toys/standard_middleware/handle_usage_errors.rb
|
79
|
+
- core-docs/toys/standard_middleware/set_default_descriptions.rb
|
80
|
+
- core-docs/toys/standard_middleware/show_help.rb
|
81
|
+
- core-docs/toys/standard_middleware/show_root_version.rb
|
82
|
+
- core-docs/toys/standard_mixins/bundler.rb
|
83
|
+
- core-docs/toys/standard_mixins/exec.rb
|
84
|
+
- core-docs/toys/standard_mixins/fileutils.rb
|
85
|
+
- core-docs/toys/standard_mixins/gems.rb
|
86
|
+
- core-docs/toys/standard_mixins/git_cache.rb
|
87
|
+
- core-docs/toys/standard_mixins/highline.rb
|
88
|
+
- core-docs/toys/standard_mixins/terminal.rb
|
89
|
+
- core-docs/toys/standard_mixins/xdg.rb
|
90
|
+
- core-docs/toys/template.rb
|
91
|
+
- core-docs/toys/tool_definition.rb
|
92
|
+
- core-docs/toys/utils/completion_engine.rb
|
93
|
+
- core-docs/toys/utils/exec.rb
|
94
|
+
- core-docs/toys/utils/gems.rb
|
95
|
+
- core-docs/toys/utils/git_cache.rb
|
96
|
+
- core-docs/toys/utils/help_text.rb
|
97
|
+
- core-docs/toys/utils/terminal.rb
|
98
|
+
- core-docs/toys/utils/xdg.rb
|
99
|
+
- core-docs/toys/wrappable_string.rb
|
50
100
|
- docs/guide.md
|
51
101
|
- lib/toys.rb
|
52
102
|
- lib/toys/standard_cli.rb
|
@@ -66,10 +116,10 @@ homepage: https://github.com/dazuma/toys
|
|
66
116
|
licenses:
|
67
117
|
- MIT
|
68
118
|
metadata:
|
69
|
-
changelog_uri: https://dazuma.github.io/toys/gems/toys/v0.
|
119
|
+
changelog_uri: https://dazuma.github.io/toys/gems/toys/v0.13.0/file.CHANGELOG.html
|
70
120
|
source_code_uri: https://github.com/dazuma/toys/tree/main/toys
|
71
121
|
bug_tracker_uri: https://github.com/dazuma/toys/issues
|
72
|
-
documentation_uri: https://dazuma.github.io/toys/gems/toys/v0.
|
122
|
+
documentation_uri: https://dazuma.github.io/toys/gems/toys/v0.13.0
|
73
123
|
post_install_message:
|
74
124
|
rdoc_options: []
|
75
125
|
require_paths:
|