toys 0.15.6 → 0.16.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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -1
  3. data/README.md +2 -2
  4. data/builtins/system/tools.rb +1 -1
  5. data/lib/toys/templates/clean.rb +1 -1
  6. data/lib/toys/templates/gem_build.rb +1 -1
  7. data/lib/toys/templates/rubocop.rb +4 -1
  8. data/lib/toys/version.rb +1 -1
  9. metadata +8 -63
  10. data/core-docs/toys/acceptor.rb +0 -474
  11. data/core-docs/toys/arg_parser.rb +0 -397
  12. data/core-docs/toys/cli.rb +0 -466
  13. data/core-docs/toys/compat.rb +0 -2
  14. data/core-docs/toys/completion.rb +0 -340
  15. data/core-docs/toys/context.rb +0 -386
  16. data/core-docs/toys/core.rb +0 -14
  17. data/core-docs/toys/dsl/base.rb +0 -56
  18. data/core-docs/toys/dsl/flag.rb +0 -284
  19. data/core-docs/toys/dsl/flag_group.rb +0 -267
  20. data/core-docs/toys/dsl/internal.rb +0 -4
  21. data/core-docs/toys/dsl/positional_arg.rb +0 -155
  22. data/core-docs/toys/dsl/tool.rb +0 -1639
  23. data/core-docs/toys/errors.rb +0 -126
  24. data/core-docs/toys/flag.rb +0 -560
  25. data/core-docs/toys/flag_group.rb +0 -186
  26. data/core-docs/toys/input_file.rb +0 -17
  27. data/core-docs/toys/loader.rb +0 -363
  28. data/core-docs/toys/middleware.rb +0 -336
  29. data/core-docs/toys/mixin.rb +0 -142
  30. data/core-docs/toys/module_lookup.rb +0 -75
  31. data/core-docs/toys/positional_arg.rb +0 -145
  32. data/core-docs/toys/settings.rb +0 -524
  33. data/core-docs/toys/source_info.rb +0 -271
  34. data/core-docs/toys/standard_middleware/add_verbosity_flags.rb +0 -49
  35. data/core-docs/toys/standard_middleware/apply_config.rb +0 -24
  36. data/core-docs/toys/standard_middleware/handle_usage_errors.rb +0 -33
  37. data/core-docs/toys/standard_middleware/set_default_descriptions.rb +0 -222
  38. data/core-docs/toys/standard_middleware/show_help.rb +0 -190
  39. data/core-docs/toys/standard_middleware/show_root_version.rb +0 -45
  40. data/core-docs/toys/standard_mixins/bundler.rb +0 -98
  41. data/core-docs/toys/standard_mixins/exec.rb +0 -711
  42. data/core-docs/toys/standard_mixins/fileutils.rb +0 -18
  43. data/core-docs/toys/standard_mixins/gems.rb +0 -62
  44. data/core-docs/toys/standard_mixins/git_cache.rb +0 -41
  45. data/core-docs/toys/standard_mixins/highline.rb +0 -133
  46. data/core-docs/toys/standard_mixins/pager.rb +0 -50
  47. data/core-docs/toys/standard_mixins/terminal.rb +0 -135
  48. data/core-docs/toys/standard_mixins/xdg.rb +0 -49
  49. data/core-docs/toys/template.rb +0 -112
  50. data/core-docs/toys/tool_definition.rb +0 -1079
  51. data/core-docs/toys/utils/completion_engine.rb +0 -49
  52. data/core-docs/toys/utils/exec.rb +0 -776
  53. data/core-docs/toys/utils/gems.rb +0 -185
  54. data/core-docs/toys/utils/git_cache.rb +0 -353
  55. data/core-docs/toys/utils/help_text.rb +0 -134
  56. data/core-docs/toys/utils/pager.rb +0 -118
  57. data/core-docs/toys/utils/standard_ui.rb +0 -184
  58. data/core-docs/toys/utils/terminal.rb +0 -310
  59. data/core-docs/toys/utils/xdg.rb +0 -253
  60. data/core-docs/toys/wrappable_string.rb +0 -132
  61. data/core-docs/toys-core.rb +0 -111
