danger-packwerk 0.7.0 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/danger-packwerk/packwerk_wrapper.rb +2 -2
- data/lib/danger-packwerk/version.rb +1 -1
- data/sorbet/config +1 -0
- data/sorbet/rbi/gems/actionview@7.0.4.rbi +11543 -0
- data/sorbet/rbi/gems/activesupport@7.0.4.rbi +12959 -0
- data/sorbet/rbi/gems/addressable@2.8.1.rbi +1505 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +522 -0
- data/sorbet/rbi/gems/better_html@2.0.1.rbi +286 -0
- data/sorbet/rbi/gems/builder@3.2.4.rbi +8 -0
- data/sorbet/rbi/gems/claide-plugins@0.9.2.rbi +791 -0
- data/sorbet/rbi/gems/claide@1.1.0.rbi +1132 -0
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +2256 -0
- data/sorbet/rbi/gems/colored2@3.1.2.rbi +130 -0
- data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +8695 -0
- data/sorbet/rbi/gems/cork@0.3.0.rbi +248 -0
- data/sorbet/rbi/gems/crass@1.0.6.rbi +436 -0
- data/sorbet/rbi/gems/danger-plugin-api@1.0.0.rbi +8 -0
- data/sorbet/rbi/gems/danger@9.0.0.rbi +4722 -0
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +862 -0
- data/sorbet/rbi/gems/erubi@1.11.0.rbi +102 -0
- data/sorbet/rbi/gems/faraday-em_http@1.0.0.rbi +266 -0
- data/sorbet/rbi/gems/faraday-em_synchrony@1.0.0.rbi +209 -0
- data/sorbet/rbi/gems/faraday-excon@1.1.0.rbi +212 -0
- data/sorbet/rbi/gems/faraday-http-cache@2.4.1.rbi +805 -0
- data/sorbet/rbi/gems/faraday-httpclient@1.0.1.rbi +221 -0
- data/sorbet/rbi/gems/faraday-multipart@1.0.4.rbi +266 -0
- data/sorbet/rbi/gems/faraday-net_http@1.0.1.rbi +216 -0
- data/sorbet/rbi/gems/faraday-net_http_persistent@1.2.0.rbi +206 -0
- data/sorbet/rbi/gems/faraday-patron@1.0.0.rbi +212 -0
- data/sorbet/rbi/gems/faraday-rack@1.0.0.rbi +225 -0
- data/sorbet/rbi/gems/faraday-retry@1.0.3.rbi +222 -0
- data/sorbet/rbi/gems/faraday@1.10.2.rbi +1862 -0
- data/sorbet/rbi/gems/git@1.12.0.rbi +1936 -0
- data/sorbet/rbi/gems/i18n@1.12.0.rbi +1643 -0
- data/sorbet/rbi/gems/json@2.6.2.rbi +1418 -0
- data/sorbet/rbi/gems/kramdown-parser-gfm@1.1.0.rbi +8 -0
- data/sorbet/rbi/gems/kramdown@2.4.0.rbi +2168 -0
- data/sorbet/rbi/gems/loofah@2.19.0.rbi +646 -0
- data/sorbet/rbi/gems/method_source@1.0.0.rbi +199 -0
- data/sorbet/rbi/gems/minitest@5.16.3.rbi +997 -0
- data/sorbet/rbi/gems/multipart-post@2.2.3.rbi +165 -0
- data/sorbet/rbi/gems/nap@1.1.0.rbi +351 -0
- data/sorbet/rbi/gems/no_proxy_fix@0.1.2.rbi +8 -0
- data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +4916 -0
- data/sorbet/rbi/gems/octokit@5.6.1.rbi +8939 -0
- data/sorbet/rbi/gems/open4@1.3.4.rbi +8 -0
- data/sorbet/rbi/gems/{packwerk@2.1.1.rbi → packwerk@2.2.1.rbi} +602 -51
- data/sorbet/rbi/gems/parallel@1.22.1.rbi +163 -0
- data/sorbet/rbi/gems/parser@3.1.2.1.rbi +5988 -0
- data/sorbet/rbi/gems/pry@0.14.1.rbi +6969 -0
- data/sorbet/rbi/gems/public_suffix@5.0.0.rbi +779 -0
- data/sorbet/rbi/gems/racc@1.6.0.rbi +92 -0
- data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +8 -0
- data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +493 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +227 -0
- data/sorbet/rbi/gems/rake@13.0.6.rbi +1865 -0
- data/sorbet/rbi/gems/rbi@0.0.14.rbi +2337 -0
- data/sorbet/rbi/gems/rchardet@1.8.0.rbi +587 -0
- data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +1851 -0
- data/sorbet/rbi/gems/rexml@3.2.5.rbi +3852 -0
- data/sorbet/rbi/gems/rspec-core@3.11.0.rbi +7725 -0
- data/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi +6201 -0
- data/sorbet/rbi/gems/rspec-mocks@3.11.1.rbi +3625 -0
- data/sorbet/rbi/gems/rspec-support@3.11.0.rbi +1176 -0
- data/sorbet/rbi/gems/rspec@3.11.0.rbi +40 -0
- data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +4193 -0
- data/sorbet/rbi/gems/rubocop-sorbet@0.6.8.rbi +677 -0
- data/sorbet/rbi/gems/rubocop@1.36.0.rbi +37914 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +732 -0
- data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +8 -0
- data/sorbet/rbi/gems/sawyer@0.9.2.rbi +513 -0
- data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +326 -0
- data/sorbet/rbi/gems/spoom@1.1.11.rbi +1600 -0
- data/sorbet/rbi/gems/tapioca@0.8.0.rbi +1959 -0
- data/sorbet/rbi/gems/terminal-table@3.0.2.rbi +438 -0
- data/sorbet/rbi/gems/thor@1.2.1.rbi +2921 -0
- data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +4879 -0
- data/sorbet/rbi/gems/unicode-display_width@2.3.0.rbi +27 -0
- data/sorbet/rbi/gems/unparser@0.6.5.rbi +2789 -0
- data/sorbet/rbi/gems/webrick@1.7.0.rbi +1802 -0
- data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +288 -0
- data/sorbet/rbi/gems/yard@0.9.27.rbi +12668 -0
- data/sorbet/rbi/todo.rbi +122 -0
- metadata +84 -7
- data/sorbet/rbi/gems/danger@8.5.0.rbi +0 -122
@@ -0,0 +1,2921 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `thor` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem thor`.
|
6
|
+
|
7
|
+
class Thor
|
8
|
+
include ::Thor::Base
|
9
|
+
include ::Thor::Invocation
|
10
|
+
include ::Thor::Shell
|
11
|
+
extend ::Thor::Base::ClassMethods
|
12
|
+
extend ::Thor::Invocation::ClassMethods
|
13
|
+
|
14
|
+
def help(command = T.unsafe(nil), subcommand = T.unsafe(nil)); end
|
15
|
+
|
16
|
+
class << self
|
17
|
+
# Extend check unknown options to accept a hash of conditions.
|
18
|
+
#
|
19
|
+
# === Parameters
|
20
|
+
# options<Hash>: A hash containing :only and/or :except keys
|
21
|
+
def check_unknown_options!(options = T.unsafe(nil)); end
|
22
|
+
|
23
|
+
# Overwrite check_unknown_options? to take subcommands and options into account.
|
24
|
+
#
|
25
|
+
# @return [Boolean]
|
26
|
+
def check_unknown_options?(config); end
|
27
|
+
|
28
|
+
# Prints help information for the given command.
|
29
|
+
#
|
30
|
+
# ==== Parameters
|
31
|
+
# shell<Thor::Shell>
|
32
|
+
# command_name<String>
|
33
|
+
def command_help(shell, command_name); end
|
34
|
+
|
35
|
+
# Sets the default command when thor is executed without an explicit command to be called.
|
36
|
+
#
|
37
|
+
# ==== Parameters
|
38
|
+
# meth<Symbol>:: name of the default command
|
39
|
+
def default_command(meth = T.unsafe(nil)); end
|
40
|
+
|
41
|
+
# Sets the default command when thor is executed without an explicit command to be called.
|
42
|
+
#
|
43
|
+
# ==== Parameters
|
44
|
+
# meth<Symbol>:: name of the default command
|
45
|
+
def default_task(meth = T.unsafe(nil)); end
|
46
|
+
|
47
|
+
def deprecation_warning(message); end
|
48
|
+
|
49
|
+
# Defines the usage and the description of the next command.
|
50
|
+
#
|
51
|
+
# ==== Parameters
|
52
|
+
# usage<String>
|
53
|
+
# description<String>
|
54
|
+
# options<String>
|
55
|
+
def desc(usage, description, options = T.unsafe(nil)); end
|
56
|
+
|
57
|
+
# Disable the check for required options for the given commands.
|
58
|
+
# This is useful if you have a command that does not need the required options
|
59
|
+
# to work, like help.
|
60
|
+
#
|
61
|
+
# ==== Parameters
|
62
|
+
# Symbol ...:: A list of commands that should be affected.
|
63
|
+
def disable_required_check!(*command_names); end
|
64
|
+
|
65
|
+
# @return [Boolean]
|
66
|
+
def disable_required_check?(command); end
|
67
|
+
|
68
|
+
# Prints help information for this class.
|
69
|
+
#
|
70
|
+
# ==== Parameters
|
71
|
+
# shell<Thor::Shell>
|
72
|
+
def help(shell, subcommand = T.unsafe(nil)); end
|
73
|
+
|
74
|
+
# Defines the long description of the next command.
|
75
|
+
#
|
76
|
+
# ==== Parameters
|
77
|
+
# long description<String>
|
78
|
+
def long_desc(long_description, options = T.unsafe(nil)); end
|
79
|
+
|
80
|
+
# Maps an input to a command. If you define:
|
81
|
+
#
|
82
|
+
# map "-T" => "list"
|
83
|
+
#
|
84
|
+
# Running:
|
85
|
+
#
|
86
|
+
# thor -T
|
87
|
+
#
|
88
|
+
# Will invoke the list command.
|
89
|
+
#
|
90
|
+
# ==== Parameters
|
91
|
+
# Hash[String|Array => Symbol]:: Maps the string or the strings in the array to the given command.
|
92
|
+
def map(mappings = T.unsafe(nil), **kw); end
|
93
|
+
|
94
|
+
# Adds an option to the set of method options. If :for is given as option,
|
95
|
+
# it allows you to change the options from a previous defined command.
|
96
|
+
#
|
97
|
+
# def previous_command
|
98
|
+
# # magic
|
99
|
+
# end
|
100
|
+
#
|
101
|
+
# method_option :foo => :bar, :for => :previous_command
|
102
|
+
#
|
103
|
+
# def next_command
|
104
|
+
# # magic
|
105
|
+
# end
|
106
|
+
#
|
107
|
+
# ==== Parameters
|
108
|
+
# name<Symbol>:: The name of the argument.
|
109
|
+
# options<Hash>:: Described below.
|
110
|
+
#
|
111
|
+
# ==== Options
|
112
|
+
# :desc - Description for the argument.
|
113
|
+
# :required - If the argument is required or not.
|
114
|
+
# :default - Default value for this argument. It cannot be required and have default values.
|
115
|
+
# :aliases - Aliases for this option.
|
116
|
+
# :type - The type of the argument, can be :string, :hash, :array, :numeric or :boolean.
|
117
|
+
# :banner - String to show on usage notes.
|
118
|
+
# :hide - If you want to hide this option from the help.
|
119
|
+
def method_option(name, options = T.unsafe(nil)); end
|
120
|
+
|
121
|
+
# Declares the options for the next command to be declared.
|
122
|
+
#
|
123
|
+
# ==== Parameters
|
124
|
+
# Hash[Symbol => Object]:: The hash key is the name of the option and the value
|
125
|
+
# is the type of the option. Can be :string, :array, :hash, :boolean, :numeric
|
126
|
+
# or :required (string). If you give a value, the type of the value is used.
|
127
|
+
def method_options(options = T.unsafe(nil)); end
|
128
|
+
|
129
|
+
# Adds an option to the set of method options. If :for is given as option,
|
130
|
+
# it allows you to change the options from a previous defined command.
|
131
|
+
#
|
132
|
+
# def previous_command
|
133
|
+
# # magic
|
134
|
+
# end
|
135
|
+
#
|
136
|
+
# method_option :foo => :bar, :for => :previous_command
|
137
|
+
#
|
138
|
+
# def next_command
|
139
|
+
# # magic
|
140
|
+
# end
|
141
|
+
#
|
142
|
+
# ==== Parameters
|
143
|
+
# name<Symbol>:: The name of the argument.
|
144
|
+
# options<Hash>:: Described below.
|
145
|
+
#
|
146
|
+
# ==== Options
|
147
|
+
# :desc - Description for the argument.
|
148
|
+
# :required - If the argument is required or not.
|
149
|
+
# :default - Default value for this argument. It cannot be required and have default values.
|
150
|
+
# :aliases - Aliases for this option.
|
151
|
+
# :type - The type of the argument, can be :string, :hash, :array, :numeric or :boolean.
|
152
|
+
# :banner - String to show on usage notes.
|
153
|
+
# :hide - If you want to hide this option from the help.
|
154
|
+
def option(name, options = T.unsafe(nil)); end
|
155
|
+
|
156
|
+
# Declares the options for the next command to be declared.
|
157
|
+
#
|
158
|
+
# ==== Parameters
|
159
|
+
# Hash[Symbol => Object]:: The hash key is the name of the option and the value
|
160
|
+
# is the type of the option. Can be :string, :array, :hash, :boolean, :numeric
|
161
|
+
# or :required (string). If you give a value, the type of the value is used.
|
162
|
+
def options(options = T.unsafe(nil)); end
|
163
|
+
|
164
|
+
# Allows for custom "Command" package naming.
|
165
|
+
#
|
166
|
+
# === Parameters
|
167
|
+
# name<String>
|
168
|
+
# options<Hash>
|
169
|
+
def package_name(name, _ = T.unsafe(nil)); end
|
170
|
+
|
171
|
+
# Returns commands ready to be printed.
|
172
|
+
def printable_commands(all = T.unsafe(nil), subcommand = T.unsafe(nil)); end
|
173
|
+
|
174
|
+
# Returns commands ready to be printed.
|
175
|
+
def printable_tasks(all = T.unsafe(nil), subcommand = T.unsafe(nil)); end
|
176
|
+
|
177
|
+
# Registers another Thor subclass as a command.
|
178
|
+
#
|
179
|
+
# ==== Parameters
|
180
|
+
# klass<Class>:: Thor subclass to register
|
181
|
+
# command<String>:: Subcommand name to use
|
182
|
+
# usage<String>:: Short usage for the subcommand
|
183
|
+
# description<String>:: Description for the subcommand
|
184
|
+
def register(klass, subcommand_name, usage, description, options = T.unsafe(nil)); end
|
185
|
+
|
186
|
+
# Stop parsing of options as soon as an unknown option or a regular
|
187
|
+
# argument is encountered. All remaining arguments are passed to the command.
|
188
|
+
# This is useful if you have a command that can receive arbitrary additional
|
189
|
+
# options, and where those additional options should not be handled by
|
190
|
+
# Thor.
|
191
|
+
#
|
192
|
+
# ==== Example
|
193
|
+
#
|
194
|
+
# To better understand how this is useful, let's consider a command that calls
|
195
|
+
# an external command. A user may want to pass arbitrary options and
|
196
|
+
# arguments to that command. The command itself also accepts some options,
|
197
|
+
# which should be handled by Thor.
|
198
|
+
#
|
199
|
+
# class_option "verbose", :type => :boolean
|
200
|
+
# stop_on_unknown_option! :exec
|
201
|
+
# check_unknown_options! :except => :exec
|
202
|
+
#
|
203
|
+
# desc "exec", "Run a shell command"
|
204
|
+
# def exec(*args)
|
205
|
+
# puts "diagnostic output" if options[:verbose]
|
206
|
+
# Kernel.exec(*args)
|
207
|
+
# end
|
208
|
+
#
|
209
|
+
# Here +exec+ can be called with +--verbose+ to get diagnostic output,
|
210
|
+
# e.g.:
|
211
|
+
#
|
212
|
+
# $ thor exec --verbose echo foo
|
213
|
+
# diagnostic output
|
214
|
+
# foo
|
215
|
+
#
|
216
|
+
# But if +--verbose+ is given after +echo+, it is passed to +echo+ instead:
|
217
|
+
#
|
218
|
+
# $ thor exec echo --verbose foo
|
219
|
+
# --verbose foo
|
220
|
+
#
|
221
|
+
# ==== Parameters
|
222
|
+
# Symbol ...:: A list of commands that should be affected.
|
223
|
+
def stop_on_unknown_option!(*command_names); end
|
224
|
+
|
225
|
+
# @return [Boolean]
|
226
|
+
def stop_on_unknown_option?(command); end
|
227
|
+
|
228
|
+
def subcommand(subcommand, subcommand_class); end
|
229
|
+
def subcommand_classes; end
|
230
|
+
def subcommands; end
|
231
|
+
def subtask(subcommand, subcommand_class); end
|
232
|
+
def subtasks; end
|
233
|
+
|
234
|
+
# Prints help information for the given command.
|
235
|
+
#
|
236
|
+
# ==== Parameters
|
237
|
+
# shell<Thor::Shell>
|
238
|
+
# command_name<String>
|
239
|
+
def task_help(shell, command_name); end
|
240
|
+
|
241
|
+
protected
|
242
|
+
|
243
|
+
# The banner for this class. You can customize it if you are invoking the
|
244
|
+
# thor class by another ways which is not the Thor::Runner. It receives
|
245
|
+
# the command that is going to be invoked and a boolean which indicates if
|
246
|
+
# the namespace should be displayed as arguments.
|
247
|
+
def banner(command, namespace = T.unsafe(nil), subcommand = T.unsafe(nil)); end
|
248
|
+
|
249
|
+
def baseclass; end
|
250
|
+
def create_command(meth); end
|
251
|
+
def create_task(meth); end
|
252
|
+
|
253
|
+
# help command has the required check disabled by default.
|
254
|
+
def disable_required_check; end
|
255
|
+
|
256
|
+
# The method responsible for dispatching given the args.
|
257
|
+
#
|
258
|
+
# @yield [instance]
|
259
|
+
def dispatch(meth, given_args, given_opts, config); end
|
260
|
+
|
261
|
+
def dynamic_command_class; end
|
262
|
+
|
263
|
+
# this is the logic that takes the command name passed in by the user
|
264
|
+
# and determines whether it is an unambiguous substrings of a command or
|
265
|
+
# alias name.
|
266
|
+
def find_command_possibilities(meth); end
|
267
|
+
|
268
|
+
# this is the logic that takes the command name passed in by the user
|
269
|
+
# and determines whether it is an unambiguous substrings of a command or
|
270
|
+
# alias name.
|
271
|
+
def find_task_possibilities(meth); end
|
272
|
+
|
273
|
+
def initialize_added; end
|
274
|
+
|
275
|
+
# receives a (possibly nil) command name and returns a name that is in
|
276
|
+
# the commands hash. In addition to normalizing aliases, this logic
|
277
|
+
# will determine if a shortened command is an unambiguous substring of
|
278
|
+
# a command or alias.
|
279
|
+
#
|
280
|
+
# +normalize_command_name+ also converts names like +animal-prison+
|
281
|
+
# into +animal_prison+.
|
282
|
+
#
|
283
|
+
# @raise [AmbiguousTaskError]
|
284
|
+
def normalize_command_name(meth); end
|
285
|
+
|
286
|
+
# receives a (possibly nil) command name and returns a name that is in
|
287
|
+
# the commands hash. In addition to normalizing aliases, this logic
|
288
|
+
# will determine if a shortened command is an unambiguous substring of
|
289
|
+
# a command or alias.
|
290
|
+
#
|
291
|
+
# +normalize_command_name+ also converts names like +animal-prison+
|
292
|
+
# into +animal_prison+.
|
293
|
+
#
|
294
|
+
# @raise [AmbiguousTaskError]
|
295
|
+
def normalize_task_name(meth); end
|
296
|
+
|
297
|
+
# Retrieve the command name from given args.
|
298
|
+
def retrieve_command_name(args); end
|
299
|
+
|
300
|
+
# Retrieve the command name from given args.
|
301
|
+
def retrieve_task_name(args); end
|
302
|
+
|
303
|
+
def stop_on_unknown_option; end
|
304
|
+
def subcommand_help(cmd); end
|
305
|
+
def subtask_help(cmd); end
|
306
|
+
end
|
307
|
+
end
|
308
|
+
|
309
|
+
module Thor::Actions
|
310
|
+
mixes_in_class_methods ::Thor::Actions::ClassMethods
|
311
|
+
|
312
|
+
# Extends initializer to add more configuration options.
|
313
|
+
#
|
314
|
+
# ==== Configuration
|
315
|
+
# behavior<Symbol>:: The actions default behavior. Can be :invoke or :revoke.
|
316
|
+
# It also accepts :force, :skip and :pretend to set the behavior
|
317
|
+
# and the respective option.
|
318
|
+
#
|
319
|
+
# destination_root<String>:: The root directory needed for some actions.
|
320
|
+
def initialize(args = T.unsafe(nil), options = T.unsafe(nil), config = T.unsafe(nil)); end
|
321
|
+
|
322
|
+
# Wraps an action object and call it accordingly to the thor class behavior.
|
323
|
+
def action(instance); end
|
324
|
+
|
325
|
+
# Create a new file relative to the destination root with the given data,
|
326
|
+
# which is the return value of a block or a data string.
|
327
|
+
#
|
328
|
+
# ==== Parameters
|
329
|
+
# destination<String>:: the relative path to the destination root.
|
330
|
+
# data<String|NilClass>:: the data to append to the file.
|
331
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
332
|
+
#
|
333
|
+
# ==== Examples
|
334
|
+
#
|
335
|
+
# create_file "lib/fun_party.rb" do
|
336
|
+
# hostname = ask("What is the virtual hostname I should use?")
|
337
|
+
# "vhost.name = #{hostname}"
|
338
|
+
# end
|
339
|
+
#
|
340
|
+
# create_file "config/apache.conf", "your apache config"
|
341
|
+
def add_file(destination, *args, &block); end
|
342
|
+
|
343
|
+
# Create a new file relative to the destination root from the given source.
|
344
|
+
#
|
345
|
+
# ==== Parameters
|
346
|
+
# destination<String>:: the relative path to the destination root.
|
347
|
+
# source<String|NilClass>:: the relative path to the source root.
|
348
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
349
|
+
# :: give :symbolic => false for hard link.
|
350
|
+
#
|
351
|
+
# ==== Examples
|
352
|
+
#
|
353
|
+
# create_link "config/apache.conf", "/etc/apache.conf"
|
354
|
+
def add_link(destination, *args); end
|
355
|
+
|
356
|
+
# Append text to a file. Since it depends on insert_into_file, it's reversible.
|
357
|
+
#
|
358
|
+
# ==== Parameters
|
359
|
+
# path<String>:: path of the file to be changed
|
360
|
+
# data<String>:: the data to append to the file, can be also given as a block.
|
361
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
362
|
+
#
|
363
|
+
# ==== Example
|
364
|
+
#
|
365
|
+
# append_to_file 'config/environments/test.rb', 'config.gem "rspec"'
|
366
|
+
#
|
367
|
+
# append_to_file 'config/environments/test.rb' do
|
368
|
+
# 'config.gem "rspec"'
|
369
|
+
# end
|
370
|
+
def append_file(path, *args, &block); end
|
371
|
+
|
372
|
+
# Append text to a file. Since it depends on insert_into_file, it's reversible.
|
373
|
+
#
|
374
|
+
# ==== Parameters
|
375
|
+
# path<String>:: path of the file to be changed
|
376
|
+
# data<String>:: the data to append to the file, can be also given as a block.
|
377
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
378
|
+
#
|
379
|
+
# ==== Example
|
380
|
+
#
|
381
|
+
# append_to_file 'config/environments/test.rb', 'config.gem "rspec"'
|
382
|
+
#
|
383
|
+
# append_to_file 'config/environments/test.rb' do
|
384
|
+
# 'config.gem "rspec"'
|
385
|
+
# end
|
386
|
+
def append_to_file(path, *args, &block); end
|
387
|
+
|
388
|
+
# Loads an external file and execute it in the instance binding.
|
389
|
+
#
|
390
|
+
# ==== Parameters
|
391
|
+
# path<String>:: The path to the file to execute. Can be a web address or
|
392
|
+
# a relative path from the source root.
|
393
|
+
#
|
394
|
+
# ==== Examples
|
395
|
+
#
|
396
|
+
# apply "http://gist.github.com/103208"
|
397
|
+
#
|
398
|
+
# apply "recipes/jquery.rb"
|
399
|
+
def apply(path, config = T.unsafe(nil)); end
|
400
|
+
|
401
|
+
# Returns the value of attribute behavior.
|
402
|
+
def behavior; end
|
403
|
+
|
404
|
+
# Sets the attribute behavior
|
405
|
+
#
|
406
|
+
# @param value the value to set the attribute behavior to.
|
407
|
+
def behavior=(_arg0); end
|
408
|
+
|
409
|
+
# Changes the mode of the given file or directory.
|
410
|
+
#
|
411
|
+
# ==== Parameters
|
412
|
+
# mode<Integer>:: the file mode
|
413
|
+
# path<String>:: the name of the file to change mode
|
414
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
415
|
+
#
|
416
|
+
# ==== Example
|
417
|
+
#
|
418
|
+
# chmod "script/server", 0755
|
419
|
+
def chmod(path, mode, config = T.unsafe(nil)); end
|
420
|
+
|
421
|
+
# Comment all lines matching a given regex. It will leave the space
|
422
|
+
# which existed before the beginning of the line in tact and will insert
|
423
|
+
# a single space after the comment hash.
|
424
|
+
#
|
425
|
+
# ==== Parameters
|
426
|
+
# path<String>:: path of the file to be changed
|
427
|
+
# flag<Regexp|String>:: the regexp or string used to decide which lines to comment
|
428
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
429
|
+
#
|
430
|
+
# ==== Example
|
431
|
+
#
|
432
|
+
# comment_lines 'config/initializers/session_store.rb', /cookie_store/
|
433
|
+
def comment_lines(path, flag, *args); end
|
434
|
+
|
435
|
+
# ==== Examples
|
436
|
+
#
|
437
|
+
# copy_file "README", "doc/README"
|
438
|
+
#
|
439
|
+
# copy_file "doc/README"
|
440
|
+
def copy_file(source, *args, &block); end
|
441
|
+
|
442
|
+
# Create a new file relative to the destination root with the given data,
|
443
|
+
# which is the return value of a block or a data string.
|
444
|
+
#
|
445
|
+
# ==== Parameters
|
446
|
+
# destination<String>:: the relative path to the destination root.
|
447
|
+
# data<String|NilClass>:: the data to append to the file.
|
448
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
449
|
+
#
|
450
|
+
# ==== Examples
|
451
|
+
#
|
452
|
+
# create_file "lib/fun_party.rb" do
|
453
|
+
# hostname = ask("What is the virtual hostname I should use?")
|
454
|
+
# "vhost.name = #{hostname}"
|
455
|
+
# end
|
456
|
+
#
|
457
|
+
# create_file "config/apache.conf", "your apache config"
|
458
|
+
def create_file(destination, *args, &block); end
|
459
|
+
|
460
|
+
# Create a new file relative to the destination root from the given source.
|
461
|
+
#
|
462
|
+
# ==== Parameters
|
463
|
+
# destination<String>:: the relative path to the destination root.
|
464
|
+
# source<String|NilClass>:: the relative path to the source root.
|
465
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
466
|
+
# :: give :symbolic => false for hard link.
|
467
|
+
#
|
468
|
+
# ==== Examples
|
469
|
+
#
|
470
|
+
# create_link "config/apache.conf", "/etc/apache.conf"
|
471
|
+
def create_link(destination, *args); end
|
472
|
+
|
473
|
+
# Returns the root for this thor class (also aliased as destination root).
|
474
|
+
def destination_root; end
|
475
|
+
|
476
|
+
# Sets the root for this thor class. Relatives path are added to the
|
477
|
+
# directory where the script was invoked and expanded.
|
478
|
+
def destination_root=(root); end
|
479
|
+
|
480
|
+
# Copies recursively the files from source directory to root directory.
|
481
|
+
# If any of the files finishes with .tt, it's considered to be a template
|
482
|
+
# and is placed in the destination without the extension .tt. If any
|
483
|
+
# empty directory is found, it's copied and all .empty_directory files are
|
484
|
+
# ignored. If any file name is wrapped within % signs, the text within
|
485
|
+
# the % signs will be executed as a method and replaced with the returned
|
486
|
+
# value. Let's suppose a doc directory with the following files:
|
487
|
+
#
|
488
|
+
# doc/
|
489
|
+
# components/.empty_directory
|
490
|
+
# README
|
491
|
+
# rdoc.rb.tt
|
492
|
+
# %app_name%.rb
|
493
|
+
#
|
494
|
+
# When invoked as:
|
495
|
+
#
|
496
|
+
# directory "doc"
|
497
|
+
#
|
498
|
+
# It will create a doc directory in the destination with the following
|
499
|
+
# files (assuming that the `app_name` method returns the value "blog"):
|
500
|
+
#
|
501
|
+
# doc/
|
502
|
+
# components/
|
503
|
+
# README
|
504
|
+
# rdoc.rb
|
505
|
+
# blog.rb
|
506
|
+
#
|
507
|
+
# <b>Encoded path note:</b> Since Thor internals use Object#respond_to? to check if it can
|
508
|
+
# expand %something%, this `something` should be a public method in the class calling
|
509
|
+
# #directory. If a method is private, Thor stack raises PrivateMethodEncodedError.
|
510
|
+
#
|
511
|
+
# ==== Parameters
|
512
|
+
# source<String>:: the relative path to the source root.
|
513
|
+
# destination<String>:: the relative path to the destination root.
|
514
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
515
|
+
# If :recursive => false, does not look for paths recursively.
|
516
|
+
# If :mode => :preserve, preserve the file mode from the source.
|
517
|
+
# If :exclude_pattern => /regexp/, prevents copying files that match that regexp.
|
518
|
+
#
|
519
|
+
# ==== Examples
|
520
|
+
#
|
521
|
+
# directory "doc"
|
522
|
+
# directory "doc", "docs", :recursive => false
|
523
|
+
def directory(source, *args, &block); end
|
524
|
+
|
525
|
+
# Creates an empty directory.
|
526
|
+
#
|
527
|
+
# ==== Parameters
|
528
|
+
# destination<String>:: the relative path to the destination root.
|
529
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
530
|
+
#
|
531
|
+
# ==== Examples
|
532
|
+
#
|
533
|
+
# empty_directory "doc"
|
534
|
+
def empty_directory(destination, config = T.unsafe(nil)); end
|
535
|
+
|
536
|
+
# Receives a file or directory and search for it in the source paths.
|
537
|
+
#
|
538
|
+
# @raise [Error]
|
539
|
+
def find_in_source_paths(file); end
|
540
|
+
|
541
|
+
# Gets the content at the given address and places it at the given relative
|
542
|
+
# destination. If a block is given instead of destination, the content of
|
543
|
+
# the url is yielded and used as location.
|
544
|
+
#
|
545
|
+
# +get+ relies on open-uri, so passing application user input would provide
|
546
|
+
# a command injection attack vector.
|
547
|
+
#
|
548
|
+
# ==== Parameters
|
549
|
+
# source<String>:: the address of the given content.
|
550
|
+
# destination<String>:: the relative path to the destination root.
|
551
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
552
|
+
#
|
553
|
+
# ==== Examples
|
554
|
+
#
|
555
|
+
# get "http://gist.github.com/103208", "doc/README"
|
556
|
+
#
|
557
|
+
# get "http://gist.github.com/103208" do |content|
|
558
|
+
# content.split("\n").first
|
559
|
+
# end
|
560
|
+
def get(source, *args, &block); end
|
561
|
+
|
562
|
+
# Run a regular expression replacement on a file.
|
563
|
+
#
|
564
|
+
# ==== Parameters
|
565
|
+
# path<String>:: path of the file to be changed
|
566
|
+
# flag<Regexp|String>:: the regexp or string to be replaced
|
567
|
+
# replacement<String>:: the replacement, can be also given as a block
|
568
|
+
# config<Hash>:: give :verbose => false to not log the status, and
|
569
|
+
# :force => true, to force the replacement regardles of runner behavior.
|
570
|
+
#
|
571
|
+
# ==== Example
|
572
|
+
#
|
573
|
+
# gsub_file 'app/controllers/application_controller.rb', /#\s*(filter_parameter_logging :password)/, '\1'
|
574
|
+
#
|
575
|
+
# gsub_file 'README', /rake/, :green do |match|
|
576
|
+
# match << " no more. Use thor!"
|
577
|
+
# end
|
578
|
+
def gsub_file(path, flag, *args, &block); end
|
579
|
+
|
580
|
+
# Goes to the root and execute the given block.
|
581
|
+
def in_root; end
|
582
|
+
|
583
|
+
# Injects text right after the class definition. Since it depends on
|
584
|
+
# insert_into_file, it's reversible.
|
585
|
+
#
|
586
|
+
# ==== Parameters
|
587
|
+
# path<String>:: path of the file to be changed
|
588
|
+
# klass<String|Class>:: the class to be manipulated
|
589
|
+
# data<String>:: the data to append to the class, can be also given as a block.
|
590
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
591
|
+
#
|
592
|
+
# ==== Examples
|
593
|
+
#
|
594
|
+
# inject_into_class "app/controllers/application_controller.rb", "ApplicationController", " filter_parameter :password\n"
|
595
|
+
#
|
596
|
+
# inject_into_class "app/controllers/application_controller.rb", "ApplicationController" do
|
597
|
+
# " filter_parameter :password\n"
|
598
|
+
# end
|
599
|
+
def inject_into_class(path, klass, *args, &block); end
|
600
|
+
|
601
|
+
def inject_into_file(destination, *args, &block); end
|
602
|
+
|
603
|
+
# Injects text right after the module definition. Since it depends on
|
604
|
+
# insert_into_file, it's reversible.
|
605
|
+
#
|
606
|
+
# ==== Parameters
|
607
|
+
# path<String>:: path of the file to be changed
|
608
|
+
# module_name<String|Class>:: the module to be manipulated
|
609
|
+
# data<String>:: the data to append to the class, can be also given as a block.
|
610
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
611
|
+
#
|
612
|
+
# ==== Examples
|
613
|
+
#
|
614
|
+
# inject_into_module "app/helpers/application_helper.rb", "ApplicationHelper", " def help; 'help'; end\n"
|
615
|
+
#
|
616
|
+
# inject_into_module "app/helpers/application_helper.rb", "ApplicationHelper" do
|
617
|
+
# " def help; 'help'; end\n"
|
618
|
+
# end
|
619
|
+
def inject_into_module(path, module_name, *args, &block); end
|
620
|
+
|
621
|
+
def insert_into_file(destination, *args, &block); end
|
622
|
+
|
623
|
+
# Do something in the root or on a provided subfolder. If a relative path
|
624
|
+
# is given it's referenced from the current root. The full path is yielded
|
625
|
+
# to the block you provide. The path is set back to the previous path when
|
626
|
+
# the method exits.
|
627
|
+
#
|
628
|
+
# Returns the value yielded by the block.
|
629
|
+
#
|
630
|
+
# ==== Parameters
|
631
|
+
# dir<String>:: the directory to move to.
|
632
|
+
# config<Hash>:: give :verbose => true to log and use padding.
|
633
|
+
def inside(dir = T.unsafe(nil), config = T.unsafe(nil), &block); end
|
634
|
+
|
635
|
+
# Links the file from the relative source to the relative destination. If
|
636
|
+
# the destination is not given it's assumed to be equal to the source.
|
637
|
+
#
|
638
|
+
# ==== Parameters
|
639
|
+
# source<String>:: the relative path to the source root.
|
640
|
+
# destination<String>:: the relative path to the destination root.
|
641
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
642
|
+
#
|
643
|
+
# ==== Examples
|
644
|
+
#
|
645
|
+
# link_file "README", "doc/README"
|
646
|
+
#
|
647
|
+
# link_file "doc/README"
|
648
|
+
def link_file(source, *args); end
|
649
|
+
|
650
|
+
# Prepend text to a file. Since it depends on insert_into_file, it's reversible.
|
651
|
+
#
|
652
|
+
# ==== Parameters
|
653
|
+
# path<String>:: path of the file to be changed
|
654
|
+
# data<String>:: the data to prepend to the file, can be also given as a block.
|
655
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
656
|
+
#
|
657
|
+
# ==== Example
|
658
|
+
#
|
659
|
+
# prepend_to_file 'config/environments/test.rb', 'config.gem "rspec"'
|
660
|
+
#
|
661
|
+
# prepend_to_file 'config/environments/test.rb' do
|
662
|
+
# 'config.gem "rspec"'
|
663
|
+
# end
|
664
|
+
def prepend_file(path, *args, &block); end
|
665
|
+
|
666
|
+
# Prepend text to a file. Since it depends on insert_into_file, it's reversible.
|
667
|
+
#
|
668
|
+
# ==== Parameters
|
669
|
+
# path<String>:: path of the file to be changed
|
670
|
+
# data<String>:: the data to prepend to the file, can be also given as a block.
|
671
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
672
|
+
#
|
673
|
+
# ==== Example
|
674
|
+
#
|
675
|
+
# prepend_to_file 'config/environments/test.rb', 'config.gem "rspec"'
|
676
|
+
#
|
677
|
+
# prepend_to_file 'config/environments/test.rb' do
|
678
|
+
# 'config.gem "rspec"'
|
679
|
+
# end
|
680
|
+
def prepend_to_file(path, *args, &block); end
|
681
|
+
|
682
|
+
# Returns the given path relative to the absolute root (ie, root where
|
683
|
+
# the script started).
|
684
|
+
def relative_to_original_destination_root(path, remove_dot = T.unsafe(nil)); end
|
685
|
+
|
686
|
+
# Removes a file at the given location.
|
687
|
+
#
|
688
|
+
# ==== Parameters
|
689
|
+
# path<String>:: path of the file to be changed
|
690
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
691
|
+
#
|
692
|
+
# ==== Example
|
693
|
+
#
|
694
|
+
# remove_file 'README'
|
695
|
+
# remove_file 'app/controllers/application_controller.rb'
|
696
|
+
def remove_dir(path, config = T.unsafe(nil)); end
|
697
|
+
|
698
|
+
# Removes a file at the given location.
|
699
|
+
#
|
700
|
+
# ==== Parameters
|
701
|
+
# path<String>:: path of the file to be changed
|
702
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
703
|
+
#
|
704
|
+
# ==== Example
|
705
|
+
#
|
706
|
+
# remove_file 'README'
|
707
|
+
# remove_file 'app/controllers/application_controller.rb'
|
708
|
+
def remove_file(path, config = T.unsafe(nil)); end
|
709
|
+
|
710
|
+
# Executes a command returning the contents of the command.
|
711
|
+
#
|
712
|
+
# ==== Parameters
|
713
|
+
# command<String>:: the command to be executed.
|
714
|
+
# config<Hash>:: give :verbose => false to not log the status, :capture => true to hide to output. Specify :with
|
715
|
+
# to append an executable to command execution.
|
716
|
+
#
|
717
|
+
# ==== Example
|
718
|
+
#
|
719
|
+
# inside('vendor') do
|
720
|
+
# run('ln -s ~/edge rails')
|
721
|
+
# end
|
722
|
+
def run(command, config = T.unsafe(nil)); end
|
723
|
+
|
724
|
+
# Executes a ruby script (taking into account WIN32 platform quirks).
|
725
|
+
#
|
726
|
+
# ==== Parameters
|
727
|
+
# command<String>:: the command to be executed.
|
728
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
729
|
+
def run_ruby_script(command, config = T.unsafe(nil)); end
|
730
|
+
|
731
|
+
# Holds source paths in instance so they can be manipulated.
|
732
|
+
def source_paths; end
|
733
|
+
|
734
|
+
# Gets an ERB template at the relative source, executes it and makes a copy
|
735
|
+
# at the relative destination. If the destination is not given it's assumed
|
736
|
+
# to be equal to the source removing .tt from the filename.
|
737
|
+
#
|
738
|
+
# ==== Parameters
|
739
|
+
# source<String>:: the relative path to the source root.
|
740
|
+
# destination<String>:: the relative path to the destination root.
|
741
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
742
|
+
#
|
743
|
+
# ==== Examples
|
744
|
+
#
|
745
|
+
# template "README", "doc/README"
|
746
|
+
#
|
747
|
+
# template "doc/README"
|
748
|
+
def template(source, *args, &block); end
|
749
|
+
|
750
|
+
# Run a thor command. A hash of options can be given and it's converted to
|
751
|
+
# switches.
|
752
|
+
#
|
753
|
+
# ==== Parameters
|
754
|
+
# command<String>:: the command to be invoked
|
755
|
+
# args<Array>:: arguments to the command
|
756
|
+
# config<Hash>:: give :verbose => false to not log the status, :capture => true to hide to output.
|
757
|
+
# Other options are given as parameter to Thor.
|
758
|
+
#
|
759
|
+
#
|
760
|
+
# ==== Examples
|
761
|
+
#
|
762
|
+
# thor :install, "http://gist.github.com/103208"
|
763
|
+
# #=> thor install http://gist.github.com/103208
|
764
|
+
#
|
765
|
+
# thor :list, :all => true, :substring => 'rails'
|
766
|
+
# #=> thor list --all --substring=rails
|
767
|
+
def thor(command, *args); end
|
768
|
+
|
769
|
+
# Uncomment all lines matching a given regex. It will leave the space
|
770
|
+
# which existed before the comment hash in tact but will remove any spacing
|
771
|
+
# between the comment hash and the beginning of the line.
|
772
|
+
#
|
773
|
+
# ==== Parameters
|
774
|
+
# path<String>:: path of the file to be changed
|
775
|
+
# flag<Regexp|String>:: the regexp or string used to decide which lines to uncomment
|
776
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
777
|
+
#
|
778
|
+
# ==== Example
|
779
|
+
#
|
780
|
+
# uncomment_lines 'config/initializers/session_store.rb', /active_record/
|
781
|
+
def uncomment_lines(path, flag, *args); end
|
782
|
+
|
783
|
+
protected
|
784
|
+
|
785
|
+
def _cleanup_options_and_set(options, key); end
|
786
|
+
|
787
|
+
# Allow current root to be shared between invocations.
|
788
|
+
def _shared_configuration; end
|
789
|
+
|
790
|
+
private
|
791
|
+
|
792
|
+
def capture(*args); end
|
793
|
+
def concat(string); end
|
794
|
+
|
795
|
+
# Returns the value of attribute output_buffer.
|
796
|
+
def output_buffer; end
|
797
|
+
|
798
|
+
# Sets the attribute output_buffer
|
799
|
+
#
|
800
|
+
# @param value the value to set the attribute output_buffer to.
|
801
|
+
def output_buffer=(_arg0); end
|
802
|
+
|
803
|
+
def with_output_buffer(buf = T.unsafe(nil)); end
|
804
|
+
|
805
|
+
class << self
|
806
|
+
def included(base); end
|
807
|
+
end
|
808
|
+
end
|
809
|
+
|
810
|
+
# Thor::Actions#capture depends on what kind of buffer is used in ERB.
|
811
|
+
# Thus CapturableERB fixes ERB to use String buffer.
|
812
|
+
class Thor::Actions::CapturableERB < ::ERB
|
813
|
+
def set_eoutvar(compiler, eoutvar = T.unsafe(nil)); end
|
814
|
+
end
|
815
|
+
|
816
|
+
module Thor::Actions::ClassMethods
|
817
|
+
# Add runtime options that help actions execution.
|
818
|
+
def add_runtime_options!; end
|
819
|
+
|
820
|
+
# Hold source paths for one Thor instance. source_paths_for_search is the
|
821
|
+
# method responsible to gather source_paths from this current class,
|
822
|
+
# inherited paths and the source root.
|
823
|
+
def source_paths; end
|
824
|
+
|
825
|
+
# Returns the source paths in the following order:
|
826
|
+
#
|
827
|
+
# 1) This class source paths
|
828
|
+
# 2) Source root
|
829
|
+
# 3) Parents source paths
|
830
|
+
def source_paths_for_search; end
|
831
|
+
|
832
|
+
# Stores and return the source root for this class
|
833
|
+
def source_root(path = T.unsafe(nil)); end
|
834
|
+
end
|
835
|
+
|
836
|
+
# CreateFile is a subset of Template, which instead of rendering a file with
|
837
|
+
# ERB, it gets the content from the user.
|
838
|
+
class Thor::Actions::CreateFile < ::Thor::Actions::EmptyDirectory
|
839
|
+
# @return [CreateFile] a new instance of CreateFile
|
840
|
+
def initialize(base, destination, data, config = T.unsafe(nil)); end
|
841
|
+
|
842
|
+
def data; end
|
843
|
+
|
844
|
+
# Checks if the content of the file at the destination is identical to the rendered result.
|
845
|
+
#
|
846
|
+
# ==== Returns
|
847
|
+
# Boolean:: true if it is identical, false otherwise.
|
848
|
+
#
|
849
|
+
# @return [Boolean]
|
850
|
+
def identical?; end
|
851
|
+
|
852
|
+
def invoke!; end
|
853
|
+
|
854
|
+
# Holds the content to be added to the file.
|
855
|
+
def render; end
|
856
|
+
|
857
|
+
protected
|
858
|
+
|
859
|
+
# Shows the file collision menu to the user and gets the result.
|
860
|
+
#
|
861
|
+
# @return [Boolean]
|
862
|
+
def force_on_collision?; end
|
863
|
+
|
864
|
+
# If force is true, run the action, otherwise check if it's not being
|
865
|
+
# skipped. If both are false, show the file_collision menu, if the menu
|
866
|
+
# returns true, force it, otherwise skip.
|
867
|
+
def force_or_skip_or_conflict(force, skip, &block); end
|
868
|
+
|
869
|
+
# Now on conflict we check if the file is identical or not.
|
870
|
+
def on_conflict_behavior(&block); end
|
871
|
+
end
|
872
|
+
|
873
|
+
# CreateLink is a subset of CreateFile, which instead of taking a block of
|
874
|
+
# data, just takes a source string from the user.
|
875
|
+
class Thor::Actions::CreateLink < ::Thor::Actions::CreateFile
|
876
|
+
def data; end
|
877
|
+
|
878
|
+
# @return [Boolean]
|
879
|
+
def exists?; end
|
880
|
+
|
881
|
+
# Checks if the content of the file at the destination is identical to the rendered result.
|
882
|
+
#
|
883
|
+
# ==== Returns
|
884
|
+
# Boolean:: true if it is identical, false otherwise.
|
885
|
+
#
|
886
|
+
# @return [Boolean]
|
887
|
+
def identical?; end
|
888
|
+
|
889
|
+
def invoke!; end
|
890
|
+
end
|
891
|
+
|
892
|
+
class Thor::Actions::Directory < ::Thor::Actions::EmptyDirectory
|
893
|
+
# @return [Directory] a new instance of Directory
|
894
|
+
def initialize(base, source, destination = T.unsafe(nil), config = T.unsafe(nil), &block); end
|
895
|
+
|
896
|
+
def invoke!; end
|
897
|
+
def revoke!; end
|
898
|
+
|
899
|
+
# Returns the value of attribute source.
|
900
|
+
def source; end
|
901
|
+
|
902
|
+
protected
|
903
|
+
|
904
|
+
def execute!; end
|
905
|
+
def file_level_lookup(previous_lookup); end
|
906
|
+
def files(lookup); end
|
907
|
+
end
|
908
|
+
|
909
|
+
class Thor::Actions::EmptyDirectory
|
910
|
+
# Initializes given the source and destination.
|
911
|
+
#
|
912
|
+
# ==== Parameters
|
913
|
+
# base<Thor::Base>:: A Thor::Base instance
|
914
|
+
# source<String>:: Relative path to the source of this file
|
915
|
+
# destination<String>:: Relative path to the destination of this file
|
916
|
+
# config<Hash>:: give :verbose => false to not log the status.
|
917
|
+
#
|
918
|
+
# @return [EmptyDirectory] a new instance of EmptyDirectory
|
919
|
+
def initialize(base, destination, config = T.unsafe(nil)); end
|
920
|
+
|
921
|
+
def base; end
|
922
|
+
def config; end
|
923
|
+
def destination; end
|
924
|
+
|
925
|
+
# Checks if the destination file already exists.
|
926
|
+
#
|
927
|
+
# ==== Returns
|
928
|
+
# Boolean:: true if the file exists, false otherwise.
|
929
|
+
#
|
930
|
+
# @return [Boolean]
|
931
|
+
def exists?; end
|
932
|
+
|
933
|
+
def given_destination; end
|
934
|
+
def invoke!; end
|
935
|
+
def relative_destination; end
|
936
|
+
def revoke!; end
|
937
|
+
|
938
|
+
protected
|
939
|
+
|
940
|
+
# Filenames in the encoded form are converted. If you have a file:
|
941
|
+
#
|
942
|
+
# %file_name%.rb
|
943
|
+
#
|
944
|
+
# It calls #file_name from the base and replaces %-string with the
|
945
|
+
# return value (should be String) of #file_name:
|
946
|
+
#
|
947
|
+
# user.rb
|
948
|
+
#
|
949
|
+
# The method referenced can be either public or private.
|
950
|
+
def convert_encoded_instructions(filename); end
|
951
|
+
|
952
|
+
# Sets the absolute destination value from a relative destination value.
|
953
|
+
# It also stores the given and relative destination. Let's suppose our
|
954
|
+
# script is being executed on "dest", it sets the destination root to
|
955
|
+
# "dest". The destination, given_destination and relative_destination
|
956
|
+
# are related in the following way:
|
957
|
+
#
|
958
|
+
# inside "bar" do
|
959
|
+
# empty_directory "baz"
|
960
|
+
# end
|
961
|
+
#
|
962
|
+
# destination #=> dest/bar/baz
|
963
|
+
# relative_destination #=> bar/baz
|
964
|
+
# given_destination #=> baz
|
965
|
+
def destination=(destination); end
|
966
|
+
|
967
|
+
# Receives a hash of options and just execute the block if some
|
968
|
+
# conditions are met.
|
969
|
+
def invoke_with_conflict_check(&block); end
|
970
|
+
|
971
|
+
# What to do when the destination file already exists.
|
972
|
+
def on_conflict_behavior; end
|
973
|
+
|
974
|
+
def on_file_clash_behavior; end
|
975
|
+
|
976
|
+
# Shortcut for pretend.
|
977
|
+
#
|
978
|
+
# @return [Boolean]
|
979
|
+
def pretend?; end
|
980
|
+
|
981
|
+
# Shortcut to say_status shell method.
|
982
|
+
def say_status(status, color); end
|
983
|
+
end
|
984
|
+
|
985
|
+
class Thor::Actions::InjectIntoFile < ::Thor::Actions::EmptyDirectory
|
986
|
+
# @return [InjectIntoFile] a new instance of InjectIntoFile
|
987
|
+
def initialize(base, destination, data, config); end
|
988
|
+
|
989
|
+
# Returns the value of attribute behavior.
|
990
|
+
def behavior; end
|
991
|
+
|
992
|
+
# Returns the value of attribute flag.
|
993
|
+
def flag; end
|
994
|
+
|
995
|
+
def invoke!; end
|
996
|
+
|
997
|
+
# Returns the value of attribute replacement.
|
998
|
+
def replacement; end
|
999
|
+
|
1000
|
+
def revoke!; end
|
1001
|
+
|
1002
|
+
protected
|
1003
|
+
|
1004
|
+
# Adds the content to the file.
|
1005
|
+
def replace!(regexp, string, force); end
|
1006
|
+
|
1007
|
+
def say_status(behavior, warning: T.unsafe(nil), color: T.unsafe(nil)); end
|
1008
|
+
end
|
1009
|
+
|
1010
|
+
# Injects the given content into a file. Different from gsub_file, this
|
1011
|
+
# method is reversible.
|
1012
|
+
#
|
1013
|
+
# ==== Parameters
|
1014
|
+
# destination<String>:: Relative path to the destination root
|
1015
|
+
# data<String>:: Data to add to the file. Can be given as a block.
|
1016
|
+
# config<Hash>:: give :verbose => false to not log the status and the flag
|
1017
|
+
# for injection (:after or :before) or :force => true for
|
1018
|
+
# insert two or more times the same content.
|
1019
|
+
#
|
1020
|
+
# ==== Examples
|
1021
|
+
#
|
1022
|
+
# insert_into_file "config/environment.rb", "config.gem :thor", :after => "Rails::Initializer.run do |config|\n"
|
1023
|
+
#
|
1024
|
+
# insert_into_file "config/environment.rb", :after => "Rails::Initializer.run do |config|\n" do
|
1025
|
+
# gems = ask "Which gems would you like to add?"
|
1026
|
+
# gems.split(" ").map{ |gem| " config.gem :#{gem}" }.join("\n")
|
1027
|
+
# end
|
1028
|
+
Thor::Actions::WARNINGS = T.let(T.unsafe(nil), Hash)
|
1029
|
+
|
1030
|
+
class Thor::AmbiguousCommandError < ::Thor::Error; end
|
1031
|
+
Thor::AmbiguousTaskError = Thor::AmbiguousCommandError
|
1032
|
+
|
1033
|
+
class Thor::Argument
|
1034
|
+
# @raise [ArgumentError]
|
1035
|
+
# @return [Argument] a new instance of Argument
|
1036
|
+
def initialize(name, options = T.unsafe(nil)); end
|
1037
|
+
|
1038
|
+
# Returns the value of attribute banner.
|
1039
|
+
def banner; end
|
1040
|
+
|
1041
|
+
# Returns the value of attribute default.
|
1042
|
+
def default; end
|
1043
|
+
|
1044
|
+
# Returns the value of attribute description.
|
1045
|
+
def description; end
|
1046
|
+
|
1047
|
+
# Returns the value of attribute enum.
|
1048
|
+
def enum; end
|
1049
|
+
|
1050
|
+
# Returns the value of attribute name.
|
1051
|
+
def human_name; end
|
1052
|
+
|
1053
|
+
# Returns the value of attribute name.
|
1054
|
+
def name; end
|
1055
|
+
|
1056
|
+
# Returns the value of attribute required.
|
1057
|
+
def required; end
|
1058
|
+
|
1059
|
+
# @return [Boolean]
|
1060
|
+
def required?; end
|
1061
|
+
|
1062
|
+
# @return [Boolean]
|
1063
|
+
def show_default?; end
|
1064
|
+
|
1065
|
+
# Returns the value of attribute type.
|
1066
|
+
def type; end
|
1067
|
+
|
1068
|
+
def usage; end
|
1069
|
+
|
1070
|
+
protected
|
1071
|
+
|
1072
|
+
def default_banner; end
|
1073
|
+
|
1074
|
+
# @return [Boolean]
|
1075
|
+
def valid_type?(type); end
|
1076
|
+
|
1077
|
+
# @raise [ArgumentError]
|
1078
|
+
def validate!; end
|
1079
|
+
end
|
1080
|
+
|
1081
|
+
Thor::Argument::VALID_TYPES = T.let(T.unsafe(nil), Array)
|
1082
|
+
|
1083
|
+
class Thor::Arguments
|
1084
|
+
# Takes an array of Thor::Argument objects.
|
1085
|
+
#
|
1086
|
+
# @return [Arguments] a new instance of Arguments
|
1087
|
+
def initialize(arguments = T.unsafe(nil)); end
|
1088
|
+
|
1089
|
+
def parse(args); end
|
1090
|
+
def remaining; end
|
1091
|
+
|
1092
|
+
private
|
1093
|
+
|
1094
|
+
# Raises an error if @non_assigned_required array is not empty.
|
1095
|
+
#
|
1096
|
+
# @raise [RequiredArgumentMissingError]
|
1097
|
+
def check_requirement!; end
|
1098
|
+
|
1099
|
+
# @return [Boolean]
|
1100
|
+
def current_is_value?; end
|
1101
|
+
|
1102
|
+
# @return [Boolean]
|
1103
|
+
def last?; end
|
1104
|
+
|
1105
|
+
# @return [Boolean]
|
1106
|
+
def no_or_skip?(arg); end
|
1107
|
+
|
1108
|
+
# Runs through the argument array getting all strings until no string is
|
1109
|
+
# found or a switch is found.
|
1110
|
+
#
|
1111
|
+
# ["a", "b", "c"]
|
1112
|
+
#
|
1113
|
+
# And returns it as an array:
|
1114
|
+
#
|
1115
|
+
# ["a", "b", "c"]
|
1116
|
+
def parse_array(name); end
|
1117
|
+
|
1118
|
+
# Runs through the argument array getting strings that contains ":" and
|
1119
|
+
# mark it as a hash:
|
1120
|
+
#
|
1121
|
+
# [ "name:string", "age:integer" ]
|
1122
|
+
#
|
1123
|
+
# Becomes:
|
1124
|
+
#
|
1125
|
+
# { "name" => "string", "age" => "integer" }
|
1126
|
+
def parse_hash(name); end
|
1127
|
+
|
1128
|
+
# Check if the peek is numeric format and return a Float or Integer.
|
1129
|
+
# Check if the peek is included in enum if enum is provided.
|
1130
|
+
# Otherwise raises an error.
|
1131
|
+
def parse_numeric(name); end
|
1132
|
+
|
1133
|
+
# Parse string:
|
1134
|
+
# for --string-arg, just return the current value in the pile
|
1135
|
+
# for --no-string-arg, nil
|
1136
|
+
# Check if the peek is included in enum if enum is provided. Otherwise raises an error.
|
1137
|
+
def parse_string(name); end
|
1138
|
+
|
1139
|
+
def peek; end
|
1140
|
+
def shift; end
|
1141
|
+
def unshift(arg); end
|
1142
|
+
|
1143
|
+
class << self
|
1144
|
+
def parse(*args); end
|
1145
|
+
|
1146
|
+
# Receives an array of args and returns two arrays, one with arguments
|
1147
|
+
# and one with switches.
|
1148
|
+
def split(args); end
|
1149
|
+
end
|
1150
|
+
end
|
1151
|
+
|
1152
|
+
Thor::Arguments::NUMERIC = T.let(T.unsafe(nil), Regexp)
|
1153
|
+
|
1154
|
+
module Thor::Base
|
1155
|
+
include ::Thor::Invocation
|
1156
|
+
include ::Thor::Shell
|
1157
|
+
|
1158
|
+
mixes_in_class_methods ::Thor::Base::ClassMethods
|
1159
|
+
mixes_in_class_methods ::Thor::Invocation::ClassMethods
|
1160
|
+
|
1161
|
+
# It receives arguments in an Array and two hashes, one for options and
|
1162
|
+
# other for configuration.
|
1163
|
+
#
|
1164
|
+
# Notice that it does not check if all required arguments were supplied.
|
1165
|
+
# It should be done by the parser.
|
1166
|
+
#
|
1167
|
+
# ==== Parameters
|
1168
|
+
# args<Array[Object]>:: An array of objects. The objects are applied to their
|
1169
|
+
# respective accessors declared with <tt>argument</tt>.
|
1170
|
+
#
|
1171
|
+
# options<Hash>:: An options hash that will be available as self.options.
|
1172
|
+
# The hash given is converted to a hash with indifferent
|
1173
|
+
# access, magic predicates (options.skip?) and then frozen.
|
1174
|
+
#
|
1175
|
+
# config<Hash>:: Configuration for this Thor class.
|
1176
|
+
def initialize(args = T.unsafe(nil), local_options = T.unsafe(nil), config = T.unsafe(nil)); end
|
1177
|
+
|
1178
|
+
# Returns the value of attribute args.
|
1179
|
+
def args; end
|
1180
|
+
|
1181
|
+
# Sets the attribute args
|
1182
|
+
#
|
1183
|
+
# @param value the value to set the attribute args to.
|
1184
|
+
def args=(_arg0); end
|
1185
|
+
|
1186
|
+
# Returns the value of attribute options.
|
1187
|
+
def options; end
|
1188
|
+
|
1189
|
+
# Sets the attribute options
|
1190
|
+
#
|
1191
|
+
# @param value the value to set the attribute options to.
|
1192
|
+
def options=(_arg0); end
|
1193
|
+
|
1194
|
+
# Returns the value of attribute parent_options.
|
1195
|
+
def parent_options; end
|
1196
|
+
|
1197
|
+
# Sets the attribute parent_options
|
1198
|
+
#
|
1199
|
+
# @param value the value to set the attribute parent_options to.
|
1200
|
+
def parent_options=(_arg0); end
|
1201
|
+
|
1202
|
+
class << self
|
1203
|
+
def included(base); end
|
1204
|
+
|
1205
|
+
# Whenever a class inherits from Thor or Thor::Group, we should track the
|
1206
|
+
# class and the file on Thor::Base. This is the method responsible for it.
|
1207
|
+
def register_klass_file(klass); end
|
1208
|
+
|
1209
|
+
# Returns the shell used in all Thor classes. If you are in a Unix platform
|
1210
|
+
# it will use a colored log, otherwise it will use a basic one without color.
|
1211
|
+
def shell; end
|
1212
|
+
|
1213
|
+
# Sets the attribute shell
|
1214
|
+
#
|
1215
|
+
# @param value the value to set the attribute shell to.
|
1216
|
+
def shell=(_arg0); end
|
1217
|
+
|
1218
|
+
# Returns the files where the subclasses are kept.
|
1219
|
+
#
|
1220
|
+
# ==== Returns
|
1221
|
+
# Hash[path<String> => Class]
|
1222
|
+
def subclass_files; end
|
1223
|
+
|
1224
|
+
# Returns the classes that inherits from Thor or Thor::Group.
|
1225
|
+
#
|
1226
|
+
# ==== Returns
|
1227
|
+
# Array[Class]
|
1228
|
+
def subclasses; end
|
1229
|
+
end
|
1230
|
+
end
|
1231
|
+
|
1232
|
+
module Thor::Base::ClassMethods
|
1233
|
+
# Returns the commands for this Thor class and all subclasses.
|
1234
|
+
#
|
1235
|
+
# ==== Returns
|
1236
|
+
# Hash:: An ordered hash with commands names as keys and Thor::Command
|
1237
|
+
# objects as values.
|
1238
|
+
def all_commands; end
|
1239
|
+
|
1240
|
+
# Returns the commands for this Thor class and all subclasses.
|
1241
|
+
#
|
1242
|
+
# ==== Returns
|
1243
|
+
# Hash:: An ordered hash with commands names as keys and Thor::Command
|
1244
|
+
# objects as values.
|
1245
|
+
def all_tasks; end
|
1246
|
+
|
1247
|
+
# If you want to use defaults that don't match the type of an option,
|
1248
|
+
# either specify `check_default_type: false` or call `allow_incompatible_default_type!`
|
1249
|
+
def allow_incompatible_default_type!; end
|
1250
|
+
|
1251
|
+
# Adds an argument to the class and creates an attr_accessor for it.
|
1252
|
+
#
|
1253
|
+
# Arguments are different from options in several aspects. The first one
|
1254
|
+
# is how they are parsed from the command line, arguments are retrieved
|
1255
|
+
# from position:
|
1256
|
+
#
|
1257
|
+
# thor command NAME
|
1258
|
+
#
|
1259
|
+
# Instead of:
|
1260
|
+
#
|
1261
|
+
# thor command --name=NAME
|
1262
|
+
#
|
1263
|
+
# Besides, arguments are used inside your code as an accessor (self.argument),
|
1264
|
+
# while options are all kept in a hash (self.options).
|
1265
|
+
#
|
1266
|
+
# Finally, arguments cannot have type :default or :boolean but can be
|
1267
|
+
# optional (supplying :optional => :true or :required => false), although
|
1268
|
+
# you cannot have a required argument after a non-required argument. If you
|
1269
|
+
# try it, an error is raised.
|
1270
|
+
#
|
1271
|
+
# ==== Parameters
|
1272
|
+
# name<Symbol>:: The name of the argument.
|
1273
|
+
# options<Hash>:: Described below.
|
1274
|
+
#
|
1275
|
+
# ==== Options
|
1276
|
+
# :desc - Description for the argument.
|
1277
|
+
# :required - If the argument is required or not.
|
1278
|
+
# :optional - If the argument is optional or not.
|
1279
|
+
# :type - The type of the argument, can be :string, :hash, :array, :numeric.
|
1280
|
+
# :default - Default value for this argument. It cannot be required and have default values.
|
1281
|
+
# :banner - String to show on usage notes.
|
1282
|
+
#
|
1283
|
+
# ==== Errors
|
1284
|
+
# ArgumentError:: Raised if you supply a required argument after a non required one.
|
1285
|
+
def argument(name, options = T.unsafe(nil)); end
|
1286
|
+
|
1287
|
+
# Returns this class arguments, looking up in the ancestors chain.
|
1288
|
+
#
|
1289
|
+
# ==== Returns
|
1290
|
+
# Array[Thor::Argument]
|
1291
|
+
def arguments; end
|
1292
|
+
|
1293
|
+
def attr_accessor(*_arg0); end
|
1294
|
+
def attr_reader(*_arg0); end
|
1295
|
+
def attr_writer(*_arg0); end
|
1296
|
+
def check_default_type; end
|
1297
|
+
|
1298
|
+
# If you want to raise an error when the default value of an option does not match
|
1299
|
+
# the type call check_default_type!
|
1300
|
+
# This will be the default; for compatibility a deprecation warning is issued if necessary.
|
1301
|
+
def check_default_type!; end
|
1302
|
+
|
1303
|
+
def check_unknown_options; end
|
1304
|
+
|
1305
|
+
# If you want to raise an error for unknown options, call check_unknown_options!
|
1306
|
+
# This is disabled by default to allow dynamic invocations.
|
1307
|
+
def check_unknown_options!; end
|
1308
|
+
|
1309
|
+
# @return [Boolean]
|
1310
|
+
def check_unknown_options?(config); end
|
1311
|
+
|
1312
|
+
# Adds an option to the set of class options
|
1313
|
+
#
|
1314
|
+
# ==== Parameters
|
1315
|
+
# name<Symbol>:: The name of the argument.
|
1316
|
+
# options<Hash>:: Described below.
|
1317
|
+
#
|
1318
|
+
# ==== Options
|
1319
|
+
# :desc:: -- Description for the argument.
|
1320
|
+
# :required:: -- If the argument is required or not.
|
1321
|
+
# :default:: -- Default value for this argument.
|
1322
|
+
# :group:: -- The group for this options. Use by class options to output options in different levels.
|
1323
|
+
# :aliases:: -- Aliases for this option. <b>Note:</b> Thor follows a convention of one-dash-one-letter options. Thus aliases like "-something" wouldn't be parsed; use either "\--something" or "-s" instead.
|
1324
|
+
# :type:: -- The type of the argument, can be :string, :hash, :array, :numeric or :boolean.
|
1325
|
+
# :banner:: -- String to show on usage notes.
|
1326
|
+
# :hide:: -- If you want to hide this option from the help.
|
1327
|
+
def class_option(name, options = T.unsafe(nil)); end
|
1328
|
+
|
1329
|
+
# Adds a bunch of options to the set of class options.
|
1330
|
+
#
|
1331
|
+
# class_options :foo => false, :bar => :required, :baz => :string
|
1332
|
+
#
|
1333
|
+
# If you prefer more detailed declaration, check class_option.
|
1334
|
+
#
|
1335
|
+
# ==== Parameters
|
1336
|
+
# Hash[Symbol => Object]
|
1337
|
+
def class_options(options = T.unsafe(nil)); end
|
1338
|
+
|
1339
|
+
# Returns the commands for this Thor class.
|
1340
|
+
#
|
1341
|
+
# ==== Returns
|
1342
|
+
# Hash:: An ordered hash with commands names as keys and Thor::Command
|
1343
|
+
# objects as values.
|
1344
|
+
def commands; end
|
1345
|
+
|
1346
|
+
# If true, option set will not suspend the execution of the command when
|
1347
|
+
# a required option is not provided.
|
1348
|
+
#
|
1349
|
+
# @return [Boolean]
|
1350
|
+
def disable_required_check?(command_name); end
|
1351
|
+
|
1352
|
+
# A flag that makes the process exit with status 1 if any error happens.
|
1353
|
+
#
|
1354
|
+
# @return [Boolean]
|
1355
|
+
def exit_on_failure?; end
|
1356
|
+
|
1357
|
+
# Defines the group. This is used when thor list is invoked so you can specify
|
1358
|
+
# that only commands from a pre-defined group will be shown. Defaults to standard.
|
1359
|
+
#
|
1360
|
+
# ==== Parameters
|
1361
|
+
# name<String|Symbol>
|
1362
|
+
def group(name = T.unsafe(nil)); end
|
1363
|
+
|
1364
|
+
# @raise [InvocationError]
|
1365
|
+
def handle_argument_error(command, error, args, arity); end
|
1366
|
+
|
1367
|
+
# @raise [UndefinedCommandError]
|
1368
|
+
def handle_no_command_error(command, has_namespace = T.unsafe(nil)); end
|
1369
|
+
|
1370
|
+
# @raise [UndefinedCommandError]
|
1371
|
+
def handle_no_task_error(command, has_namespace = T.unsafe(nil)); end
|
1372
|
+
|
1373
|
+
# Sets the namespace for the Thor or Thor::Group class. By default the
|
1374
|
+
# namespace is retrieved from the class name. If your Thor class is named
|
1375
|
+
# Scripts::MyScript, the help method, for example, will be called as:
|
1376
|
+
#
|
1377
|
+
# thor scripts:my_script -h
|
1378
|
+
#
|
1379
|
+
# If you change the namespace:
|
1380
|
+
#
|
1381
|
+
# namespace :my_scripts
|
1382
|
+
#
|
1383
|
+
# You change how your commands are invoked:
|
1384
|
+
#
|
1385
|
+
# thor my_scripts -h
|
1386
|
+
#
|
1387
|
+
# Finally, if you change your namespace to default:
|
1388
|
+
#
|
1389
|
+
# namespace :default
|
1390
|
+
#
|
1391
|
+
# Your commands can be invoked with a shortcut. Instead of:
|
1392
|
+
#
|
1393
|
+
# thor :my_command
|
1394
|
+
def namespace(name = T.unsafe(nil)); end
|
1395
|
+
|
1396
|
+
# All methods defined inside the given block are not added as commands.
|
1397
|
+
#
|
1398
|
+
# So you can do:
|
1399
|
+
#
|
1400
|
+
# class MyScript < Thor
|
1401
|
+
# no_commands do
|
1402
|
+
# def this_is_not_a_command
|
1403
|
+
# end
|
1404
|
+
# end
|
1405
|
+
# end
|
1406
|
+
#
|
1407
|
+
# You can also add the method and remove it from the command list:
|
1408
|
+
#
|
1409
|
+
# class MyScript < Thor
|
1410
|
+
# def this_is_not_a_command
|
1411
|
+
# end
|
1412
|
+
# remove_command :this_is_not_a_command
|
1413
|
+
# end
|
1414
|
+
def no_commands(&block); end
|
1415
|
+
|
1416
|
+
# @return [Boolean]
|
1417
|
+
def no_commands?; end
|
1418
|
+
|
1419
|
+
def no_commands_context; end
|
1420
|
+
|
1421
|
+
# All methods defined inside the given block are not added as commands.
|
1422
|
+
#
|
1423
|
+
# So you can do:
|
1424
|
+
#
|
1425
|
+
# class MyScript < Thor
|
1426
|
+
# no_commands do
|
1427
|
+
# def this_is_not_a_command
|
1428
|
+
# end
|
1429
|
+
# end
|
1430
|
+
# end
|
1431
|
+
#
|
1432
|
+
# You can also add the method and remove it from the command list:
|
1433
|
+
#
|
1434
|
+
# class MyScript < Thor
|
1435
|
+
# def this_is_not_a_command
|
1436
|
+
# end
|
1437
|
+
# remove_command :this_is_not_a_command
|
1438
|
+
# end
|
1439
|
+
def no_tasks(&block); end
|
1440
|
+
|
1441
|
+
# Allows to use private methods from parent in child classes as commands.
|
1442
|
+
#
|
1443
|
+
# ==== Parameters
|
1444
|
+
# names<Array>:: Method names to be used as commands
|
1445
|
+
#
|
1446
|
+
# ==== Examples
|
1447
|
+
#
|
1448
|
+
# public_command :foo
|
1449
|
+
# public_command :foo, :bar, :baz
|
1450
|
+
def public_command(*names); end
|
1451
|
+
|
1452
|
+
# Allows to use private methods from parent in child classes as commands.
|
1453
|
+
#
|
1454
|
+
# ==== Parameters
|
1455
|
+
# names<Array>:: Method names to be used as commands
|
1456
|
+
#
|
1457
|
+
# ==== Examples
|
1458
|
+
#
|
1459
|
+
# public_command :foo
|
1460
|
+
# public_command :foo, :bar, :baz
|
1461
|
+
def public_task(*names); end
|
1462
|
+
|
1463
|
+
# Removes a previous defined argument. If :undefine is given, undefine
|
1464
|
+
# accessors as well.
|
1465
|
+
#
|
1466
|
+
# ==== Parameters
|
1467
|
+
# names<Array>:: Arguments to be removed
|
1468
|
+
#
|
1469
|
+
# ==== Examples
|
1470
|
+
#
|
1471
|
+
# remove_argument :foo
|
1472
|
+
# remove_argument :foo, :bar, :baz, :undefine => true
|
1473
|
+
def remove_argument(*names); end
|
1474
|
+
|
1475
|
+
# Removes a previous defined class option.
|
1476
|
+
#
|
1477
|
+
# ==== Parameters
|
1478
|
+
# names<Array>:: Class options to be removed
|
1479
|
+
#
|
1480
|
+
# ==== Examples
|
1481
|
+
#
|
1482
|
+
# remove_class_option :foo
|
1483
|
+
# remove_class_option :foo, :bar, :baz
|
1484
|
+
def remove_class_option(*names); end
|
1485
|
+
|
1486
|
+
# Removes a given command from this Thor class. This is usually done if you
|
1487
|
+
# are inheriting from another class and don't want it to be available
|
1488
|
+
# anymore.
|
1489
|
+
#
|
1490
|
+
# By default it only remove the mapping to the command. But you can supply
|
1491
|
+
# :undefine => true to undefine the method from the class as well.
|
1492
|
+
#
|
1493
|
+
# ==== Parameters
|
1494
|
+
# name<Symbol|String>:: The name of the command to be removed
|
1495
|
+
# options<Hash>:: You can give :undefine => true if you want commands the method
|
1496
|
+
# to be undefined from the class as well.
|
1497
|
+
def remove_command(*names); end
|
1498
|
+
|
1499
|
+
# Removes a given command from this Thor class. This is usually done if you
|
1500
|
+
# are inheriting from another class and don't want it to be available
|
1501
|
+
# anymore.
|
1502
|
+
#
|
1503
|
+
# By default it only remove the mapping to the command. But you can supply
|
1504
|
+
# :undefine => true to undefine the method from the class as well.
|
1505
|
+
#
|
1506
|
+
# ==== Parameters
|
1507
|
+
# name<Symbol|String>:: The name of the command to be removed
|
1508
|
+
# options<Hash>:: You can give :undefine => true if you want commands the method
|
1509
|
+
# to be undefined from the class as well.
|
1510
|
+
def remove_task(*names); end
|
1511
|
+
|
1512
|
+
# Parses the command and options from the given args, instantiate the class
|
1513
|
+
# and invoke the command. This method is used when the arguments must be parsed
|
1514
|
+
# from an array. If you are inside Ruby and want to use a Thor class, you
|
1515
|
+
# can simply initialize it:
|
1516
|
+
#
|
1517
|
+
# script = MyScript.new(args, options, config)
|
1518
|
+
# script.invoke(:command, first_arg, second_arg, third_arg)
|
1519
|
+
def start(given_args = T.unsafe(nil), config = T.unsafe(nil)); end
|
1520
|
+
|
1521
|
+
# If true, option parsing is suspended as soon as an unknown option or a
|
1522
|
+
# regular argument is encountered. All remaining arguments are passed to
|
1523
|
+
# the command as regular arguments.
|
1524
|
+
#
|
1525
|
+
# @return [Boolean]
|
1526
|
+
def stop_on_unknown_option?(command_name); end
|
1527
|
+
|
1528
|
+
def strict_args_position; end
|
1529
|
+
|
1530
|
+
# If you want only strict string args (useful when cascading thor classes),
|
1531
|
+
# call strict_args_position! This is disabled by default to allow dynamic
|
1532
|
+
# invocations.
|
1533
|
+
def strict_args_position!; end
|
1534
|
+
|
1535
|
+
# @return [Boolean]
|
1536
|
+
def strict_args_position?(config); end
|
1537
|
+
|
1538
|
+
# Returns the commands for this Thor class.
|
1539
|
+
#
|
1540
|
+
# ==== Returns
|
1541
|
+
# Hash:: An ordered hash with commands names as keys and Thor::Command
|
1542
|
+
# objects as values.
|
1543
|
+
def tasks; end
|
1544
|
+
|
1545
|
+
protected
|
1546
|
+
|
1547
|
+
# SIGNATURE: Sets the baseclass. This is where the superclass lookup
|
1548
|
+
# finishes.
|
1549
|
+
def baseclass; end
|
1550
|
+
|
1551
|
+
# The basename of the program invoking the thor class.
|
1552
|
+
def basename; end
|
1553
|
+
|
1554
|
+
# Build an option and adds it to the given scope.
|
1555
|
+
#
|
1556
|
+
# ==== Parameters
|
1557
|
+
# name<Symbol>:: The name of the argument.
|
1558
|
+
# options<Hash>:: Described in both class_option and method_option.
|
1559
|
+
# scope<Hash>:: Options hash that is being built up
|
1560
|
+
def build_option(name, options, scope); end
|
1561
|
+
|
1562
|
+
# Receives a hash of options, parse them and add to the scope. This is a
|
1563
|
+
# fast way to set a bunch of options:
|
1564
|
+
#
|
1565
|
+
# build_options :foo => true, :bar => :required, :baz => :string
|
1566
|
+
#
|
1567
|
+
# ==== Parameters
|
1568
|
+
# Hash[Symbol => Object]
|
1569
|
+
def build_options(options, scope); end
|
1570
|
+
|
1571
|
+
# Prints the class options per group. If an option does not belong to
|
1572
|
+
# any group, it's printed as Class option.
|
1573
|
+
def class_options_help(shell, groups = T.unsafe(nil)); end
|
1574
|
+
|
1575
|
+
# SIGNATURE: Creates a new command if valid_command? is true. This method is
|
1576
|
+
# called when a new method is added to the class.
|
1577
|
+
def create_command(meth); end
|
1578
|
+
|
1579
|
+
# SIGNATURE: Creates a new command if valid_command? is true. This method is
|
1580
|
+
# called when a new method is added to the class.
|
1581
|
+
def create_task(meth); end
|
1582
|
+
|
1583
|
+
# SIGNATURE: The hook invoked by start.
|
1584
|
+
#
|
1585
|
+
# @raise [NotImplementedError]
|
1586
|
+
def dispatch(command, given_args, given_opts, config); end
|
1587
|
+
|
1588
|
+
# Finds a command with the given name. If the command belongs to the current
|
1589
|
+
# class, just return it, otherwise dup it and add the fresh copy to the
|
1590
|
+
# current command hash.
|
1591
|
+
def find_and_refresh_command(name); end
|
1592
|
+
|
1593
|
+
# Finds a command with the given name. If the command belongs to the current
|
1594
|
+
# class, just return it, otherwise dup it and add the fresh copy to the
|
1595
|
+
# current command hash.
|
1596
|
+
def find_and_refresh_task(name); end
|
1597
|
+
|
1598
|
+
# Retrieves a value from superclass. If it reaches the baseclass,
|
1599
|
+
# returns default.
|
1600
|
+
def from_superclass(method, default = T.unsafe(nil)); end
|
1601
|
+
|
1602
|
+
# Everytime someone inherits from a Thor class, register the klass
|
1603
|
+
# and file into baseclass.
|
1604
|
+
def inherited(klass); end
|
1605
|
+
|
1606
|
+
# SIGNATURE: Defines behavior when the initialize method is added to the
|
1607
|
+
# class.
|
1608
|
+
def initialize_added; end
|
1609
|
+
|
1610
|
+
# Raises an error if the word given is a Thor reserved word.
|
1611
|
+
#
|
1612
|
+
# @return [Boolean]
|
1613
|
+
def is_thor_reserved_word?(word, type); end
|
1614
|
+
|
1615
|
+
# Fire this callback whenever a method is added. Added methods are
|
1616
|
+
# tracked as commands by invoking the create_command method.
|
1617
|
+
def method_added(meth); end
|
1618
|
+
|
1619
|
+
# Receives a set of options and print them.
|
1620
|
+
def print_options(shell, options, group_name = T.unsafe(nil)); end
|
1621
|
+
end
|
1622
|
+
|
1623
|
+
class Thor::Command < ::Struct
|
1624
|
+
# @return [Command] a new instance of Command
|
1625
|
+
def initialize(name, description, long_description, usage, options = T.unsafe(nil)); end
|
1626
|
+
|
1627
|
+
# Returns the formatted usage by injecting given required arguments
|
1628
|
+
# and required options into the given usage.
|
1629
|
+
def formatted_usage(klass, namespace = T.unsafe(nil), subcommand = T.unsafe(nil)); end
|
1630
|
+
|
1631
|
+
# @return [Boolean]
|
1632
|
+
def hidden?; end
|
1633
|
+
|
1634
|
+
# By default, a command invokes a method in the thor class. You can change this
|
1635
|
+
# implementation to create custom commands.
|
1636
|
+
def run(instance, args = T.unsafe(nil)); end
|
1637
|
+
|
1638
|
+
protected
|
1639
|
+
|
1640
|
+
# @return [Boolean]
|
1641
|
+
def handle_argument_error?(instance, error, caller); end
|
1642
|
+
|
1643
|
+
# @return [Boolean]
|
1644
|
+
def handle_no_method_error?(instance, error, caller); end
|
1645
|
+
|
1646
|
+
# @return [Boolean]
|
1647
|
+
def local_method?(instance, name); end
|
1648
|
+
|
1649
|
+
# @return [Boolean]
|
1650
|
+
def not_debugging?(instance); end
|
1651
|
+
|
1652
|
+
# @return [Boolean]
|
1653
|
+
def private_method?(instance); end
|
1654
|
+
|
1655
|
+
# Given a target, checks if this class name is a public method.
|
1656
|
+
#
|
1657
|
+
# @return [Boolean]
|
1658
|
+
def public_method?(instance); end
|
1659
|
+
|
1660
|
+
# Add usage with required arguments
|
1661
|
+
def required_arguments_for(klass, usage); end
|
1662
|
+
|
1663
|
+
def required_options; end
|
1664
|
+
def sans_backtrace(backtrace, caller); end
|
1665
|
+
|
1666
|
+
private
|
1667
|
+
|
1668
|
+
def initialize_copy(other); end
|
1669
|
+
end
|
1670
|
+
|
1671
|
+
Thor::Command::FILE_REGEXP = T.let(T.unsafe(nil), Regexp)
|
1672
|
+
module Thor::CoreExt; end
|
1673
|
+
|
1674
|
+
# A hash with indifferent access and magic predicates.
|
1675
|
+
#
|
1676
|
+
# hash = Thor::CoreExt::HashWithIndifferentAccess.new 'foo' => 'bar', 'baz' => 'bee', 'force' => true
|
1677
|
+
#
|
1678
|
+
# hash[:foo] #=> 'bar'
|
1679
|
+
# hash['foo'] #=> 'bar'
|
1680
|
+
# hash.foo? #=> true
|
1681
|
+
class Thor::CoreExt::HashWithIndifferentAccess < ::Hash
|
1682
|
+
# @return [HashWithIndifferentAccess] a new instance of HashWithIndifferentAccess
|
1683
|
+
def initialize(hash = T.unsafe(nil)); end
|
1684
|
+
|
1685
|
+
def [](key); end
|
1686
|
+
def []=(key, value); end
|
1687
|
+
def delete(key); end
|
1688
|
+
def except(*keys); end
|
1689
|
+
def fetch(key, *args); end
|
1690
|
+
|
1691
|
+
# @return [Boolean]
|
1692
|
+
def key?(key); end
|
1693
|
+
|
1694
|
+
def merge(other); end
|
1695
|
+
def merge!(other); end
|
1696
|
+
def replace(other_hash); end
|
1697
|
+
def reverse_merge(other); end
|
1698
|
+
def reverse_merge!(other_hash); end
|
1699
|
+
|
1700
|
+
# Convert to a Hash with String keys.
|
1701
|
+
def to_hash; end
|
1702
|
+
|
1703
|
+
def values_at(*indices); end
|
1704
|
+
|
1705
|
+
protected
|
1706
|
+
|
1707
|
+
def convert_key(key); end
|
1708
|
+
|
1709
|
+
# Magic predicates. For instance:
|
1710
|
+
#
|
1711
|
+
# options.force? # => !!options['force']
|
1712
|
+
# options.shebang # => "/usr/lib/local/ruby"
|
1713
|
+
# options.test_framework?(:rspec) # => options[:test_framework] == :rspec
|
1714
|
+
def method_missing(method, *args); end
|
1715
|
+
end
|
1716
|
+
|
1717
|
+
Thor::Correctable = DidYouMean::Correctable
|
1718
|
+
|
1719
|
+
# A dynamic command that handles method missing scenarios.
|
1720
|
+
class Thor::DynamicCommand < ::Thor::Command
|
1721
|
+
# @return [DynamicCommand] a new instance of DynamicCommand
|
1722
|
+
def initialize(name, options = T.unsafe(nil)); end
|
1723
|
+
|
1724
|
+
def run(instance, args = T.unsafe(nil)); end
|
1725
|
+
end
|
1726
|
+
|
1727
|
+
Thor::DynamicTask = Thor::DynamicCommand
|
1728
|
+
|
1729
|
+
# Thor::Error is raised when it's caused by wrong usage of thor classes. Those
|
1730
|
+
# errors have their backtrace suppressed and are nicely shown to the user.
|
1731
|
+
#
|
1732
|
+
# Errors that are caused by the developer, like declaring a method which
|
1733
|
+
# overwrites a thor keyword, SHOULD NOT raise a Thor::Error. This way, we
|
1734
|
+
# ensure that developer errors are shown with full backtrace.
|
1735
|
+
class Thor::Error < ::StandardError; end
|
1736
|
+
|
1737
|
+
# Thor has a special class called Thor::Group. The main difference to Thor class
|
1738
|
+
# is that it invokes all commands at once. It also include some methods that allows
|
1739
|
+
# invocations to be done at the class method, which are not available to Thor
|
1740
|
+
# commands.
|
1741
|
+
class Thor::Group
|
1742
|
+
include ::Thor::Base
|
1743
|
+
include ::Thor::Invocation
|
1744
|
+
include ::Thor::Shell
|
1745
|
+
extend ::Thor::Base::ClassMethods
|
1746
|
+
extend ::Thor::Invocation::ClassMethods
|
1747
|
+
|
1748
|
+
protected
|
1749
|
+
|
1750
|
+
# Shortcut to invoke with padding and block handling. Use internally by
|
1751
|
+
# invoke and invoke_from_option class methods.
|
1752
|
+
def _invoke_for_class_method(klass, command = T.unsafe(nil), *args, &block); end
|
1753
|
+
|
1754
|
+
class << self
|
1755
|
+
# Overwrite class options help to allow invoked generators options to be
|
1756
|
+
# shown recursively when invoking a generator.
|
1757
|
+
def class_options_help(shell, groups = T.unsafe(nil)); end
|
1758
|
+
|
1759
|
+
# The description for this Thor::Group. If none is provided, but a source root
|
1760
|
+
# exists, tries to find the USAGE one folder above it, otherwise searches
|
1761
|
+
# in the superclass.
|
1762
|
+
#
|
1763
|
+
# ==== Parameters
|
1764
|
+
# description<String>:: The description for this Thor::Group.
|
1765
|
+
def desc(description = T.unsafe(nil)); end
|
1766
|
+
|
1767
|
+
# Get invocations array and merge options from invocations. Those
|
1768
|
+
# options are added to group_options hash. Options that already exists
|
1769
|
+
# in base_options are not added twice.
|
1770
|
+
def get_options_from_invocations(group_options, base_options); end
|
1771
|
+
|
1772
|
+
# @raise [error]
|
1773
|
+
def handle_argument_error(command, error, _args, arity); end
|
1774
|
+
|
1775
|
+
# Prints help information.
|
1776
|
+
#
|
1777
|
+
# ==== Options
|
1778
|
+
# short:: When true, shows only usage.
|
1779
|
+
def help(shell); end
|
1780
|
+
|
1781
|
+
# Stores invocation blocks used on invoke_from_option.
|
1782
|
+
def invocation_blocks; end
|
1783
|
+
|
1784
|
+
# Stores invocations for this class merging with superclass values.
|
1785
|
+
def invocations; end
|
1786
|
+
|
1787
|
+
# Invoke the given namespace or class given. It adds an instance
|
1788
|
+
# method that will invoke the klass and command. You can give a block to
|
1789
|
+
# configure how it will be invoked.
|
1790
|
+
#
|
1791
|
+
# The namespace/class given will have its options showed on the help
|
1792
|
+
# usage. Check invoke_from_option for more information.
|
1793
|
+
def invoke(*names, &block); end
|
1794
|
+
|
1795
|
+
# Invoke a thor class based on the value supplied by the user to the
|
1796
|
+
# given option named "name". A class option must be created before this
|
1797
|
+
# method is invoked for each name given.
|
1798
|
+
#
|
1799
|
+
# ==== Examples
|
1800
|
+
#
|
1801
|
+
# class GemGenerator < Thor::Group
|
1802
|
+
# class_option :test_framework, :type => :string
|
1803
|
+
# invoke_from_option :test_framework
|
1804
|
+
# end
|
1805
|
+
#
|
1806
|
+
# ==== Boolean options
|
1807
|
+
#
|
1808
|
+
# In some cases, you want to invoke a thor class if some option is true or
|
1809
|
+
# false. This is automatically handled by invoke_from_option. Then the
|
1810
|
+
# option name is used to invoke the generator.
|
1811
|
+
#
|
1812
|
+
# ==== Preparing for invocation
|
1813
|
+
#
|
1814
|
+
# In some cases you want to customize how a specified hook is going to be
|
1815
|
+
# invoked. You can do that by overwriting the class method
|
1816
|
+
# prepare_for_invocation. The class method must necessarily return a klass
|
1817
|
+
# and an optional command.
|
1818
|
+
#
|
1819
|
+
# ==== Custom invocations
|
1820
|
+
#
|
1821
|
+
# You can also supply a block to customize how the option is going to be
|
1822
|
+
# invoked. The block receives two parameters, an instance of the current
|
1823
|
+
# class and the klass to be invoked.
|
1824
|
+
def invoke_from_option(*names, &block); end
|
1825
|
+
|
1826
|
+
# Returns commands ready to be printed.
|
1827
|
+
def printable_commands(*_arg0); end
|
1828
|
+
|
1829
|
+
# Returns commands ready to be printed.
|
1830
|
+
def printable_tasks(*_arg0); end
|
1831
|
+
|
1832
|
+
# Remove a previously added invocation.
|
1833
|
+
#
|
1834
|
+
# ==== Examples
|
1835
|
+
#
|
1836
|
+
# remove_invocation :test_framework
|
1837
|
+
def remove_invocation(*names); end
|
1838
|
+
|
1839
|
+
protected
|
1840
|
+
|
1841
|
+
# The banner for this class. You can customize it if you are invoking the
|
1842
|
+
# thor class by another ways which is not the Thor::Runner.
|
1843
|
+
def banner; end
|
1844
|
+
|
1845
|
+
def baseclass; end
|
1846
|
+
def create_command(meth); end
|
1847
|
+
def create_task(meth); end
|
1848
|
+
|
1849
|
+
# The method responsible for dispatching given the args.
|
1850
|
+
#
|
1851
|
+
# @yield [instance]
|
1852
|
+
def dispatch(command, given_args, given_opts, config); end
|
1853
|
+
|
1854
|
+
# Represents the whole class as a command.
|
1855
|
+
def self_command; end
|
1856
|
+
|
1857
|
+
# Represents the whole class as a command.
|
1858
|
+
def self_task; end
|
1859
|
+
end
|
1860
|
+
end
|
1861
|
+
|
1862
|
+
# Shortcuts for help.
|
1863
|
+
Thor::HELP_MAPPINGS = T.let(T.unsafe(nil), Array)
|
1864
|
+
|
1865
|
+
# A command that is hidden in help messages but still invocable.
|
1866
|
+
class Thor::HiddenCommand < ::Thor::Command
|
1867
|
+
# @return [Boolean]
|
1868
|
+
def hidden?; end
|
1869
|
+
end
|
1870
|
+
|
1871
|
+
Thor::HiddenTask = Thor::HiddenCommand
|
1872
|
+
|
1873
|
+
module Thor::Invocation
|
1874
|
+
mixes_in_class_methods ::Thor::Invocation::ClassMethods
|
1875
|
+
|
1876
|
+
# Make initializer aware of invocations and the initialization args.
|
1877
|
+
def initialize(args = T.unsafe(nil), options = T.unsafe(nil), config = T.unsafe(nil), &block); end
|
1878
|
+
|
1879
|
+
# Make the current command chain accessible with in a Thor-(sub)command
|
1880
|
+
def current_command_chain; end
|
1881
|
+
|
1882
|
+
# Receives a name and invokes it. The name can be a string (either "command" or
|
1883
|
+
# "namespace:command"), a Thor::Command, a Class or a Thor instance. If the
|
1884
|
+
# command cannot be guessed by name, it can also be supplied as second argument.
|
1885
|
+
#
|
1886
|
+
# You can also supply the arguments, options and configuration values for
|
1887
|
+
# the command to be invoked, if none is given, the same values used to
|
1888
|
+
# initialize the invoker are used to initialize the invoked.
|
1889
|
+
#
|
1890
|
+
# When no name is given, it will invoke the default command of the current class.
|
1891
|
+
#
|
1892
|
+
# ==== Examples
|
1893
|
+
#
|
1894
|
+
# class A < Thor
|
1895
|
+
# def foo
|
1896
|
+
# invoke :bar
|
1897
|
+
# invoke "b:hello", ["Erik"]
|
1898
|
+
# end
|
1899
|
+
#
|
1900
|
+
# def bar
|
1901
|
+
# invoke "b:hello", ["Erik"]
|
1902
|
+
# end
|
1903
|
+
# end
|
1904
|
+
#
|
1905
|
+
# class B < Thor
|
1906
|
+
# def hello(name)
|
1907
|
+
# puts "hello #{name}"
|
1908
|
+
# end
|
1909
|
+
# end
|
1910
|
+
#
|
1911
|
+
# You can notice that the method "foo" above invokes two commands: "bar",
|
1912
|
+
# which belongs to the same class and "hello" which belongs to the class B.
|
1913
|
+
#
|
1914
|
+
# By using an invocation system you ensure that a command is invoked only once.
|
1915
|
+
# In the example above, invoking "foo" will invoke "b:hello" just once, even
|
1916
|
+
# if it's invoked later by "bar" method.
|
1917
|
+
#
|
1918
|
+
# When class A invokes class B, all arguments used on A initialization are
|
1919
|
+
# supplied to B. This allows lazy parse of options. Let's suppose you have
|
1920
|
+
# some rspec commands:
|
1921
|
+
#
|
1922
|
+
# class Rspec < Thor::Group
|
1923
|
+
# class_option :mock_framework, :type => :string, :default => :rr
|
1924
|
+
#
|
1925
|
+
# def invoke_mock_framework
|
1926
|
+
# invoke "rspec:#{options[:mock_framework]}"
|
1927
|
+
# end
|
1928
|
+
# end
|
1929
|
+
#
|
1930
|
+
# As you noticed, it invokes the given mock framework, which might have its
|
1931
|
+
# own options:
|
1932
|
+
#
|
1933
|
+
# class Rspec::RR < Thor::Group
|
1934
|
+
# class_option :style, :type => :string, :default => :mock
|
1935
|
+
# end
|
1936
|
+
#
|
1937
|
+
# Since it's not rspec concern to parse mock framework options, when RR
|
1938
|
+
# is invoked all options are parsed again, so RR can extract only the options
|
1939
|
+
# that it's going to use.
|
1940
|
+
#
|
1941
|
+
# If you want Rspec::RR to be initialized with its own set of options, you
|
1942
|
+
# have to do that explicitly:
|
1943
|
+
#
|
1944
|
+
# invoke "rspec:rr", [], :style => :foo
|
1945
|
+
#
|
1946
|
+
# Besides giving an instance, you can also give a class to invoke:
|
1947
|
+
#
|
1948
|
+
# invoke Rspec::RR, [], :style => :foo
|
1949
|
+
def invoke(name = T.unsafe(nil), *args); end
|
1950
|
+
|
1951
|
+
# Invoke all commands for the current instance.
|
1952
|
+
def invoke_all; end
|
1953
|
+
|
1954
|
+
# Invoke the given command if the given args.
|
1955
|
+
def invoke_command(command, *args); end
|
1956
|
+
|
1957
|
+
# Invoke the given command if the given args.
|
1958
|
+
def invoke_task(command, *args); end
|
1959
|
+
|
1960
|
+
# Invokes using shell padding.
|
1961
|
+
def invoke_with_padding(*args); end
|
1962
|
+
|
1963
|
+
protected
|
1964
|
+
|
1965
|
+
# Initialize klass using values stored in the @_initializer.
|
1966
|
+
def _parse_initialization_options(args, opts, config); end
|
1967
|
+
|
1968
|
+
# This method simply retrieves the class and command to be invoked.
|
1969
|
+
# If the name is nil or the given name is a command in the current class,
|
1970
|
+
# use the given name and return self as class. Otherwise, call
|
1971
|
+
# prepare_for_invocation in the current class.
|
1972
|
+
def _retrieve_class_and_command(name, sent_command = T.unsafe(nil)); end
|
1973
|
+
|
1974
|
+
# This method simply retrieves the class and command to be invoked.
|
1975
|
+
# If the name is nil or the given name is a command in the current class,
|
1976
|
+
# use the given name and return self as class. Otherwise, call
|
1977
|
+
# prepare_for_invocation in the current class.
|
1978
|
+
def _retrieve_class_and_task(name, sent_command = T.unsafe(nil)); end
|
1979
|
+
|
1980
|
+
# Configuration values that are shared between invocations.
|
1981
|
+
def _shared_configuration; end
|
1982
|
+
|
1983
|
+
class << self
|
1984
|
+
def included(base); end
|
1985
|
+
end
|
1986
|
+
end
|
1987
|
+
|
1988
|
+
module Thor::Invocation::ClassMethods
|
1989
|
+
# This method is responsible for receiving a name and find the proper
|
1990
|
+
# class and command for it. The key is an optional parameter which is
|
1991
|
+
# available only in class methods invocations (i.e. in Thor::Group).
|
1992
|
+
def prepare_for_invocation(key, name); end
|
1993
|
+
end
|
1994
|
+
|
1995
|
+
# Raised when a command was found, but not invoked properly.
|
1996
|
+
class Thor::InvocationError < ::Thor::Error; end
|
1997
|
+
|
1998
|
+
module Thor::LineEditor
|
1999
|
+
class << self
|
2000
|
+
def best_available; end
|
2001
|
+
def readline(prompt, options = T.unsafe(nil)); end
|
2002
|
+
end
|
2003
|
+
end
|
2004
|
+
|
2005
|
+
class Thor::LineEditor::Basic
|
2006
|
+
# @return [Basic] a new instance of Basic
|
2007
|
+
def initialize(prompt, options); end
|
2008
|
+
|
2009
|
+
# Returns the value of attribute options.
|
2010
|
+
def options; end
|
2011
|
+
|
2012
|
+
# Returns the value of attribute prompt.
|
2013
|
+
def prompt; end
|
2014
|
+
|
2015
|
+
def readline; end
|
2016
|
+
|
2017
|
+
private
|
2018
|
+
|
2019
|
+
# @return [Boolean]
|
2020
|
+
def echo?; end
|
2021
|
+
|
2022
|
+
def get_input; end
|
2023
|
+
|
2024
|
+
class << self
|
2025
|
+
# @return [Boolean]
|
2026
|
+
def available?; end
|
2027
|
+
end
|
2028
|
+
end
|
2029
|
+
|
2030
|
+
class Thor::LineEditor::Readline < ::Thor::LineEditor::Basic
|
2031
|
+
def readline; end
|
2032
|
+
|
2033
|
+
private
|
2034
|
+
|
2035
|
+
# @return [Boolean]
|
2036
|
+
def add_to_history?; end
|
2037
|
+
|
2038
|
+
def completion_options; end
|
2039
|
+
def completion_proc; end
|
2040
|
+
|
2041
|
+
# @return [Boolean]
|
2042
|
+
def use_path_completion?; end
|
2043
|
+
|
2044
|
+
class << self
|
2045
|
+
# @return [Boolean]
|
2046
|
+
def available?; end
|
2047
|
+
end
|
2048
|
+
end
|
2049
|
+
|
2050
|
+
class Thor::LineEditor::Readline::PathCompletion
|
2051
|
+
# @return [PathCompletion] a new instance of PathCompletion
|
2052
|
+
def initialize(text); end
|
2053
|
+
|
2054
|
+
def matches; end
|
2055
|
+
|
2056
|
+
private
|
2057
|
+
|
2058
|
+
def absolute_matches; end
|
2059
|
+
def base_path; end
|
2060
|
+
def glob_pattern; end
|
2061
|
+
def relative_matches; end
|
2062
|
+
|
2063
|
+
# Returns the value of attribute text.
|
2064
|
+
def text; end
|
2065
|
+
end
|
2066
|
+
|
2067
|
+
class Thor::MalformattedArgumentError < ::Thor::InvocationError; end
|
2068
|
+
|
2069
|
+
class Thor::NestedContext
|
2070
|
+
# @return [NestedContext] a new instance of NestedContext
|
2071
|
+
def initialize; end
|
2072
|
+
|
2073
|
+
def enter; end
|
2074
|
+
|
2075
|
+
# @return [Boolean]
|
2076
|
+
def entered?; end
|
2077
|
+
|
2078
|
+
private
|
2079
|
+
|
2080
|
+
def pop; end
|
2081
|
+
def push; end
|
2082
|
+
end
|
2083
|
+
|
2084
|
+
class Thor::NoKwargSpellChecker < ::DidYouMean::SpellChecker
|
2085
|
+
def initialize(dictionary); end
|
2086
|
+
end
|
2087
|
+
|
2088
|
+
class Thor::Option < ::Thor::Argument
|
2089
|
+
# @return [Option] a new instance of Option
|
2090
|
+
def initialize(name, options = T.unsafe(nil)); end
|
2091
|
+
|
2092
|
+
# Returns the value of attribute aliases.
|
2093
|
+
def aliases; end
|
2094
|
+
|
2095
|
+
def array?; end
|
2096
|
+
def boolean?; end
|
2097
|
+
|
2098
|
+
# Returns the value of attribute group.
|
2099
|
+
def group; end
|
2100
|
+
|
2101
|
+
def hash?; end
|
2102
|
+
|
2103
|
+
# Returns the value of attribute hide.
|
2104
|
+
def hide; end
|
2105
|
+
|
2106
|
+
def human_name; end
|
2107
|
+
|
2108
|
+
# Returns the value of attribute lazy_default.
|
2109
|
+
def lazy_default; end
|
2110
|
+
|
2111
|
+
def numeric?; end
|
2112
|
+
|
2113
|
+
# Returns the value of attribute repeatable.
|
2114
|
+
def repeatable; end
|
2115
|
+
|
2116
|
+
def string?; end
|
2117
|
+
def switch_name; end
|
2118
|
+
def usage(padding = T.unsafe(nil)); end
|
2119
|
+
|
2120
|
+
protected
|
2121
|
+
|
2122
|
+
def dasherize(str); end
|
2123
|
+
|
2124
|
+
# @return [Boolean]
|
2125
|
+
def dasherized?; end
|
2126
|
+
|
2127
|
+
def undasherize(str); end
|
2128
|
+
|
2129
|
+
# @raise [ArgumentError]
|
2130
|
+
def validate!; end
|
2131
|
+
|
2132
|
+
def validate_default_type!; end
|
2133
|
+
|
2134
|
+
class << self
|
2135
|
+
# This parse quick options given as method_options. It makes several
|
2136
|
+
# assumptions, but you can be more specific using the option method.
|
2137
|
+
#
|
2138
|
+
# parse :foo => "bar"
|
2139
|
+
# #=> Option foo with default value bar
|
2140
|
+
#
|
2141
|
+
# parse [:foo, :baz] => "bar"
|
2142
|
+
# #=> Option foo with default value bar and alias :baz
|
2143
|
+
#
|
2144
|
+
# parse :foo => :required
|
2145
|
+
# #=> Required option foo without default value
|
2146
|
+
#
|
2147
|
+
# parse :foo => 2
|
2148
|
+
# #=> Option foo with default value 2 and type numeric
|
2149
|
+
#
|
2150
|
+
# parse :foo => :numeric
|
2151
|
+
# #=> Option foo without default value and type numeric
|
2152
|
+
#
|
2153
|
+
# parse :foo => true
|
2154
|
+
# #=> Option foo with default value true and type boolean
|
2155
|
+
#
|
2156
|
+
# The valid types are :boolean, :numeric, :hash, :array and :string. If none
|
2157
|
+
# is given a default type is assumed. This default type accepts arguments as
|
2158
|
+
# string (--foo=value) or booleans (just --foo).
|
2159
|
+
#
|
2160
|
+
# By default all options are optional, unless :required is given.
|
2161
|
+
def parse(key, value); end
|
2162
|
+
end
|
2163
|
+
end
|
2164
|
+
|
2165
|
+
Thor::Option::VALID_TYPES = T.let(T.unsafe(nil), Array)
|
2166
|
+
|
2167
|
+
class Thor::Options < ::Thor::Arguments
|
2168
|
+
# Takes a hash of Thor::Option and a hash with defaults.
|
2169
|
+
#
|
2170
|
+
# If +stop_on_unknown+ is true, #parse will stop as soon as it encounters
|
2171
|
+
# an unknown option or a regular argument.
|
2172
|
+
#
|
2173
|
+
# @return [Options] a new instance of Options
|
2174
|
+
def initialize(hash_options = T.unsafe(nil), defaults = T.unsafe(nil), stop_on_unknown = T.unsafe(nil), disable_required_check = T.unsafe(nil)); end
|
2175
|
+
|
2176
|
+
# @raise [UnknownArgumentError]
|
2177
|
+
def check_unknown!; end
|
2178
|
+
|
2179
|
+
def parse(args); end
|
2180
|
+
def peek; end
|
2181
|
+
def remaining; end
|
2182
|
+
def shift; end
|
2183
|
+
def unshift(arg, is_value: T.unsafe(nil)); end
|
2184
|
+
|
2185
|
+
protected
|
2186
|
+
|
2187
|
+
def assign_result!(option, result); end
|
2188
|
+
|
2189
|
+
# Check if the current value in peek is a registered switch.
|
2190
|
+
#
|
2191
|
+
# Two booleans are returned. The first is true if the current value
|
2192
|
+
# starts with a hyphen; the second is true if it is a registered switch.
|
2193
|
+
#
|
2194
|
+
# @return [Boolean]
|
2195
|
+
def current_is_switch?; end
|
2196
|
+
|
2197
|
+
# @return [Boolean]
|
2198
|
+
def current_is_switch_formatted?; end
|
2199
|
+
|
2200
|
+
# @return [Boolean]
|
2201
|
+
def current_is_value?; end
|
2202
|
+
|
2203
|
+
# Check if the given argument is actually a shortcut.
|
2204
|
+
def normalize_switch(arg); end
|
2205
|
+
|
2206
|
+
# Parse boolean values which can be given as --foo=true, --foo or --no-foo.
|
2207
|
+
def parse_boolean(switch); end
|
2208
|
+
|
2209
|
+
# Parse the value at the peek analyzing if it requires an input or not.
|
2210
|
+
def parse_peek(switch, option); end
|
2211
|
+
|
2212
|
+
# @return [Boolean]
|
2213
|
+
def parsing_options?; end
|
2214
|
+
|
2215
|
+
# @return [Boolean]
|
2216
|
+
def switch?(arg); end
|
2217
|
+
|
2218
|
+
def switch_option(arg); end
|
2219
|
+
|
2220
|
+
class << self
|
2221
|
+
# Receives a hash and makes it switches.
|
2222
|
+
def to_switches(options); end
|
2223
|
+
end
|
2224
|
+
end
|
2225
|
+
|
2226
|
+
Thor::Options::EQ_RE = T.let(T.unsafe(nil), Regexp)
|
2227
|
+
Thor::Options::LONG_RE = T.let(T.unsafe(nil), Regexp)
|
2228
|
+
Thor::Options::OPTS_END = T.let(T.unsafe(nil), String)
|
2229
|
+
Thor::Options::SHORT_NUM = T.let(T.unsafe(nil), Regexp)
|
2230
|
+
Thor::Options::SHORT_RE = T.let(T.unsafe(nil), Regexp)
|
2231
|
+
|
2232
|
+
# Allow either -x -v or -xv style for single char args
|
2233
|
+
Thor::Options::SHORT_SQ_RE = T.let(T.unsafe(nil), Regexp)
|
2234
|
+
|
2235
|
+
# Adds a compatibility layer to your Thor classes which allows you to use
|
2236
|
+
# rake package tasks. For example, to use rspec rake tasks, one can do:
|
2237
|
+
#
|
2238
|
+
# require 'thor/rake_compat'
|
2239
|
+
# require 'rspec/core/rake_task'
|
2240
|
+
#
|
2241
|
+
# class Default < Thor
|
2242
|
+
# include Thor::RakeCompat
|
2243
|
+
#
|
2244
|
+
# RSpec::Core::RakeTask.new(:spec) do |t|
|
2245
|
+
# t.spec_opts = ['--options', './.rspec']
|
2246
|
+
# t.spec_files = FileList['spec/**/*_spec.rb']
|
2247
|
+
# end
|
2248
|
+
# end
|
2249
|
+
module Thor::RakeCompat
|
2250
|
+
include ::FileUtils::StreamUtils_
|
2251
|
+
include ::FileUtils
|
2252
|
+
include ::Rake::FileUtilsExt
|
2253
|
+
include ::Rake::DSL
|
2254
|
+
|
2255
|
+
class << self
|
2256
|
+
# @private
|
2257
|
+
def included(base); end
|
2258
|
+
|
2259
|
+
def rake_classes; end
|
2260
|
+
end
|
2261
|
+
end
|
2262
|
+
|
2263
|
+
class Thor::RequiredArgumentMissingError < ::Thor::InvocationError; end
|
2264
|
+
module Thor::Sandbox; end
|
2265
|
+
|
2266
|
+
module Thor::Shell
|
2267
|
+
# Add shell to initialize config values.
|
2268
|
+
#
|
2269
|
+
# ==== Configuration
|
2270
|
+
# shell<Object>:: An instance of the shell to be used.
|
2271
|
+
#
|
2272
|
+
# ==== Examples
|
2273
|
+
#
|
2274
|
+
# class MyScript < Thor
|
2275
|
+
# argument :first, :type => :numeric
|
2276
|
+
# end
|
2277
|
+
#
|
2278
|
+
# MyScript.new [1.0], { :foo => :bar }, :shell => Thor::Shell::Basic.new
|
2279
|
+
def initialize(args = T.unsafe(nil), options = T.unsafe(nil), config = T.unsafe(nil)); end
|
2280
|
+
|
2281
|
+
def ask(*args, &block); end
|
2282
|
+
def error(*args, &block); end
|
2283
|
+
def file_collision(*args, &block); end
|
2284
|
+
def no?(*args, &block); end
|
2285
|
+
def print_in_columns(*args, &block); end
|
2286
|
+
def print_table(*args, &block); end
|
2287
|
+
def print_wrapped(*args, &block); end
|
2288
|
+
def say(*args, &block); end
|
2289
|
+
def say_error(*args, &block); end
|
2290
|
+
def say_status(*args, &block); end
|
2291
|
+
def set_color(*args, &block); end
|
2292
|
+
|
2293
|
+
# Holds the shell for the given Thor instance. If no shell is given,
|
2294
|
+
# it gets a default shell from Thor::Base.shell.
|
2295
|
+
def shell; end
|
2296
|
+
|
2297
|
+
# Sets the attribute shell
|
2298
|
+
#
|
2299
|
+
# @param value the value to set the attribute shell to.
|
2300
|
+
def shell=(_arg0); end
|
2301
|
+
|
2302
|
+
def terminal_width(*args, &block); end
|
2303
|
+
|
2304
|
+
# Yields the given block with padding.
|
2305
|
+
def with_padding; end
|
2306
|
+
|
2307
|
+
def yes?(*args, &block); end
|
2308
|
+
|
2309
|
+
protected
|
2310
|
+
|
2311
|
+
# Allow shell to be shared between invocations.
|
2312
|
+
def _shared_configuration; end
|
2313
|
+
end
|
2314
|
+
|
2315
|
+
class Thor::Shell::Basic
|
2316
|
+
# Initialize base, mute and padding to nil.
|
2317
|
+
#
|
2318
|
+
# @return [Basic] a new instance of Basic
|
2319
|
+
def initialize; end
|
2320
|
+
|
2321
|
+
# Asks something to the user and receives a response.
|
2322
|
+
#
|
2323
|
+
# If a default value is specified it will be presented to the user
|
2324
|
+
# and allows them to select that value with an empty response. This
|
2325
|
+
# option is ignored when limited answers are supplied.
|
2326
|
+
#
|
2327
|
+
# If asked to limit the correct responses, you can pass in an
|
2328
|
+
# array of acceptable answers. If one of those is not supplied,
|
2329
|
+
# they will be shown a message stating that one of those answers
|
2330
|
+
# must be given and re-asked the question.
|
2331
|
+
#
|
2332
|
+
# If asking for sensitive information, the :echo option can be set
|
2333
|
+
# to false to mask user input from $stdin.
|
2334
|
+
#
|
2335
|
+
# If the required input is a path, then set the path option to
|
2336
|
+
# true. This will enable tab completion for file paths relative
|
2337
|
+
# to the current working directory on systems that support
|
2338
|
+
# Readline.
|
2339
|
+
#
|
2340
|
+
# ==== Example
|
2341
|
+
# ask("What is your name?")
|
2342
|
+
#
|
2343
|
+
# ask("What is the planet furthest from the sun?", :default => "Pluto")
|
2344
|
+
#
|
2345
|
+
# ask("What is your favorite Neopolitan flavor?", :limited_to => ["strawberry", "chocolate", "vanilla"])
|
2346
|
+
#
|
2347
|
+
# ask("What is your password?", :echo => false)
|
2348
|
+
#
|
2349
|
+
# ask("Where should the file be saved?", :path => true)
|
2350
|
+
def ask(statement, *args); end
|
2351
|
+
|
2352
|
+
# Returns the value of attribute base.
|
2353
|
+
def base; end
|
2354
|
+
|
2355
|
+
# Sets the attribute base
|
2356
|
+
#
|
2357
|
+
# @param value the value to set the attribute base to.
|
2358
|
+
def base=(_arg0); end
|
2359
|
+
|
2360
|
+
# Called if something goes wrong during the execution. This is used by Thor
|
2361
|
+
# internally and should not be used inside your scripts. If something went
|
2362
|
+
# wrong, you can always raise an exception. If you raise a Thor::Error, it
|
2363
|
+
# will be rescued and wrapped in the method below.
|
2364
|
+
def error(statement); end
|
2365
|
+
|
2366
|
+
# Deals with file collision and returns true if the file should be
|
2367
|
+
# overwritten and false otherwise. If a block is given, it uses the block
|
2368
|
+
# response as the content for the diff.
|
2369
|
+
#
|
2370
|
+
# ==== Parameters
|
2371
|
+
# destination<String>:: the destination file to solve conflicts
|
2372
|
+
# block<Proc>:: an optional block that returns the value to be used in diff and merge
|
2373
|
+
def file_collision(destination); end
|
2374
|
+
|
2375
|
+
# Sets the output padding while executing a block and resets it.
|
2376
|
+
def indent(count = T.unsafe(nil)); end
|
2377
|
+
|
2378
|
+
# Mute everything that's inside given block
|
2379
|
+
def mute; end
|
2380
|
+
|
2381
|
+
# Check if base is muted
|
2382
|
+
#
|
2383
|
+
# @return [Boolean]
|
2384
|
+
def mute?; end
|
2385
|
+
|
2386
|
+
# Make a question the to user and returns true if the user replies "n" or
|
2387
|
+
# "no".
|
2388
|
+
#
|
2389
|
+
# @return [Boolean]
|
2390
|
+
def no?(statement, color = T.unsafe(nil)); end
|
2391
|
+
|
2392
|
+
# Returns the value of attribute padding.
|
2393
|
+
def padding; end
|
2394
|
+
|
2395
|
+
# Sets the output padding, not allowing less than zero values.
|
2396
|
+
def padding=(value); end
|
2397
|
+
|
2398
|
+
# Prints values in columns
|
2399
|
+
#
|
2400
|
+
# ==== Parameters
|
2401
|
+
# Array[String, String, ...]
|
2402
|
+
def print_in_columns(array); end
|
2403
|
+
|
2404
|
+
# Prints a table.
|
2405
|
+
#
|
2406
|
+
# ==== Parameters
|
2407
|
+
# Array[Array[String, String, ...]]
|
2408
|
+
#
|
2409
|
+
# ==== Options
|
2410
|
+
# indent<Integer>:: Indent the first column by indent value.
|
2411
|
+
# colwidth<Integer>:: Force the first column to colwidth spaces wide.
|
2412
|
+
def print_table(array, options = T.unsafe(nil)); end
|
2413
|
+
|
2414
|
+
# Prints a long string, word-wrapping the text to the current width of the
|
2415
|
+
# terminal display. Ideal for printing heredocs.
|
2416
|
+
#
|
2417
|
+
# ==== Parameters
|
2418
|
+
# String
|
2419
|
+
#
|
2420
|
+
# ==== Options
|
2421
|
+
# indent<Integer>:: Indent each line of the printed paragraph by indent value.
|
2422
|
+
def print_wrapped(message, options = T.unsafe(nil)); end
|
2423
|
+
|
2424
|
+
# Say (print) something to the user. If the sentence ends with a whitespace
|
2425
|
+
# or tab character, a new line is not appended (print + flush). Otherwise
|
2426
|
+
# are passed straight to puts (behavior got from Highline).
|
2427
|
+
#
|
2428
|
+
# ==== Example
|
2429
|
+
# say("I know you knew that.")
|
2430
|
+
def say(message = T.unsafe(nil), color = T.unsafe(nil), force_new_line = T.unsafe(nil)); end
|
2431
|
+
|
2432
|
+
# Say (print) an error to the user. If the sentence ends with a whitespace
|
2433
|
+
# or tab character, a new line is not appended (print + flush). Otherwise
|
2434
|
+
# are passed straight to puts (behavior got from Highline).
|
2435
|
+
#
|
2436
|
+
# ==== Example
|
2437
|
+
# say_error("error: something went wrong")
|
2438
|
+
def say_error(message = T.unsafe(nil), color = T.unsafe(nil), force_new_line = T.unsafe(nil)); end
|
2439
|
+
|
2440
|
+
# Say a status with the given color and appends the message. Since this
|
2441
|
+
# method is used frequently by actions, it allows nil or false to be given
|
2442
|
+
# in log_status, avoiding the message from being shown. If a Symbol is
|
2443
|
+
# given in log_status, it's used as the color.
|
2444
|
+
def say_status(status, message, log_status = T.unsafe(nil)); end
|
2445
|
+
|
2446
|
+
# Apply color to the given string with optional bold. Disabled in the
|
2447
|
+
# Thor::Shell::Basic class.
|
2448
|
+
def set_color(string, *_arg1); end
|
2449
|
+
|
2450
|
+
def terminal_width; end
|
2451
|
+
|
2452
|
+
# Make a question the to user and returns true if the user replies "y" or
|
2453
|
+
# "yes".
|
2454
|
+
#
|
2455
|
+
# @return [Boolean]
|
2456
|
+
def yes?(statement, color = T.unsafe(nil)); end
|
2457
|
+
|
2458
|
+
protected
|
2459
|
+
|
2460
|
+
def answer_match(possibilities, answer, case_insensitive); end
|
2461
|
+
def as_unicode; end
|
2462
|
+
def ask_filtered(statement, color, options); end
|
2463
|
+
def ask_simply(statement, color, options); end
|
2464
|
+
|
2465
|
+
# @return [Boolean]
|
2466
|
+
def can_display_colors?; end
|
2467
|
+
|
2468
|
+
# Calculate the dynamic width of the terminal
|
2469
|
+
def dynamic_width; end
|
2470
|
+
|
2471
|
+
def dynamic_width_stty; end
|
2472
|
+
def dynamic_width_tput; end
|
2473
|
+
def file_collision_help; end
|
2474
|
+
def git_merge_tool; end
|
2475
|
+
|
2476
|
+
# @return [Boolean]
|
2477
|
+
def is?(value); end
|
2478
|
+
|
2479
|
+
def lookup_color(color); end
|
2480
|
+
def merge(destination, content); end
|
2481
|
+
def merge_tool; end
|
2482
|
+
def prepare_message(message, *color); end
|
2483
|
+
|
2484
|
+
# @return [Boolean]
|
2485
|
+
def quiet?; end
|
2486
|
+
|
2487
|
+
def show_diff(destination, content); end
|
2488
|
+
def stderr; end
|
2489
|
+
def stdout; end
|
2490
|
+
def truncate(string, width); end
|
2491
|
+
|
2492
|
+
# @return [Boolean]
|
2493
|
+
def unix?; end
|
2494
|
+
end
|
2495
|
+
|
2496
|
+
Thor::Shell::Basic::DEFAULT_TERMINAL_WIDTH = T.let(T.unsafe(nil), Integer)
|
2497
|
+
|
2498
|
+
# Inherit from Thor::Shell::Basic and add set_color behavior. Check
|
2499
|
+
# Thor::Shell::Basic to see all available methods.
|
2500
|
+
class Thor::Shell::Color < ::Thor::Shell::Basic
|
2501
|
+
# Set color by using a string or one of the defined constants. If a third
|
2502
|
+
# option is set to true, it also adds bold to the string. This is based
|
2503
|
+
# on Highline implementation and it automatically appends CLEAR to the end
|
2504
|
+
# of the returned String.
|
2505
|
+
#
|
2506
|
+
# Pass foreground, background and bold options to this method as
|
2507
|
+
# symbols.
|
2508
|
+
#
|
2509
|
+
# Example:
|
2510
|
+
#
|
2511
|
+
# set_color "Hi!", :red, :on_white, :bold
|
2512
|
+
#
|
2513
|
+
# The available colors are:
|
2514
|
+
#
|
2515
|
+
# :bold
|
2516
|
+
# :black
|
2517
|
+
# :red
|
2518
|
+
# :green
|
2519
|
+
# :yellow
|
2520
|
+
# :blue
|
2521
|
+
# :magenta
|
2522
|
+
# :cyan
|
2523
|
+
# :white
|
2524
|
+
# :on_black
|
2525
|
+
# :on_red
|
2526
|
+
# :on_green
|
2527
|
+
# :on_yellow
|
2528
|
+
# :on_blue
|
2529
|
+
# :on_magenta
|
2530
|
+
# :on_cyan
|
2531
|
+
# :on_white
|
2532
|
+
def set_color(string, *colors); end
|
2533
|
+
|
2534
|
+
protected
|
2535
|
+
|
2536
|
+
# @return [Boolean]
|
2537
|
+
def are_colors_disabled?; end
|
2538
|
+
|
2539
|
+
# @return [Boolean]
|
2540
|
+
def are_colors_supported?; end
|
2541
|
+
|
2542
|
+
# @return [Boolean]
|
2543
|
+
def can_display_colors?; end
|
2544
|
+
|
2545
|
+
# Check if Diff::LCS is loaded. If it is, use it to create pretty output
|
2546
|
+
# for diff.
|
2547
|
+
#
|
2548
|
+
# @return [Boolean]
|
2549
|
+
def diff_lcs_loaded?; end
|
2550
|
+
|
2551
|
+
def output_diff_line(diff); end
|
2552
|
+
|
2553
|
+
# Overwrite show_diff to show diff with colors if Diff::LCS is
|
2554
|
+
# available.
|
2555
|
+
def show_diff(destination, content); end
|
2556
|
+
end
|
2557
|
+
|
2558
|
+
# Set the terminal's foreground ANSI color to black.
|
2559
|
+
Thor::Shell::Color::BLACK = T.let(T.unsafe(nil), String)
|
2560
|
+
|
2561
|
+
# Set the terminal's foreground ANSI color to blue.
|
2562
|
+
Thor::Shell::Color::BLUE = T.let(T.unsafe(nil), String)
|
2563
|
+
|
2564
|
+
# The start of an ANSI bold sequence.
|
2565
|
+
Thor::Shell::Color::BOLD = T.let(T.unsafe(nil), String)
|
2566
|
+
|
2567
|
+
# Embed in a String to clear all previous ANSI sequences.
|
2568
|
+
Thor::Shell::Color::CLEAR = T.let(T.unsafe(nil), String)
|
2569
|
+
|
2570
|
+
# Set the terminal's foreground ANSI color to cyan.
|
2571
|
+
Thor::Shell::Color::CYAN = T.let(T.unsafe(nil), String)
|
2572
|
+
|
2573
|
+
# Set the terminal's foreground ANSI color to green.
|
2574
|
+
Thor::Shell::Color::GREEN = T.let(T.unsafe(nil), String)
|
2575
|
+
|
2576
|
+
# Set the terminal's foreground ANSI color to magenta.
|
2577
|
+
Thor::Shell::Color::MAGENTA = T.let(T.unsafe(nil), String)
|
2578
|
+
|
2579
|
+
# Set the terminal's background ANSI color to black.
|
2580
|
+
Thor::Shell::Color::ON_BLACK = T.let(T.unsafe(nil), String)
|
2581
|
+
|
2582
|
+
# Set the terminal's background ANSI color to blue.
|
2583
|
+
Thor::Shell::Color::ON_BLUE = T.let(T.unsafe(nil), String)
|
2584
|
+
|
2585
|
+
# Set the terminal's background ANSI color to cyan.
|
2586
|
+
Thor::Shell::Color::ON_CYAN = T.let(T.unsafe(nil), String)
|
2587
|
+
|
2588
|
+
# Set the terminal's background ANSI color to green.
|
2589
|
+
Thor::Shell::Color::ON_GREEN = T.let(T.unsafe(nil), String)
|
2590
|
+
|
2591
|
+
# Set the terminal's background ANSI color to magenta.
|
2592
|
+
Thor::Shell::Color::ON_MAGENTA = T.let(T.unsafe(nil), String)
|
2593
|
+
|
2594
|
+
# Set the terminal's background ANSI color to red.
|
2595
|
+
Thor::Shell::Color::ON_RED = T.let(T.unsafe(nil), String)
|
2596
|
+
|
2597
|
+
# Set the terminal's background ANSI color to white.
|
2598
|
+
Thor::Shell::Color::ON_WHITE = T.let(T.unsafe(nil), String)
|
2599
|
+
|
2600
|
+
# Set the terminal's background ANSI color to yellow.
|
2601
|
+
Thor::Shell::Color::ON_YELLOW = T.let(T.unsafe(nil), String)
|
2602
|
+
|
2603
|
+
# Set the terminal's foreground ANSI color to red.
|
2604
|
+
Thor::Shell::Color::RED = T.let(T.unsafe(nil), String)
|
2605
|
+
|
2606
|
+
# Set the terminal's foreground ANSI color to white.
|
2607
|
+
Thor::Shell::Color::WHITE = T.let(T.unsafe(nil), String)
|
2608
|
+
|
2609
|
+
# Set the terminal's foreground ANSI color to yellow.
|
2610
|
+
Thor::Shell::Color::YELLOW = T.let(T.unsafe(nil), String)
|
2611
|
+
|
2612
|
+
# Inherit from Thor::Shell::Basic and add set_color behavior. Check
|
2613
|
+
# Thor::Shell::Basic to see all available methods.
|
2614
|
+
class Thor::Shell::HTML < ::Thor::Shell::Basic
|
2615
|
+
# Ask something to the user and receives a response.
|
2616
|
+
#
|
2617
|
+
# ==== Example
|
2618
|
+
# ask("What is your name?")
|
2619
|
+
#
|
2620
|
+
# TODO: Implement #ask for Thor::Shell::HTML
|
2621
|
+
#
|
2622
|
+
# @raise [NotImplementedError]
|
2623
|
+
def ask(statement, color = T.unsafe(nil)); end
|
2624
|
+
|
2625
|
+
# Set color by using a string or one of the defined constants. If a third
|
2626
|
+
# option is set to true, it also adds bold to the string. This is based
|
2627
|
+
# on Highline implementation and it automatically appends CLEAR to the end
|
2628
|
+
# of the returned String.
|
2629
|
+
def set_color(string, *colors); end
|
2630
|
+
|
2631
|
+
protected
|
2632
|
+
|
2633
|
+
# @return [Boolean]
|
2634
|
+
def can_display_colors?; end
|
2635
|
+
|
2636
|
+
# Check if Diff::LCS is loaded. If it is, use it to create pretty output
|
2637
|
+
# for diff.
|
2638
|
+
#
|
2639
|
+
# @return [Boolean]
|
2640
|
+
def diff_lcs_loaded?; end
|
2641
|
+
|
2642
|
+
def output_diff_line(diff); end
|
2643
|
+
|
2644
|
+
# Overwrite show_diff to show diff with colors if Diff::LCS is
|
2645
|
+
# available.
|
2646
|
+
def show_diff(destination, content); end
|
2647
|
+
end
|
2648
|
+
|
2649
|
+
# Set the terminal's foreground HTML color to black.
|
2650
|
+
Thor::Shell::HTML::BLACK = T.let(T.unsafe(nil), String)
|
2651
|
+
|
2652
|
+
# Set the terminal's foreground HTML color to blue.
|
2653
|
+
Thor::Shell::HTML::BLUE = T.let(T.unsafe(nil), String)
|
2654
|
+
|
2655
|
+
# The start of an HTML bold sequence.
|
2656
|
+
Thor::Shell::HTML::BOLD = T.let(T.unsafe(nil), String)
|
2657
|
+
|
2658
|
+
# Set the terminal's foreground HTML color to cyan.
|
2659
|
+
Thor::Shell::HTML::CYAN = T.let(T.unsafe(nil), String)
|
2660
|
+
|
2661
|
+
# Set the terminal's foreground HTML color to green.
|
2662
|
+
Thor::Shell::HTML::GREEN = T.let(T.unsafe(nil), String)
|
2663
|
+
|
2664
|
+
# Set the terminal's foreground HTML color to magenta.
|
2665
|
+
Thor::Shell::HTML::MAGENTA = T.let(T.unsafe(nil), String)
|
2666
|
+
|
2667
|
+
# Set the terminal's background HTML color to black.
|
2668
|
+
Thor::Shell::HTML::ON_BLACK = T.let(T.unsafe(nil), String)
|
2669
|
+
|
2670
|
+
# Set the terminal's background HTML color to blue.
|
2671
|
+
Thor::Shell::HTML::ON_BLUE = T.let(T.unsafe(nil), String)
|
2672
|
+
|
2673
|
+
# Set the terminal's background HTML color to cyan.
|
2674
|
+
Thor::Shell::HTML::ON_CYAN = T.let(T.unsafe(nil), String)
|
2675
|
+
|
2676
|
+
# Set the terminal's background HTML color to green.
|
2677
|
+
Thor::Shell::HTML::ON_GREEN = T.let(T.unsafe(nil), String)
|
2678
|
+
|
2679
|
+
# Set the terminal's background HTML color to magenta.
|
2680
|
+
Thor::Shell::HTML::ON_MAGENTA = T.let(T.unsafe(nil), String)
|
2681
|
+
|
2682
|
+
# Set the terminal's background HTML color to red.
|
2683
|
+
Thor::Shell::HTML::ON_RED = T.let(T.unsafe(nil), String)
|
2684
|
+
|
2685
|
+
# Set the terminal's background HTML color to white.
|
2686
|
+
Thor::Shell::HTML::ON_WHITE = T.let(T.unsafe(nil), String)
|
2687
|
+
|
2688
|
+
# Set the terminal's background HTML color to yellow.
|
2689
|
+
Thor::Shell::HTML::ON_YELLOW = T.let(T.unsafe(nil), String)
|
2690
|
+
|
2691
|
+
# Set the terminal's foreground HTML color to red.
|
2692
|
+
Thor::Shell::HTML::RED = T.let(T.unsafe(nil), String)
|
2693
|
+
|
2694
|
+
# Set the terminal's foreground HTML color to white.
|
2695
|
+
Thor::Shell::HTML::WHITE = T.let(T.unsafe(nil), String)
|
2696
|
+
|
2697
|
+
# Set the terminal's foreground HTML color to yellow.
|
2698
|
+
Thor::Shell::HTML::YELLOW = T.let(T.unsafe(nil), String)
|
2699
|
+
|
2700
|
+
Thor::Shell::SHELL_DELEGATED_METHODS = T.let(T.unsafe(nil), Array)
|
2701
|
+
Thor::TEMPLATE_EXTNAME = T.let(T.unsafe(nil), String)
|
2702
|
+
|
2703
|
+
# Thor methods that should not be overwritten by the user.
|
2704
|
+
Thor::THOR_RESERVED_WORDS = T.let(T.unsafe(nil), Array)
|
2705
|
+
|
2706
|
+
Thor::Task = Thor::Command
|
2707
|
+
|
2708
|
+
# Raised when a command was not found.
|
2709
|
+
class Thor::UndefinedCommandError < ::Thor::Error
|
2710
|
+
include ::DidYouMean::Correctable
|
2711
|
+
|
2712
|
+
# @return [UndefinedCommandError] a new instance of UndefinedCommandError
|
2713
|
+
def initialize(command, all_commands, namespace); end
|
2714
|
+
|
2715
|
+
# Returns the value of attribute all_commands.
|
2716
|
+
def all_commands; end
|
2717
|
+
|
2718
|
+
# Returns the value of attribute command.
|
2719
|
+
def command; end
|
2720
|
+
end
|
2721
|
+
|
2722
|
+
class Thor::UndefinedCommandError::SpellChecker
|
2723
|
+
# @return [SpellChecker] a new instance of SpellChecker
|
2724
|
+
def initialize(error); end
|
2725
|
+
|
2726
|
+
def corrections; end
|
2727
|
+
|
2728
|
+
# Returns the value of attribute error.
|
2729
|
+
def error; end
|
2730
|
+
|
2731
|
+
def spell_checker; end
|
2732
|
+
end
|
2733
|
+
|
2734
|
+
Thor::UndefinedTaskError = Thor::UndefinedCommandError
|
2735
|
+
|
2736
|
+
class Thor::UnknownArgumentError < ::Thor::Error
|
2737
|
+
include ::DidYouMean::Correctable
|
2738
|
+
|
2739
|
+
# @return [UnknownArgumentError] a new instance of UnknownArgumentError
|
2740
|
+
def initialize(switches, unknown); end
|
2741
|
+
|
2742
|
+
# Returns the value of attribute switches.
|
2743
|
+
def switches; end
|
2744
|
+
|
2745
|
+
# Returns the value of attribute unknown.
|
2746
|
+
def unknown; end
|
2747
|
+
end
|
2748
|
+
|
2749
|
+
class Thor::UnknownArgumentError::SpellChecker
|
2750
|
+
# @return [SpellChecker] a new instance of SpellChecker
|
2751
|
+
def initialize(error); end
|
2752
|
+
|
2753
|
+
def corrections; end
|
2754
|
+
|
2755
|
+
# Returns the value of attribute error.
|
2756
|
+
def error; end
|
2757
|
+
|
2758
|
+
def spell_checker; end
|
2759
|
+
end
|
2760
|
+
|
2761
|
+
# This module holds several utilities:
|
2762
|
+
#
|
2763
|
+
# 1) Methods to convert thor namespaces to constants and vice-versa.
|
2764
|
+
#
|
2765
|
+
# Thor::Util.namespace_from_thor_class(Foo::Bar::Baz) #=> "foo:bar:baz"
|
2766
|
+
#
|
2767
|
+
# 2) Loading thor files and sandboxing:
|
2768
|
+
#
|
2769
|
+
# Thor::Util.load_thorfile("~/.thor/foo")
|
2770
|
+
module Thor::Util
|
2771
|
+
class << self
|
2772
|
+
# Receives a string and convert it to camel case. camel_case returns CamelCase.
|
2773
|
+
#
|
2774
|
+
# ==== Parameters
|
2775
|
+
# String
|
2776
|
+
#
|
2777
|
+
# ==== Returns
|
2778
|
+
# String
|
2779
|
+
def camel_case(str); end
|
2780
|
+
|
2781
|
+
# Returns a string that has had any glob characters escaped.
|
2782
|
+
# The glob characters are `* ? { } [ ]`.
|
2783
|
+
#
|
2784
|
+
# ==== Examples
|
2785
|
+
#
|
2786
|
+
# Thor::Util.escape_globs('[apps]') # => '\[apps\]'
|
2787
|
+
#
|
2788
|
+
# ==== Parameters
|
2789
|
+
# String
|
2790
|
+
#
|
2791
|
+
# ==== Returns
|
2792
|
+
# String
|
2793
|
+
def escape_globs(path); end
|
2794
|
+
|
2795
|
+
# Returns a string that has had any HTML characters escaped.
|
2796
|
+
#
|
2797
|
+
# ==== Examples
|
2798
|
+
#
|
2799
|
+
# Thor::Util.escape_html('<div>') # => "<div>"
|
2800
|
+
#
|
2801
|
+
# ==== Parameters
|
2802
|
+
# String
|
2803
|
+
#
|
2804
|
+
# ==== Returns
|
2805
|
+
# String
|
2806
|
+
def escape_html(string); end
|
2807
|
+
|
2808
|
+
# Receives a namespace and search for it in the Thor::Base subclasses.
|
2809
|
+
#
|
2810
|
+
# ==== Parameters
|
2811
|
+
# namespace<String>:: The namespace to search for.
|
2812
|
+
def find_by_namespace(namespace); end
|
2813
|
+
|
2814
|
+
# Receives a namespace and tries to retrieve a Thor or Thor::Group class
|
2815
|
+
# from it. It first searches for a class using the all the given namespace,
|
2816
|
+
# if it's not found, removes the highest entry and searches for the class
|
2817
|
+
# again. If found, returns the highest entry as the class name.
|
2818
|
+
#
|
2819
|
+
# ==== Examples
|
2820
|
+
#
|
2821
|
+
# class Foo::Bar < Thor
|
2822
|
+
# def baz
|
2823
|
+
# end
|
2824
|
+
# end
|
2825
|
+
#
|
2826
|
+
# class Baz::Foo < Thor::Group
|
2827
|
+
# end
|
2828
|
+
#
|
2829
|
+
# Thor::Util.namespace_to_thor_class("foo:bar") #=> Foo::Bar, nil # will invoke default command
|
2830
|
+
# Thor::Util.namespace_to_thor_class("baz:foo") #=> Baz::Foo, nil
|
2831
|
+
# Thor::Util.namespace_to_thor_class("foo:bar:baz") #=> Foo::Bar, "baz"
|
2832
|
+
#
|
2833
|
+
# ==== Parameters
|
2834
|
+
# namespace<String>
|
2835
|
+
def find_class_and_command_by_namespace(namespace, fallback = T.unsafe(nil)); end
|
2836
|
+
|
2837
|
+
# Receives a namespace and tries to retrieve a Thor or Thor::Group class
|
2838
|
+
# from it. It first searches for a class using the all the given namespace,
|
2839
|
+
# if it's not found, removes the highest entry and searches for the class
|
2840
|
+
# again. If found, returns the highest entry as the class name.
|
2841
|
+
#
|
2842
|
+
# ==== Examples
|
2843
|
+
#
|
2844
|
+
# class Foo::Bar < Thor
|
2845
|
+
# def baz
|
2846
|
+
# end
|
2847
|
+
# end
|
2848
|
+
#
|
2849
|
+
# class Baz::Foo < Thor::Group
|
2850
|
+
# end
|
2851
|
+
#
|
2852
|
+
# Thor::Util.namespace_to_thor_class("foo:bar") #=> Foo::Bar, nil # will invoke default command
|
2853
|
+
# Thor::Util.namespace_to_thor_class("baz:foo") #=> Baz::Foo, nil
|
2854
|
+
# Thor::Util.namespace_to_thor_class("foo:bar:baz") #=> Foo::Bar, "baz"
|
2855
|
+
#
|
2856
|
+
# ==== Parameters
|
2857
|
+
# namespace<String>
|
2858
|
+
def find_class_and_task_by_namespace(namespace, fallback = T.unsafe(nil)); end
|
2859
|
+
|
2860
|
+
# Where to look for Thor files.
|
2861
|
+
def globs_for(path); end
|
2862
|
+
|
2863
|
+
# Receives a path and load the thor file in the path. The file is evaluated
|
2864
|
+
# inside the sandbox to avoid namespacing conflicts.
|
2865
|
+
def load_thorfile(path, content = T.unsafe(nil), debug = T.unsafe(nil)); end
|
2866
|
+
|
2867
|
+
# Receives a constant and converts it to a Thor namespace. Since Thor
|
2868
|
+
# commands can be added to a sandbox, this method is also responsible for
|
2869
|
+
# removing the sandbox namespace.
|
2870
|
+
#
|
2871
|
+
# This method should not be used in general because it's used to deal with
|
2872
|
+
# older versions of Thor. On current versions, if you need to get the
|
2873
|
+
# namespace from a class, just call namespace on it.
|
2874
|
+
#
|
2875
|
+
# ==== Parameters
|
2876
|
+
# constant<Object>:: The constant to be converted to the thor path.
|
2877
|
+
#
|
2878
|
+
# ==== Returns
|
2879
|
+
# String:: If we receive Foo::Bar::Baz it returns "foo:bar:baz"
|
2880
|
+
def namespace_from_thor_class(constant); end
|
2881
|
+
|
2882
|
+
# Given the contents, evaluate it inside the sandbox and returns the
|
2883
|
+
# namespaces defined in the sandbox.
|
2884
|
+
#
|
2885
|
+
# ==== Parameters
|
2886
|
+
# contents<String>
|
2887
|
+
#
|
2888
|
+
# ==== Returns
|
2889
|
+
# Array[Object]
|
2890
|
+
def namespaces_in_content(contents, file = T.unsafe(nil)); end
|
2891
|
+
|
2892
|
+
# Return the path to the ruby interpreter taking into account multiple
|
2893
|
+
# installations and windows extensions.
|
2894
|
+
def ruby_command; end
|
2895
|
+
|
2896
|
+
# Receives a string and convert it to snake case. SnakeCase returns snake_case.
|
2897
|
+
#
|
2898
|
+
# ==== Parameters
|
2899
|
+
# String
|
2900
|
+
#
|
2901
|
+
# ==== Returns
|
2902
|
+
# String
|
2903
|
+
def snake_case(str); end
|
2904
|
+
|
2905
|
+
# Returns the thor classes declared inside the given class.
|
2906
|
+
def thor_classes_in(klass); end
|
2907
|
+
|
2908
|
+
# Returns the root where thor files are located, depending on the OS.
|
2909
|
+
def thor_root; end
|
2910
|
+
|
2911
|
+
# Returns the files in the thor root. On Windows thor_root will be something
|
2912
|
+
# like this:
|
2913
|
+
#
|
2914
|
+
# C:\Documents and Settings\james\.thor
|
2915
|
+
#
|
2916
|
+
# If we don't #gsub the \ character, Dir.glob will fail.
|
2917
|
+
def thor_root_glob; end
|
2918
|
+
|
2919
|
+
def user_home; end
|
2920
|
+
end
|
2921
|
+
end
|