@@ -1,190 +0,0 @@
1
- module Toys
2
- module StandardMiddleware
3
- ##
4
- # **_Defined in the toys-core gem_**
5
- #
6
- # A middleware that shows help text for the tool when a flag (typically
7
- # `--help`) is provided. It can also be configured to show help by
8
- # default if the tool is a namespace that is not runnable.
9
- #
10
- # If a tool is not runnable, this middleware can also add a
11
- # `--[no-]recursive` flag, which, when set to `true` (the default), shows
12
- # all subtools recursively rather than only immediate subtools. This
13
- # middleware can also search for keywords in its subtools.
14
- #
15
- class ShowHelp
16
- ##
17
- # Default help flags
18
- # @return [Array<String>]
19
- #
20
- DEFAULT_HELP_FLAGS = ["-?", "--help"].freeze
21
-
22
- ##
23
- # Default usage flags
24
- # @return [Array<String>]
25
- #
26
- DEFAULT_USAGE_FLAGS = ["--usage"].freeze
27
-
28
- ##
29
- # Default list subtools flags
30
- # @return [Array<String>]
31
- #
32
- DEFAULT_LIST_FLAGS = ["--tools"].freeze
33
-
34
- ##
35
- # Default recursive flags
36
- # @return [Array<String>]
37
- #
38
- DEFAULT_RECURSIVE_FLAGS = ["-r", "--[no-]recursive"].freeze
39
-
40
- ##
41
- # Default search flags
42
- # @return [Array<String>]
43
- #
44
- DEFAULT_SEARCH_FLAGS = ["-s WORD", "--search=WORD"].freeze
45
-
46
- ##
47
- # Default show-all-subtools flags
48
- # @return [Array<String>]
49
- #
50
- DEFAULT_SHOW_ALL_SUBTOOLS_FLAGS = ["--all"].freeze
51
-
52
- ##
53
- # Key set when the show help flag is present
54
- # @return [Object]
55
- #
56
- SHOW_HELP_KEY = Object.new.freeze
57
-
58
- ##
59
- # Key set when the show usage flag is present
60
- # @return [Object]
61
- #
62
- SHOW_USAGE_KEY = Object.new.freeze
63
-
64
- ##
65
- # Key set when the show subtool list flag is present
66
- # @return [Object]
67
- #
68
- SHOW_LIST_KEY = Object.new.freeze
69
-
70
- ##
71
- # Key for the recursive setting
72
- # @return [Object]
73
- #
74
- RECURSIVE_SUBTOOLS_KEY = Object.new.freeze
75
-
76
- ##
77
- # Key for the search string
78
- # @return [Object]
79
- #
80
- SEARCH_STRING_KEY = Object.new.freeze
81
-
82
- ##
83
- # Key for the show-all-subtools setting
84
- # @return [Object]
85
- #
86
- SHOW_ALL_SUBTOOLS_KEY = Object.new.freeze
87
-
88
- ##
89
- # Key for the tool name
90
- # @return [Object]
91
- #
92
- TOOL_NAME_KEY = Object.new.freeze
93
-
94
- ##
95
- # Create a ShowHelp middleware.
96
- #
97
- # @param help_flags [Boolean,Array<String>,Proc] Specify flags to
98
- # display help. The value may be any of the following:
99
- #
100
- # * An array of flags.
101
- # * The `true` value to use {DEFAULT_HELP_FLAGS}.
102
- # * The `false` value for no flags. (Default)
103
- # * A proc that takes a tool and returns any of the above.
104
- #
105
- # @param usage_flags [Boolean,Array<String>,Proc] Specify flags to
106
- # display usage. The value may be any of the following:
107
- #
108
- # * An array of flags.
109
- # * The `true` value to use {DEFAULT_USAGE_FLAGS}.
110
- # * The `false` value for no flags. (Default)
111
- # * A proc that takes a tool and returns any of the above.
112
- #
113
- # @param list_flags [Boolean,Array<String>,Proc] Specify flags to
114
- # display subtool list. The value may be any of the following:
115
- #
116
- # * An array of flags.
117
- # * The `true` value to use {DEFAULT_LIST_FLAGS}.
118
- # * The `false` value for no flags. (Default)
119
- # * A proc that takes a tool and returns any of the above.
120
- #
121
- # @param recursive_flags [Boolean,Array<String>,Proc] Specify flags
122
- # to control recursive subtool search. The value may be any of the
123
- # following:
124
- #
125
- # * An array of flags.
126
- # * The `true` value to use {DEFAULT_RECURSIVE_FLAGS}.
127
- # * The `false` value for no flags. (Default)
128
- # * A proc that takes a tool and returns any of the above.
129
- #
130
- # @param search_flags [Boolean,Array<String>,Proc] Specify flags
131
- # to search subtools for a search term. The value may be any of
132
- # the following:
133
- #
134
- # * An array of flags.
135
- # * The `true` value to use {DEFAULT_SEARCH_FLAGS}.
136
- # * The `false` value for no flags. (Default)
137
- # * A proc that takes a tool and returns any of the above.
138
- #
139
- # @param show_all_subtools_flags [Boolean,Array<String>,Proc] Specify
140
- # flags to show all subtools, including hidden tools and non-runnable
141
- # namespaces. The value may be any of the following:
142
- #
143
- # * An array of flags.
144
- # * The `true` value to use {DEFAULT_SHOW_ALL_SUBTOOLS_FLAGS}.
145
- # * The `false` value for no flags. (Default)
146
- # * A proc that takes a tool and returns any of the above.
147
- #
148
- # @param default_recursive [Boolean] Whether to search recursively for
149
- # subtools by default. Default is `false`.
150
- # @param default_show_all_subtools [Boolean] Whether to show all subtools
151
- # by default. Default is `false`.
152
- # @param fallback_execution [Boolean] Cause the tool to display its own
153
- # help text if it is not otherwise runnable. This is mostly useful
154
- # for namespaces, which have children are not runnable. Default is
155
- # `false`.
156
- # @param allow_root_args [Boolean] If the root tool includes flags for
157
- # help or usage, and doesn't otherwise use positional arguments,
158
- # then a tool name can be passed as arguments to display help for
159
- # that tool.
160
- # @param show_source_path [Boolean] Show the source path section. Default
161
- # is `false`.
162
- # @param separate_sources [Boolean] Split up tool list by source root.
163
- # Defaults to false.
164
- # @param use_less [Boolean] If the `less` tool is available, and the
165
- # output stream is a tty, then use `less` to display help text.
166
- # @param stream [IO] Output stream to write to. Default is stdout.
167
- # @param styled_output [Boolean,nil] Cause the tool to display help text
168
- # with ansi styles. If `nil`, display styles if the output stream is
169
- # a tty. Default is `nil`.
170
- #
171
- def initialize(help_flags: false,
172
- usage_flags: false,
173
- list_flags: false,
174
- recursive_flags: false,
175
- search_flags: false,
176
- show_all_subtools_flags: false,
177
- default_recursive: false,
178
- default_show_all_subtools: false,
179
- fallback_execution: false,
180
- allow_root_args: false,
181
- show_source_path: false,
182
- separate_sources: false,
183
- use_less: false,
184
- stream: $stdout,
185
- styled_output: nil)
186
- # Source available in the toys-core gem
187
- end
188
- end
189
- end
190
- end
@@ -1,45 +0,0 @@
1
- module Toys
2
- module StandardMiddleware
3
- ##
4
- # **_Defined in the toys-core gem_**
5
- #
6
- # A middleware that displays a version string for the root tool if the
7
- # `--version` flag is given.
8
- #
9
- class ShowRootVersion
10
- ##
11
- # Default version flags
12
- # @return [Array<String>]
13
- #
14
- DEFAULT_VERSION_FLAGS = ["--version"].freeze
15
-
16
- ##
17
- # Default description for the version flags
18
- # @return [String]
19
- #
20
- DEFAULT_VERSION_FLAG_DESC = "Display the version"
21
-
22
- ##
23
- # Key set when the version flag is present
24
- # @return [Object]
25
- #
26
- SHOW_VERSION_KEY = Object.new.freeze
27
-
28
- ##
29
- # Create a ShowVersion middleware
30
- #
31
- # @param version_string [String] The string that should be displayed.
32
- # @param version_flags [Array<String>] A list of flags that should
33
- # trigger displaying the version. Default is
34
- # {DEFAULT_VERSION_FLAGS}.
35
- # @param stream [IO] Output stream to write to. Default is stdout.
36
- #
37
- def initialize(version_string: nil,
38
- version_flags: DEFAULT_VERSION_FLAGS,
39
- version_flag_desc: DEFAULT_VERSION_FLAG_DESC,
40
- stream: $stdout)
41
- # Source available in the toys-core gem
42
- end
43
- end
44
- end
45
- end
@@ -1,98 +0,0 @@
1
- module Toys
2
- module StandardMixins
3
- ##
4
- # **_Defined in the toys-core gem_**
5
- #
6
- # Ensures that a bundle is installed and set up when this tool is run.
7
- #
8
- # This is the normal recommended way to use [bundler](https://bundler.io)
9
- # with Toys. Including this mixin in a tool will cause Toys to ensure that
10
- # the bundle is installed and available during tool execution. For example:
11
- #
12
- # tool "run-rails" do
13
- # include :bundler
14
- # def run
15
- # # Note: no "bundle exec" required because Toys has already
16
- # # installed and loaded the bundle.
17
- # exec "rails s"
18
- # end
19
- # end
20
- #
21
- # ### Customization
22
- #
23
- # The following parameters can be passed when including this mixin:
24
- #
25
- # * `:static` (Boolean) If `true`, installs the bundle immediately, when
26
- # defining the tool. If `false` (the default), installs the bundle just
27
- # before the tool runs.
28
- #
29
- # * `:groups` (Array\<String\>) The groups to include in setup.
30
- #
31
- # * `:gemfile_path` (String) The path to the Gemfile to use. If `nil` or
32
- # not given, the `:search_dirs` will be searched for a Gemfile.
33
- #
34
- # * `:search_dirs` (String,Symbol,Array\<String,Symbol\>) Directories to
35
- # search for a Gemfile.
36
- #
37
- # You can pass full directory paths, and/or any of the following:
38
- # * `:context` - the current context directory.
39
- # * `:current` - the current working directory.
40
- # * `:toys` - the Toys directory containing the tool definition, and
41
- # any of its parents within the Toys directory hierarchy.
42
- #
43
- # The default is to search `[:toys, :context, :current]` in that order.
44
- # See {DEFAULT_SEARCH_DIRS}.
45
- #
46
- # For most directories, the bundler mixin will look for the files
47
- # ".gems.rb", "gems.rb", and "Gemfile", in that order. In `:toys`
48
- # directories, it will look only for ".gems.rb" and "Gemfile", in that
49
- # order. These can be overridden by setting the `:gemfile_names` and/or
50
- # `:toys_gemfile_names` arguments.
51
- #
52
- # * `:gemfile_names` (Array\<String\>) File names that are recognized as
53
- # Gemfiles when searching in directories other than Toys directories.
54
- # Defaults to {Toys::Utils::Gems::DEFAULT_GEMFILE_NAMES}.
55
- #
56
- # * `:toys_gemfile_names` (Array\<String\>) File names that are
57
- # recognized as Gemfiles when searching in Toys directories.
58
- # Defaults to {DEFAULT_TOYS_GEMFILE_NAMES}.
59
- #
60
- # * `:on_missing` (Symbol) What to do if a needed gem is not installed.
61
- #
62
- # Supported values:
63
- # * `:confirm` - prompt the user on whether to install (default).
64
- # * `:error` - raise an exception.
65
- # * `:install` - just install the gem.
66
- #
67
- # * `:on_conflict` (Symbol) What to do if bundler has already been run
68
- # with a different Gemfile.
69
- #
70
- # Supported values:
71
- # * `:error` - raise an exception (default).
72
- # * `:ignore` - just silently proceed without bundling again.
73
- # * `:warn` - print a warning and proceed without bundling again.
74
- #
75
- # * `:retries` (Integer) Number of times to retry bundler operations
76
- # (optional)
77
- #
78
- # * `:terminal` (Toys::Utils::Terminal) Terminal to use (optional)
79
- # * `:input` (IO) Input IO (optional, defaults to STDIN)
80
- # * `:output` (IO) Output IO (optional, defaults to STDOUT)
81
- #
82
- module Bundler
83
- include Mixin
84
-
85
- ##
86
- # Default search directories for Gemfiles.
87
- # @return [Array<String,Symbol>]
88
- #
89
- DEFAULT_SEARCH_DIRS = [:toys, :context, :current].freeze
90
-
91
- ##
92
- # The gemfile names that are searched by default in Toys directories.
93
- # @return [Array<String>]
94
- #
95
- DEFAULT_TOYS_GEMFILE_NAMES = [".gems.rb", "Gemfile"].freeze
96
- end
97
- end
98
- end