ruby-paseto 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +13 -1
  3. data/README.md +55 -50
  4. data/lib/paseto/asn1/ecdsa_signature.rb +2 -2
  5. data/lib/paseto/asymmetric_key.rb +7 -4
  6. data/lib/paseto/configuration/decode_configuration.rb +7 -7
  7. data/lib/paseto/interface/key.rb +5 -2
  8. data/lib/paseto/interface/pbkd.rb +4 -20
  9. data/lib/paseto/interface/pie.rb +5 -26
  10. data/lib/paseto/interface/pke.rb +15 -51
  11. data/lib/paseto/interface/version.rb +30 -117
  12. data/lib/paseto/operations/id/i_dv3.rb +1 -1
  13. data/lib/paseto/operations/id/i_dv4.rb +1 -1
  14. data/lib/paseto/operations/pbkd/p_b_k_dv3.rb +4 -5
  15. data/lib/paseto/operations/pbkd/p_b_k_dv4.rb +3 -4
  16. data/lib/paseto/operations/pbkw.rb +6 -6
  17. data/lib/paseto/operations/pke/p_k_ev3.rb +23 -25
  18. data/lib/paseto/operations/pke/p_k_ev4.rb +33 -34
  19. data/lib/paseto/operations/pke.rb +9 -10
  20. data/lib/paseto/operations/wrap.rb +1 -1
  21. data/lib/paseto/paserk.rb +1 -1
  22. data/lib/paseto/paserk_types.rb +3 -3
  23. data/lib/paseto/protocol/version3.rb +17 -16
  24. data/lib/paseto/protocol/version4.rb +17 -16
  25. data/lib/paseto/symmetric_key.rb +16 -10
  26. data/lib/paseto/token.rb +17 -15
  27. data/lib/paseto/token_types.rb +2 -2
  28. data/lib/paseto/util.rb +2 -3
  29. data/lib/paseto/v3/local.rb +1 -1
  30. data/lib/paseto/v3/public.rb +8 -69
  31. data/lib/paseto/v4/local.rb +3 -3
  32. data/lib/paseto/v4/public.rb +3 -6
  33. data/lib/paseto/validator.rb +1 -1
  34. data/lib/paseto/version.rb +1 -1
  35. data/lib/paseto/versions.rb +2 -2
  36. data/lib/paseto/wrappers/pie/pie_v3.rb +18 -21
  37. data/lib/paseto/wrappers/pie/pie_v4.rb +17 -20
  38. data/lib/paseto/wrappers/pie.rb +3 -17
  39. data/lib/paseto.rb +2 -5
  40. data/paseto.gemspec +5 -17
  41. data/sorbet/rbi/annotations/.gitattributes +1 -0
  42. data/sorbet/rbi/annotations/rainbow.rbi +4 -4
  43. data/sorbet/rbi/gems/.gitattributes +1 -0
  44. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1 -1
  45. data/sorbet/rbi/gems/docile@1.4.0.rbi +1 -1
  46. data/sorbet/rbi/gems/{ffi@1.15.5.rbi → ffi@1.16.3.rbi} +260 -117
  47. data/sorbet/rbi/gems/{oj@3.13.23.rbi → oj@3.16.1.rbi} +28 -37
  48. data/sorbet/rbi/gems/{rake@13.0.6.rbi → rake@13.1.0.rbi} +75 -69
  49. data/sorbet/rbi/gems/rbnacl@7.1.1.rbi +2 -2
  50. data/sorbet/rbi/gems/{rspec-core@3.12.0.rbi → rspec-core@3.12.2.rbi} +31 -113
  51. data/sorbet/rbi/gems/{rspec-expectations@3.12.0.rbi → rspec-expectations@3.12.3.rbi} +204 -194
  52. data/sorbet/rbi/gems/{rspec-mocks@3.12.0.rbi → rspec-mocks@3.12.6.rbi} +225 -215
  53. data/sorbet/rbi/gems/{rspec-support@3.12.0.rbi → rspec-support@3.12.1.rbi} +35 -43
  54. data/sorbet/rbi/gems/rspec@3.12.0.rbi +22 -28
  55. data/sorbet/rbi/gems/simplecov-html@0.12.3.rbi +41 -44
  56. data/sorbet/rbi/gems/{simplecov@0.21.2.rbi → simplecov@0.22.0.rbi} +62 -49
  57. data/sorbet/rbi/gems/simplecov_json_formatter@0.1.4.rbi +232 -2
  58. data/sorbet/rbi/gems/{timecop@0.9.6.rbi → timecop@0.9.8.rbi} +13 -16
  59. data/sorbet/rbi/shims/multi_json.rbi +2 -0
  60. data/sorbet/rbi/shims/openssl.rbi +0 -8
  61. data/sorbet/rbi/todo.rbi +5 -1
  62. data/sorbet/tapioca/config.yml +1 -1
  63. metadata +20 -191
  64. data/sorbet/rbi/gems/ast@2.4.2.rbi +0 -584
  65. data/sorbet/rbi/gems/io-console@0.5.11.rbi +0 -8
  66. data/sorbet/rbi/gems/irb@1.5.1.rbi +0 -342
  67. data/sorbet/rbi/gems/json@2.6.3.rbi +0 -1541
  68. data/sorbet/rbi/gems/multi_json@1.15.0.rbi +0 -267
  69. data/sorbet/rbi/gems/netrc@0.11.0.rbi +0 -158
  70. data/sorbet/rbi/gems/openssl@3.0.1.rbi +0 -1735
  71. data/sorbet/rbi/gems/parallel@1.22.1.rbi +0 -277
  72. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +0 -407
  73. data/sorbet/rbi/gems/regexp_parser@2.6.1.rbi +0 -3481
  74. data/sorbet/rbi/gems/reline@0.3.1.rbi +0 -8
  75. data/sorbet/rbi/gems/rexml@3.2.5.rbi +0 -4717
  76. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +0 -1239
  77. data/sorbet/rbi/gems/thor@1.2.1.rbi +0 -3956
  78. data/sorbet/rbi/gems/unicode-display_width@2.3.0.rbi +0 -48
  79. data/sorbet/rbi/gems/webrick@1.7.0.rbi +0 -2555
  80. data/sorbet/rbi/gems/yard-sorbet@0.7.0.rbi +0 -391
  81. data/sorbet/rbi/gems/yard@0.9.28.rbi +0 -17816
  82. data/sorbet/rbi/gems/zeitwerk@2.6.6.rbi +0 -950
@@ -1,3956 +0,0 @@
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
- # source://thor//lib/thor/command.rb#1
8
- class Thor
9
- include ::Thor::Base
10
- include ::Thor::Invocation
11
- include ::Thor::Shell
12
- extend ::Thor::Base::ClassMethods
13
- extend ::Thor::Invocation::ClassMethods
14
-
15
- # source://thor//lib/thor.rb#505
16
- def help(command = T.unsafe(nil), subcommand = T.unsafe(nil)); end
17
-
18
- class << self
19
- # Extend check unknown options to accept a hash of conditions.
20
- #
21
- # === Parameters
22
- # options<Hash>: A hash containing :only and/or :except keys
23
- #
24
- # source://thor//lib/thor.rb#255
25
- def check_unknown_options!(options = T.unsafe(nil)); end
26
-
27
- # Overwrite check_unknown_options? to take subcommands and options into account.
28
- #
29
- # @return [Boolean]
30
- #
31
- # source://thor//lib/thor.rb#268
32
- def check_unknown_options?(config); end
33
-
34
- # Prints help information for the given command.
35
- #
36
- # ==== Parameters
37
- # shell<Thor::Shell>
38
- # command_name<String>
39
- #
40
- # source://thor//lib/thor.rb#172
41
- def command_help(shell, command_name); end
42
-
43
- # Sets the default command when thor is executed without an explicit command to be called.
44
- #
45
- # ==== Parameters
46
- # meth<Symbol>:: name of the default command
47
- #
48
- # source://thor//lib/thor.rb#21
49
- def default_command(meth = T.unsafe(nil)); end
50
-
51
- # Sets the default command when thor is executed without an explicit command to be called.
52
- #
53
- # ==== Parameters
54
- # meth<Symbol>:: name of the default command
55
- #
56
- # source://thor//lib/thor.rb#21
57
- def default_task(meth = T.unsafe(nil)); end
58
-
59
- # source://thor//lib/thor/base.rb#26
60
- def deprecation_warning(message); end
61
-
62
- # Defines the usage and the description of the next command.
63
- #
64
- # ==== Parameters
65
- # usage<String>
66
- # description<String>
67
- # options<String>
68
- #
69
- # source://thor//lib/thor.rb#54
70
- def desc(usage, description, options = T.unsafe(nil)); end
71
-
72
- # Disable the check for required options for the given commands.
73
- # This is useful if you have a command that does not need the required options
74
- # to work, like help.
75
- #
76
- # ==== Parameters
77
- # Symbol ...:: A list of commands that should be affected.
78
- #
79
- # source://thor//lib/thor.rb#339
80
- def disable_required_check!(*command_names); end
81
-
82
- # @return [Boolean]
83
- #
84
- # source://thor//lib/thor.rb#343
85
- def disable_required_check?(command); end
86
-
87
- # Prints help information for this class.
88
- #
89
- # ==== Parameters
90
- # shell<Thor::Shell>
91
- #
92
- # source://thor//lib/thor.rb#195
93
- def help(shell, subcommand = T.unsafe(nil)); end
94
-
95
- # Defines the long description of the next command.
96
- #
97
- # ==== Parameters
98
- # long description<String>
99
- #
100
- # source://thor//lib/thor.rb#71
101
- def long_desc(long_description, options = T.unsafe(nil)); end
102
-
103
- # Maps an input to a command. If you define:
104
- #
105
- # map "-T" => "list"
106
- #
107
- # Running:
108
- #
109
- # thor -T
110
- #
111
- # Will invoke the list command.
112
- #
113
- # ==== Parameters
114
- # Hash[String|Array => Symbol]:: Maps the string or the strings in the array to the given command.
115
- #
116
- # source://thor//lib/thor.rb#93
117
- def map(mappings = T.unsafe(nil), **kw); end
118
-
119
- # Adds an option to the set of method options. If :for is given as option,
120
- # it allows you to change the options from a previous defined command.
121
- #
122
- # def previous_command
123
- # # magic
124
- # end
125
- #
126
- # method_option :foo => :bar, :for => :previous_command
127
- #
128
- # def next_command
129
- # # magic
130
- # end
131
- #
132
- # ==== Parameters
133
- # name<Symbol>:: The name of the argument.
134
- # options<Hash>:: Described below.
135
- #
136
- # ==== Options
137
- # :desc - Description for the argument.
138
- # :required - If the argument is required or not.
139
- # :default - Default value for this argument. It cannot be required and have default values.
140
- # :aliases - Aliases for this option.
141
- # :type - The type of the argument, can be :string, :hash, :array, :numeric or :boolean.
142
- # :banner - String to show on usage notes.
143
- # :hide - If you want to hide this option from the help.
144
- #
145
- # source://thor//lib/thor.rb#155
146
- def method_option(name, options = T.unsafe(nil)); end
147
-
148
- # Declares the options for the next command to be declared.
149
- #
150
- # ==== Parameters
151
- # Hash[Symbol => Object]:: The hash key is the name of the option and the value
152
- # is the type of the option. Can be :string, :array, :hash, :boolean, :numeric
153
- # or :required (string). If you give a value, the type of the value is used.
154
- #
155
- # source://thor//lib/thor.rb#121
156
- def method_options(options = T.unsafe(nil)); end
157
-
158
- # Adds an option to the set of method options. If :for is given as option,
159
- # it allows you to change the options from a previous defined command.
160
- #
161
- # def previous_command
162
- # # magic
163
- # end
164
- #
165
- # method_option :foo => :bar, :for => :previous_command
166
- #
167
- # def next_command
168
- # # magic
169
- # end
170
- #
171
- # ==== Parameters
172
- # name<Symbol>:: The name of the argument.
173
- # options<Hash>:: Described below.
174
- #
175
- # ==== Options
176
- # :desc - Description for the argument.
177
- # :required - If the argument is required or not.
178
- # :default - Default value for this argument. It cannot be required and have default values.
179
- # :aliases - Aliases for this option.
180
- # :type - The type of the argument, can be :string, :hash, :array, :numeric or :boolean.
181
- # :banner - String to show on usage notes.
182
- # :hide - If you want to hide this option from the help.
183
- #
184
- # source://thor//lib/thor.rb#155
185
- def option(name, options = T.unsafe(nil)); end
186
-
187
- # Declares the options for the next command to be declared.
188
- #
189
- # ==== Parameters
190
- # Hash[Symbol => Object]:: The hash key is the name of the option and the value
191
- # is the type of the option. Can be :string, :array, :hash, :boolean, :numeric
192
- # or :required (string). If you give a value, the type of the value is used.
193
- #
194
- # source://thor//lib/thor.rb#121
195
- def options(options = T.unsafe(nil)); end
196
-
197
- # Allows for custom "Command" package naming.
198
- #
199
- # === Parameters
200
- # name<String>
201
- # options<Hash>
202
- #
203
- # source://thor//lib/thor.rb#12
204
- def package_name(name, _ = T.unsafe(nil)); end
205
-
206
- # Returns commands ready to be printed.
207
- #
208
- # source://thor//lib/thor.rb#214
209
- def printable_commands(all = T.unsafe(nil), subcommand = T.unsafe(nil)); end
210
-
211
- # Returns commands ready to be printed.
212
- #
213
- # source://thor//lib/thor.rb#214
214
- def printable_tasks(all = T.unsafe(nil), subcommand = T.unsafe(nil)); end
215
-
216
- # Registers another Thor subclass as a command.
217
- #
218
- # ==== Parameters
219
- # klass<Class>:: Thor subclass to register
220
- # command<String>:: Subcommand name to use
221
- # usage<String>:: Short usage for the subcommand
222
- # description<String>:: Description for the subcommand
223
- #
224
- # source://thor//lib/thor.rb#37
225
- def register(klass, subcommand_name, usage, description, options = T.unsafe(nil)); end
226
-
227
- # Stop parsing of options as soon as an unknown option or a regular
228
- # argument is encountered. All remaining arguments are passed to the command.
229
- # This is useful if you have a command that can receive arbitrary additional
230
- # options, and where those additional options should not be handled by
231
- # Thor.
232
- #
233
- # ==== Example
234
- #
235
- # To better understand how this is useful, let's consider a command that calls
236
- # an external command. A user may want to pass arbitrary options and
237
- # arguments to that command. The command itself also accepts some options,
238
- # which should be handled by Thor.
239
- #
240
- # class_option "verbose", :type => :boolean
241
- # stop_on_unknown_option! :exec
242
- # check_unknown_options! :except => :exec
243
- #
244
- # desc "exec", "Run a shell command"
245
- # def exec(*args)
246
- # puts "diagnostic output" if options[:verbose]
247
- # Kernel.exec(*args)
248
- # end
249
- #
250
- # Here +exec+ can be called with +--verbose+ to get diagnostic output,
251
- # e.g.:
252
- #
253
- # $ thor exec --verbose echo foo
254
- # diagnostic output
255
- # foo
256
- #
257
- # But if +--verbose+ is given after +echo+, it is passed to +echo+ instead:
258
- #
259
- # $ thor exec echo --verbose foo
260
- # --verbose foo
261
- #
262
- # ==== Parameters
263
- # Symbol ...:: A list of commands that should be affected.
264
- #
265
- # source://thor//lib/thor.rb#325
266
- def stop_on_unknown_option!(*command_names); end
267
-
268
- # @return [Boolean]
269
- #
270
- # source://thor//lib/thor.rb#329
271
- def stop_on_unknown_option?(command); end
272
-
273
- # source://thor//lib/thor.rb#234
274
- def subcommand(subcommand, subcommand_class); end
275
-
276
- # source://thor//lib/thor.rb#230
277
- def subcommand_classes; end
278
-
279
- # source://thor//lib/thor.rb#225
280
- def subcommands; end
281
-
282
- # source://thor//lib/thor.rb#234
283
- def subtask(subcommand, subcommand_class); end
284
-
285
- # source://thor//lib/thor.rb#225
286
- def subtasks; end
287
-
288
- # Prints help information for the given command.
289
- #
290
- # ==== Parameters
291
- # shell<Thor::Shell>
292
- # command_name<String>
293
- #
294
- # source://thor//lib/thor.rb#172
295
- def task_help(shell, command_name); end
296
-
297
- protected
298
-
299
- # The banner for this class. You can customize it if you are invoking the
300
- # thor class by another ways which is not the Thor::Runner. It receives
301
- # the command that is going to be invoked and a boolean which indicates if
302
- # the namespace should be displayed as arguments.
303
- #
304
- # source://thor//lib/thor.rb#400
305
- def banner(command, namespace = T.unsafe(nil), subcommand = T.unsafe(nil)); end
306
-
307
- # source://thor//lib/thor.rb#406
308
- def baseclass; end
309
-
310
- # source://thor//lib/thor.rb#414
311
- def create_command(meth); end
312
-
313
- # source://thor//lib/thor.rb#414
314
- def create_task(meth); end
315
-
316
- # help command has the required check disabled by default.
317
- #
318
- # source://thor//lib/thor.rb#354
319
- def disable_required_check; end
320
-
321
- # The method responsible for dispatching given the args.
322
- #
323
- # @yield [instance]
324
- #
325
- # source://thor//lib/thor.rb#359
326
- def dispatch(meth, given_args, given_opts, config); end
327
-
328
- # source://thor//lib/thor.rb#410
329
- def dynamic_command_class; end
330
-
331
- # this is the logic that takes the command name passed in by the user
332
- # and determines whether it is an unambiguous substrings of a command or
333
- # alias name.
334
- #
335
- # source://thor//lib/thor.rb#476
336
- def find_command_possibilities(meth); end
337
-
338
- # this is the logic that takes the command name passed in by the user
339
- # and determines whether it is an unambiguous substrings of a command or
340
- # alias name.
341
- #
342
- # source://thor//lib/thor.rb#476
343
- def find_task_possibilities(meth); end
344
-
345
- # source://thor//lib/thor.rb#436
346
- def initialize_added; end
347
-
348
- # receives a (possibly nil) command name and returns a name that is in
349
- # the commands hash. In addition to normalizing aliases, this logic
350
- # will determine if a shortened command is an unambiguous substring of
351
- # a command or alias.
352
- #
353
- # +normalize_command_name+ also converts names like +animal-prison+
354
- # into +animal_prison+.
355
- #
356
- # @raise [AmbiguousTaskError]
357
- #
358
- # source://thor//lib/thor.rb#455
359
- def normalize_command_name(meth); end
360
-
361
- # receives a (possibly nil) command name and returns a name that is in
362
- # the commands hash. In addition to normalizing aliases, this logic
363
- # will determine if a shortened command is an unambiguous substring of
364
- # a command or alias.
365
- #
366
- # +normalize_command_name+ also converts names like +animal-prison+
367
- # into +animal_prison+.
368
- #
369
- # @raise [AmbiguousTaskError]
370
- #
371
- # source://thor//lib/thor.rb#455
372
- def normalize_task_name(meth); end
373
-
374
- # Retrieve the command name from given args.
375
- #
376
- # source://thor//lib/thor.rb#442
377
- def retrieve_command_name(args); end
378
-
379
- # Retrieve the command name from given args.
380
- #
381
- # source://thor//lib/thor.rb#442
382
- def retrieve_task_name(args); end
383
-
384
- # source://thor//lib/thor.rb#349
385
- def stop_on_unknown_option; end
386
-
387
- # source://thor//lib/thor.rb#491
388
- def subcommand_help(cmd); end
389
-
390
- # source://thor//lib/thor.rb#491
391
- def subtask_help(cmd); end
392
- end
393
- end
394
-
395
- # source://thor//lib/thor/actions/empty_directory.rb#2
396
- module Thor::Actions
397
- mixes_in_class_methods ::Thor::Actions::ClassMethods
398
-
399
- # Extends initializer to add more configuration options.
400
- #
401
- # ==== Configuration
402
- # behavior<Symbol>:: The actions default behavior. Can be :invoke or :revoke.
403
- # It also accepts :force, :skip and :pretend to set the behavior
404
- # and the respective option.
405
- #
406
- # destination_root<String>:: The root directory needed for some actions.
407
- #
408
- # source://thor//lib/thor/actions.rb#72
409
- def initialize(args = T.unsafe(nil), options = T.unsafe(nil), config = T.unsafe(nil)); end
410
-
411
- # Wraps an action object and call it accordingly to the thor class behavior.
412
- #
413
- # source://thor//lib/thor/actions.rb#89
414
- def action(instance); end
415
-
416
- # Create a new file relative to the destination root with the given data,
417
- # which is the return value of a block or a data string.
418
- #
419
- # ==== Parameters
420
- # destination<String>:: the relative path to the destination root.
421
- # data<String|NilClass>:: the data to append to the file.
422
- # config<Hash>:: give :verbose => false to not log the status.
423
- #
424
- # ==== Examples
425
- #
426
- # create_file "lib/fun_party.rb" do
427
- # hostname = ask("What is the virtual hostname I should use?")
428
- # "vhost.name = #{hostname}"
429
- # end
430
- #
431
- # create_file "config/apache.conf", "your apache config"
432
- #
433
- # source://thor//lib/thor/actions/create_file.rb#22
434
- def add_file(destination, *args, &block); end
435
-
436
- # Create a new file relative to the destination root from the given source.
437
- #
438
- # ==== Parameters
439
- # destination<String>:: the relative path to the destination root.
440
- # source<String|NilClass>:: the relative path to the source root.
441
- # config<Hash>:: give :verbose => false to not log the status.
442
- # :: give :symbolic => false for hard link.
443
- #
444
- # ==== Examples
445
- #
446
- # create_link "config/apache.conf", "/etc/apache.conf"
447
- #
448
- # source://thor//lib/thor/actions/create_link.rb#17
449
- def add_link(destination, *args); end
450
-
451
- # Append text to a file. Since it depends on insert_into_file, it's reversible.
452
- #
453
- # ==== Parameters
454
- # path<String>:: path of the file to be changed
455
- # data<String>:: the data to append to the file, can be also given as a block.
456
- # config<Hash>:: give :verbose => false to not log the status.
457
- #
458
- # ==== Example
459
- #
460
- # append_to_file 'config/environments/test.rb', 'config.gem "rspec"'
461
- #
462
- # append_to_file 'config/environments/test.rb' do
463
- # 'config.gem "rspec"'
464
- # end
465
- #
466
- # source://thor//lib/thor/actions/file_manipulation.rb#195
467
- def append_file(path, *args, &block); end
468
-
469
- # Append text to a file. Since it depends on insert_into_file, it's reversible.
470
- #
471
- # ==== Parameters
472
- # path<String>:: path of the file to be changed
473
- # data<String>:: the data to append to the file, can be also given as a block.
474
- # config<Hash>:: give :verbose => false to not log the status.
475
- #
476
- # ==== Example
477
- #
478
- # append_to_file 'config/environments/test.rb', 'config.gem "rspec"'
479
- #
480
- # append_to_file 'config/environments/test.rb' do
481
- # 'config.gem "rspec"'
482
- # end
483
- #
484
- # source://thor//lib/thor/actions/file_manipulation.rb#195
485
- def append_to_file(path, *args, &block); end
486
-
487
- # Loads an external file and execute it in the instance binding.
488
- #
489
- # ==== Parameters
490
- # path<String>:: The path to the file to execute. Can be a web address or
491
- # a relative path from the source root.
492
- #
493
- # ==== Examples
494
- #
495
- # apply "http://gist.github.com/103208"
496
- #
497
- # apply "recipes/jquery.rb"
498
- #
499
- # source://thor//lib/thor/actions.rb#216
500
- def apply(path, config = T.unsafe(nil)); end
501
-
502
- # Returns the value of attribute behavior.
503
- #
504
- # source://thor//lib/thor/actions.rb#10
505
- def behavior; end
506
-
507
- # Sets the attribute behavior
508
- #
509
- # @param value the value to set the attribute behavior to.
510
- #
511
- # source://thor//lib/thor/actions.rb#10
512
- def behavior=(_arg0); end
513
-
514
- # Changes the mode of the given file or directory.
515
- #
516
- # ==== Parameters
517
- # mode<Integer>:: the file mode
518
- # path<String>:: the name of the file to change mode
519
- # config<Hash>:: give :verbose => false to not log the status.
520
- #
521
- # ==== Example
522
- #
523
- # chmod "script/server", 0755
524
- #
525
- # source://thor//lib/thor/actions/file_manipulation.rb#148
526
- def chmod(path, mode, config = T.unsafe(nil)); end
527
-
528
- # Comment all lines matching a given regex. It will leave the space
529
- # which existed before the beginning of the line in tact and will insert
530
- # a single space after the comment hash.
531
- #
532
- # ==== Parameters
533
- # path<String>:: path of the file to be changed
534
- # flag<Regexp|String>:: the regexp or string used to decide which lines to comment
535
- # config<Hash>:: give :verbose => false to not log the status.
536
- #
537
- # ==== Example
538
- #
539
- # comment_lines 'config/initializers/session_store.rb', /cookie_store/
540
- #
541
- # source://thor//lib/thor/actions/file_manipulation.rb#312
542
- def comment_lines(path, flag, *args); end
543
-
544
- # ==== Examples
545
- #
546
- # copy_file "README", "doc/README"
547
- #
548
- # copy_file "doc/README"
549
- #
550
- # source://thor//lib/thor/actions/file_manipulation.rb#21
551
- def copy_file(source, *args, &block); end
552
-
553
- # Create a new file relative to the destination root with the given data,
554
- # which is the return value of a block or a data string.
555
- #
556
- # ==== Parameters
557
- # destination<String>:: the relative path to the destination root.
558
- # data<String|NilClass>:: the data to append to the file.
559
- # config<Hash>:: give :verbose => false to not log the status.
560
- #
561
- # ==== Examples
562
- #
563
- # create_file "lib/fun_party.rb" do
564
- # hostname = ask("What is the virtual hostname I should use?")
565
- # "vhost.name = #{hostname}"
566
- # end
567
- #
568
- # create_file "config/apache.conf", "your apache config"
569
- #
570
- # source://thor//lib/thor/actions/create_file.rb#22
571
- def create_file(destination, *args, &block); end
572
-
573
- # Create a new file relative to the destination root from the given source.
574
- #
575
- # ==== Parameters
576
- # destination<String>:: the relative path to the destination root.
577
- # source<String|NilClass>:: the relative path to the source root.
578
- # config<Hash>:: give :verbose => false to not log the status.
579
- # :: give :symbolic => false for hard link.
580
- #
581
- # ==== Examples
582
- #
583
- # create_link "config/apache.conf", "/etc/apache.conf"
584
- #
585
- # source://thor//lib/thor/actions/create_link.rb#17
586
- def create_link(destination, *args); end
587
-
588
- # Returns the root for this thor class (also aliased as destination root).
589
- #
590
- # source://thor//lib/thor/actions.rb#99
591
- def destination_root; end
592
-
593
- # Sets the root for this thor class. Relatives path are added to the
594
- # directory where the script was invoked and expanded.
595
- #
596
- # source://thor//lib/thor/actions.rb#106
597
- def destination_root=(root); end
598
-
599
- # Copies recursively the files from source directory to root directory.
600
- # If any of the files finishes with .tt, it's considered to be a template
601
- # and is placed in the destination without the extension .tt. If any
602
- # empty directory is found, it's copied and all .empty_directory files are
603
- # ignored. If any file name is wrapped within % signs, the text within
604
- # the % signs will be executed as a method and replaced with the returned
605
- # value. Let's suppose a doc directory with the following files:
606
- #
607
- # doc/
608
- # components/.empty_directory
609
- # README
610
- # rdoc.rb.tt
611
- # %app_name%.rb
612
- #
613
- # When invoked as:
614
- #
615
- # directory "doc"
616
- #
617
- # It will create a doc directory in the destination with the following
618
- # files (assuming that the `app_name` method returns the value "blog"):
619
- #
620
- # doc/
621
- # components/
622
- # README
623
- # rdoc.rb
624
- # blog.rb
625
- #
626
- # <b>Encoded path note:</b> Since Thor internals use Object#respond_to? to check if it can
627
- # expand %something%, this `something` should be a public method in the class calling
628
- # #directory. If a method is private, Thor stack raises PrivateMethodEncodedError.
629
- #
630
- # ==== Parameters
631
- # source<String>:: the relative path to the source root.
632
- # destination<String>:: the relative path to the destination root.
633
- # config<Hash>:: give :verbose => false to not log the status.
634
- # If :recursive => false, does not look for paths recursively.
635
- # If :mode => :preserve, preserve the file mode from the source.
636
- # If :exclude_pattern => /regexp/, prevents copying files that match that regexp.
637
- #
638
- # ==== Examples
639
- #
640
- # directory "doc"
641
- # directory "doc", "docs", :recursive => false
642
- #
643
- # source://thor//lib/thor/actions/directory.rb#49
644
- def directory(source, *args, &block); end
645
-
646
- # Creates an empty directory.
647
- #
648
- # ==== Parameters
649
- # destination<String>:: the relative path to the destination root.
650
- # config<Hash>:: give :verbose => false to not log the status.
651
- #
652
- # ==== Examples
653
- #
654
- # empty_directory "doc"
655
- #
656
- # source://thor//lib/thor/actions/empty_directory.rb#13
657
- def empty_directory(destination, config = T.unsafe(nil)); end
658
-
659
- # Receives a file or directory and search for it in the source paths.
660
- #
661
- # @raise [Error]
662
- #
663
- # source://thor//lib/thor/actions.rb#133
664
- def find_in_source_paths(file); end
665
-
666
- # Gets the content at the given address and places it at the given relative
667
- # destination. If a block is given instead of destination, the content of
668
- # the url is yielded and used as location.
669
- #
670
- # +get+ relies on open-uri, so passing application user input would provide
671
- # a command injection attack vector.
672
- #
673
- # ==== Parameters
674
- # source<String>:: the address of the given content.
675
- # destination<String>:: the relative path to the destination root.
676
- # config<Hash>:: give :verbose => false to not log the status.
677
- #
678
- # ==== Examples
679
- #
680
- # get "http://gist.github.com/103208", "doc/README"
681
- #
682
- # get "http://gist.github.com/103208" do |content|
683
- # content.split("\n").first
684
- # end
685
- #
686
- # source://thor//lib/thor/actions/file_manipulation.rb#79
687
- def get(source, *args, &block); end
688
-
689
- # Run a regular expression replacement on a file.
690
- #
691
- # ==== Parameters
692
- # path<String>:: path of the file to be changed
693
- # flag<Regexp|String>:: the regexp or string to be replaced
694
- # replacement<String>:: the replacement, can be also given as a block
695
- # config<Hash>:: give :verbose => false to not log the status, and
696
- # :force => true, to force the replacement regardles of runner behavior.
697
- #
698
- # ==== Example
699
- #
700
- # gsub_file 'app/controllers/application_controller.rb', /#\s*(filter_parameter_logging :password)/, '\1'
701
- #
702
- # gsub_file 'README', /rake/, :green do |match|
703
- # match << " no more. Use thor!"
704
- # end
705
- #
706
- # source://thor//lib/thor/actions/file_manipulation.rb#265
707
- def gsub_file(path, flag, *args, &block); end
708
-
709
- # Goes to the root and execute the given block.
710
- #
711
- # source://thor//lib/thor/actions.rb#200
712
- def in_root; end
713
-
714
- # Injects text right after the class definition. Since it depends on
715
- # insert_into_file, it's reversible.
716
- #
717
- # ==== Parameters
718
- # path<String>:: path of the file to be changed
719
- # klass<String|Class>:: the class to be manipulated
720
- # data<String>:: the data to append to the class, can be also given as a block.
721
- # config<Hash>:: give :verbose => false to not log the status.
722
- #
723
- # ==== Examples
724
- #
725
- # inject_into_class "app/controllers/application_controller.rb", "ApplicationController", " filter_parameter :password\n"
726
- #
727
- # inject_into_class "app/controllers/application_controller.rb", "ApplicationController" do
728
- # " filter_parameter :password\n"
729
- # end
730
- #
731
- # source://thor//lib/thor/actions/file_manipulation.rb#219
732
- def inject_into_class(path, klass, *args, &block); end
733
-
734
- # source://thor//lib/thor/actions/inject_into_file.rb#26
735
- def inject_into_file(destination, *args, &block); end
736
-
737
- # Injects text right after the module definition. Since it depends on
738
- # insert_into_file, it's reversible.
739
- #
740
- # ==== Parameters
741
- # path<String>:: path of the file to be changed
742
- # module_name<String|Class>:: the module to be manipulated
743
- # data<String>:: the data to append to the class, can be also given as a block.
744
- # config<Hash>:: give :verbose => false to not log the status.
745
- #
746
- # ==== Examples
747
- #
748
- # inject_into_module "app/helpers/application_helper.rb", "ApplicationHelper", " def help; 'help'; end\n"
749
- #
750
- # inject_into_module "app/helpers/application_helper.rb", "ApplicationHelper" do
751
- # " def help; 'help'; end\n"
752
- # end
753
- #
754
- # source://thor//lib/thor/actions/file_manipulation.rb#242
755
- def inject_into_module(path, module_name, *args, &block); end
756
-
757
- # source://thor//lib/thor/actions/inject_into_file.rb#26
758
- def insert_into_file(destination, *args, &block); end
759
-
760
- # Do something in the root or on a provided subfolder. If a relative path
761
- # is given it's referenced from the current root. The full path is yielded
762
- # to the block you provide. The path is set back to the previous path when
763
- # the method exits.
764
- #
765
- # Returns the value yielded by the block.
766
- #
767
- # ==== Parameters
768
- # dir<String>:: the directory to move to.
769
- # config<Hash>:: give :verbose => true to log and use padding.
770
- #
771
- # source://thor//lib/thor/actions.rb#170
772
- def inside(dir = T.unsafe(nil), config = T.unsafe(nil), &block); end
773
-
774
- # Links the file from the relative source to the relative destination. If
775
- # the destination is not given it's assumed to be equal to the source.
776
- #
777
- # ==== Parameters
778
- # source<String>:: the relative path to the source root.
779
- # destination<String>:: the relative path to the destination root.
780
- # config<Hash>:: give :verbose => false to not log the status.
781
- #
782
- # ==== Examples
783
- #
784
- # link_file "README", "doc/README"
785
- #
786
- # link_file "doc/README"
787
- #
788
- # source://thor//lib/thor/actions/file_manipulation.rb#51
789
- def link_file(source, *args); end
790
-
791
- # Prepend text to a file. Since it depends on insert_into_file, it's reversible.
792
- #
793
- # ==== Parameters
794
- # path<String>:: path of the file to be changed
795
- # data<String>:: the data to prepend to the file, can be also given as a block.
796
- # config<Hash>:: give :verbose => false to not log the status.
797
- #
798
- # ==== Example
799
- #
800
- # prepend_to_file 'config/environments/test.rb', 'config.gem "rspec"'
801
- #
802
- # prepend_to_file 'config/environments/test.rb' do
803
- # 'config.gem "rspec"'
804
- # end
805
- #
806
- # source://thor//lib/thor/actions/file_manipulation.rb#173
807
- def prepend_file(path, *args, &block); end
808
-
809
- # Prepend text to a file. Since it depends on insert_into_file, it's reversible.
810
- #
811
- # ==== Parameters
812
- # path<String>:: path of the file to be changed
813
- # data<String>:: the data to prepend to the file, can be also given as a block.
814
- # config<Hash>:: give :verbose => false to not log the status.
815
- #
816
- # ==== Example
817
- #
818
- # prepend_to_file 'config/environments/test.rb', 'config.gem "rspec"'
819
- #
820
- # prepend_to_file 'config/environments/test.rb' do
821
- # 'config.gem "rspec"'
822
- # end
823
- #
824
- # source://thor//lib/thor/actions/file_manipulation.rb#173
825
- def prepend_to_file(path, *args, &block); end
826
-
827
- # Returns the given path relative to the absolute root (ie, root where
828
- # the script started).
829
- #
830
- # source://thor//lib/thor/actions.rb#114
831
- def relative_to_original_destination_root(path, remove_dot = T.unsafe(nil)); end
832
-
833
- # Removes a file at the given location.
834
- #
835
- # ==== Parameters
836
- # path<String>:: path of the file to be changed
837
- # config<Hash>:: give :verbose => false to not log the status.
838
- #
839
- # ==== Example
840
- #
841
- # remove_file 'README'
842
- # remove_file 'app/controllers/application_controller.rb'
843
- #
844
- # source://thor//lib/thor/actions/file_manipulation.rb#329
845
- def remove_dir(path, config = T.unsafe(nil)); end
846
-
847
- # Removes a file at the given location.
848
- #
849
- # ==== Parameters
850
- # path<String>:: path of the file to be changed
851
- # config<Hash>:: give :verbose => false to not log the status.
852
- #
853
- # ==== Example
854
- #
855
- # remove_file 'README'
856
- # remove_file 'app/controllers/application_controller.rb'
857
- #
858
- # source://thor//lib/thor/actions/file_manipulation.rb#329
859
- def remove_file(path, config = T.unsafe(nil)); end
860
-
861
- # Executes a command returning the contents of the command.
862
- #
863
- # ==== Parameters
864
- # command<String>:: the command to be executed.
865
- # config<Hash>:: give :verbose => false to not log the status, :capture => true to hide to output. Specify :with
866
- # to append an executable to command execution.
867
- #
868
- # ==== Example
869
- #
870
- # inside('vendor') do
871
- # run('ln -s ~/edge rails')
872
- # end
873
- #
874
- # source://thor//lib/thor/actions.rb#248
875
- def run(command, config = T.unsafe(nil)); end
876
-
877
- # Executes a ruby script (taking into account WIN32 platform quirks).
878
- #
879
- # ==== Parameters
880
- # command<String>:: the command to be executed.
881
- # config<Hash>:: give :verbose => false to not log the status.
882
- #
883
- # source://thor//lib/thor/actions.rb#285
884
- def run_ruby_script(command, config = T.unsafe(nil)); end
885
-
886
- # Holds source paths in instance so they can be manipulated.
887
- #
888
- # source://thor//lib/thor/actions.rb#127
889
- def source_paths; end
890
-
891
- # Gets an ERB template at the relative source, executes it and makes a copy
892
- # at the relative destination. If the destination is not given it's assumed
893
- # to be equal to the source removing .tt from the filename.
894
- #
895
- # ==== Parameters
896
- # source<String>:: the relative path to the source root.
897
- # destination<String>:: the relative path to the destination root.
898
- # config<Hash>:: give :verbose => false to not log the status.
899
- #
900
- # ==== Examples
901
- #
902
- # template "README", "doc/README"
903
- #
904
- # template "doc/README"
905
- #
906
- # source://thor//lib/thor/actions/file_manipulation.rb#115
907
- def template(source, *args, &block); end
908
-
909
- # Run a thor command. A hash of options can be given and it's converted to
910
- # switches.
911
- #
912
- # ==== Parameters
913
- # command<String>:: the command to be invoked
914
- # args<Array>:: arguments to the command
915
- # config<Hash>:: give :verbose => false to not log the status, :capture => true to hide to output.
916
- # Other options are given as parameter to Thor.
917
- #
918
- #
919
- # ==== Examples
920
- #
921
- # thor :install, "http://gist.github.com/103208"
922
- # #=> thor install http://gist.github.com/103208
923
- #
924
- # thor :list, :all => true, :substring => 'rails'
925
- # #=> thor list --all --substring=rails
926
- #
927
- # source://thor//lib/thor/actions.rb#308
928
- def thor(command, *args); end
929
-
930
- # Uncomment all lines matching a given regex. It will leave the space
931
- # which existed before the comment hash in tact but will remove any spacing
932
- # between the comment hash and the beginning of the line.
933
- #
934
- # ==== Parameters
935
- # path<String>:: path of the file to be changed
936
- # flag<Regexp|String>:: the regexp or string used to decide which lines to uncomment
937
- # config<Hash>:: give :verbose => false to not log the status.
938
- #
939
- # ==== Example
940
- #
941
- # uncomment_lines 'config/initializers/session_store.rb', /active_record/
942
- #
943
- # source://thor//lib/thor/actions/file_manipulation.rb#293
944
- def uncomment_lines(path, flag, *args); end
945
-
946
- protected
947
-
948
- # source://thor//lib/thor/actions.rb#329
949
- def _cleanup_options_and_set(options, key); end
950
-
951
- # Allow current root to be shared between invocations.
952
- #
953
- # source://thor//lib/thor/actions.rb#325
954
- def _shared_configuration; end
955
-
956
- private
957
-
958
- # source://thor//lib/thor/actions/file_manipulation.rb#350
959
- def capture(*args); end
960
-
961
- # source://thor//lib/thor/actions/file_manipulation.rb#346
962
- def concat(string); end
963
-
964
- # Returns the value of attribute output_buffer.
965
- #
966
- # source://thor//lib/thor/actions/file_manipulation.rb#341
967
- def output_buffer; end
968
-
969
- # Sets the attribute output_buffer
970
- #
971
- # @param value the value to set the attribute output_buffer to.
972
- #
973
- # source://thor//lib/thor/actions/file_manipulation.rb#341
974
- def output_buffer=(_arg0); end
975
-
976
- # source://thor//lib/thor/actions/file_manipulation.rb#354
977
- def with_output_buffer(buf = T.unsafe(nil)); end
978
-
979
- class << self
980
- # source://thor//lib/thor/actions.rb#12
981
- def included(base); end
982
- end
983
- end
984
-
985
- # Thor::Actions#capture depends on what kind of buffer is used in ERB.
986
- # Thus CapturableERB fixes ERB to use String buffer.
987
- #
988
- # source://thor//lib/thor/actions/file_manipulation.rb#366
989
- class Thor::Actions::CapturableERB < ::ERB
990
- # source://thor//lib/thor/actions/file_manipulation.rb#367
991
- def set_eoutvar(compiler, eoutvar = T.unsafe(nil)); end
992
- end
993
-
994
- # source://thor//lib/thor/actions.rb#17
995
- module Thor::Actions::ClassMethods
996
- # Add runtime options that help actions execution.
997
- #
998
- # source://thor//lib/thor/actions.rb#48
999
- def add_runtime_options!; end
1000
-
1001
- # Hold source paths for one Thor instance. source_paths_for_search is the
1002
- # method responsible to gather source_paths from this current class,
1003
- # inherited paths and the source root.
1004
- #
1005
- # source://thor//lib/thor/actions.rb#22
1006
- def source_paths; end
1007
-
1008
- # Returns the source paths in the following order:
1009
- #
1010
- # 1) This class source paths
1011
- # 2) Source root
1012
- # 3) Parents source paths
1013
- #
1014
- # source://thor//lib/thor/actions.rb#38
1015
- def source_paths_for_search; end
1016
-
1017
- # Stores and return the source root for this class
1018
- #
1019
- # source://thor//lib/thor/actions.rb#27
1020
- def source_root(path = T.unsafe(nil)); end
1021
- end
1022
-
1023
- # CreateFile is a subset of Template, which instead of rendering a file with
1024
- # ERB, it gets the content from the user.
1025
- #
1026
- # source://thor//lib/thor/actions/create_file.rb#32
1027
- class Thor::Actions::CreateFile < ::Thor::Actions::EmptyDirectory
1028
- # @return [CreateFile] a new instance of CreateFile
1029
- #
1030
- # source://thor//lib/thor/actions/create_file.rb#35
1031
- def initialize(base, destination, data, config = T.unsafe(nil)); end
1032
-
1033
- # source://thor//lib/thor/actions/create_file.rb#33
1034
- def data; end
1035
-
1036
- # Checks if the content of the file at the destination is identical to the rendered result.
1037
- #
1038
- # ==== Returns
1039
- # Boolean:: true if it is identical, false otherwise.
1040
- #
1041
- # @return [Boolean]
1042
- #
1043
- # source://thor//lib/thor/actions/create_file.rb#45
1044
- def identical?; end
1045
-
1046
- # source://thor//lib/thor/actions/create_file.rb#59
1047
- def invoke!; end
1048
-
1049
- # Holds the content to be added to the file.
1050
- #
1051
- # source://thor//lib/thor/actions/create_file.rb#51
1052
- def render; end
1053
-
1054
- protected
1055
-
1056
- # Shows the file collision menu to the user and gets the result.
1057
- #
1058
- # @return [Boolean]
1059
- #
1060
- # source://thor//lib/thor/actions/create_file.rb#99
1061
- def force_on_collision?; end
1062
-
1063
- # If force is true, run the action, otherwise check if it's not being
1064
- # skipped. If both are false, show the file_collision menu, if the menu
1065
- # returns true, force it, otherwise skip.
1066
- #
1067
- # source://thor//lib/thor/actions/create_file.rb#85
1068
- def force_or_skip_or_conflict(force, skip, &block); end
1069
-
1070
- # Now on conflict we check if the file is identical or not.
1071
- #
1072
- # source://thor//lib/thor/actions/create_file.rb#72
1073
- def on_conflict_behavior(&block); end
1074
- end
1075
-
1076
- # CreateLink is a subset of CreateFile, which instead of taking a block of
1077
- # data, just takes a source string from the user.
1078
- #
1079
- # source://thor//lib/thor/actions/create_link.rb#27
1080
- class Thor::Actions::CreateLink < ::Thor::Actions::CreateFile
1081
- # source://thor//lib/thor/actions/create_link.rb#28
1082
- def data; end
1083
-
1084
- # @return [Boolean]
1085
- #
1086
- # source://thor//lib/thor/actions/create_link.rb#56
1087
- def exists?; end
1088
-
1089
- # Checks if the content of the file at the destination is identical to the rendered result.
1090
- #
1091
- # ==== Returns
1092
- # Boolean:: true if it is identical, false otherwise.
1093
- #
1094
- # @return [Boolean]
1095
- #
1096
- # source://thor//lib/thor/actions/create_link.rb#35
1097
- def identical?; end
1098
-
1099
- # source://thor//lib/thor/actions/create_link.rb#40
1100
- def invoke!; end
1101
- end
1102
-
1103
- # source://thor//lib/thor/actions/directory.rb#55
1104
- class Thor::Actions::Directory < ::Thor::Actions::EmptyDirectory
1105
- # @return [Directory] a new instance of Directory
1106
- #
1107
- # source://thor//lib/thor/actions/directory.rb#58
1108
- def initialize(base, source, destination = T.unsafe(nil), config = T.unsafe(nil), &block); end
1109
-
1110
- # source://thor//lib/thor/actions/directory.rb#64
1111
- def invoke!; end
1112
-
1113
- # source://thor//lib/thor/actions/directory.rb#69
1114
- def revoke!; end
1115
-
1116
- # Returns the value of attribute source.
1117
- #
1118
- # source://thor//lib/thor/actions/directory.rb#56
1119
- def source; end
1120
-
1121
- protected
1122
-
1123
- # source://thor//lib/thor/actions/directory.rb#75
1124
- def execute!; end
1125
-
1126
- # source://thor//lib/thor/actions/directory.rb#99
1127
- def file_level_lookup(previous_lookup); end
1128
-
1129
- # source://thor//lib/thor/actions/directory.rb#103
1130
- def files(lookup); end
1131
- end
1132
-
1133
- # source://thor//lib/thor/actions/empty_directory.rb#23
1134
- class Thor::Actions::EmptyDirectory
1135
- # Initializes given the source and destination.
1136
- #
1137
- # ==== Parameters
1138
- # base<Thor::Base>:: A Thor::Base instance
1139
- # source<String>:: Relative path to the source of this file
1140
- # destination<String>:: Relative path to the destination of this file
1141
- # config<Hash>:: give :verbose => false to not log the status.
1142
- #
1143
- # @return [EmptyDirectory] a new instance of EmptyDirectory
1144
- #
1145
- # source://thor//lib/thor/actions/empty_directory.rb#34
1146
- def initialize(base, destination, config = T.unsafe(nil)); end
1147
-
1148
- # source://thor//lib/thor/actions/empty_directory.rb#24
1149
- def base; end
1150
-
1151
- # source://thor//lib/thor/actions/empty_directory.rb#24
1152
- def config; end
1153
-
1154
- # source://thor//lib/thor/actions/empty_directory.rb#24
1155
- def destination; end
1156
-
1157
- # Checks if the destination file already exists.
1158
- #
1159
- # ==== Returns
1160
- # Boolean:: true if the file exists, false otherwise.
1161
- #
1162
- # @return [Boolean]
1163
- #
1164
- # source://thor//lib/thor/actions/empty_directory.rb#45
1165
- def exists?; end
1166
-
1167
- # source://thor//lib/thor/actions/empty_directory.rb#24
1168
- def given_destination; end
1169
-
1170
- # source://thor//lib/thor/actions/empty_directory.rb#49
1171
- def invoke!; end
1172
-
1173
- # source://thor//lib/thor/actions/empty_directory.rb#24
1174
- def relative_destination; end
1175
-
1176
- # source://thor//lib/thor/actions/empty_directory.rb#56
1177
- def revoke!; end
1178
-
1179
- protected
1180
-
1181
- # Filenames in the encoded form are converted. If you have a file:
1182
- #
1183
- # %file_name%.rb
1184
- #
1185
- # It calls #file_name from the base and replaces %-string with the
1186
- # return value (should be String) of #file_name:
1187
- #
1188
- # user.rb
1189
- #
1190
- # The method referenced can be either public or private.
1191
- #
1192
- # source://thor//lib/thor/actions/empty_directory.rb#103
1193
- def convert_encoded_instructions(filename); end
1194
-
1195
- # Sets the absolute destination value from a relative destination value.
1196
- # It also stores the given and relative destination. Let's suppose our
1197
- # script is being executed on "dest", it sets the destination root to
1198
- # "dest". The destination, given_destination and relative_destination
1199
- # are related in the following way:
1200
- #
1201
- # inside "bar" do
1202
- # empty_directory "baz"
1203
- # end
1204
- #
1205
- # destination #=> dest/bar/baz
1206
- # relative_destination #=> bar/baz
1207
- # given_destination #=> baz
1208
- #
1209
- # source://thor//lib/thor/actions/empty_directory.rb#85
1210
- def destination=(destination); end
1211
-
1212
- # Receives a hash of options and just execute the block if some
1213
- # conditions are met.
1214
- #
1215
- # source://thor//lib/thor/actions/empty_directory.rb#113
1216
- def invoke_with_conflict_check(&block); end
1217
-
1218
- # What to do when the destination file already exists.
1219
- #
1220
- # source://thor//lib/thor/actions/empty_directory.rb#132
1221
- def on_conflict_behavior; end
1222
-
1223
- # source://thor//lib/thor/actions/empty_directory.rb#126
1224
- def on_file_clash_behavior; end
1225
-
1226
- # Shortcut for pretend.
1227
- #
1228
- # @return [Boolean]
1229
- #
1230
- # source://thor//lib/thor/actions/empty_directory.rb#67
1231
- def pretend?; end
1232
-
1233
- # Shortcut to say_status shell method.
1234
- #
1235
- # source://thor//lib/thor/actions/empty_directory.rb#138
1236
- def say_status(status, color); end
1237
- end
1238
-
1239
- # source://thor//lib/thor/actions/inject_into_file.rb#36
1240
- class Thor::Actions::InjectIntoFile < ::Thor::Actions::EmptyDirectory
1241
- # @return [InjectIntoFile] a new instance of InjectIntoFile
1242
- #
1243
- # source://thor//lib/thor/actions/inject_into_file.rb#39
1244
- def initialize(base, destination, data, config); end
1245
-
1246
- # Returns the value of attribute behavior.
1247
- #
1248
- # source://thor//lib/thor/actions/inject_into_file.rb#37
1249
- def behavior; end
1250
-
1251
- # Returns the value of attribute flag.
1252
- #
1253
- # source://thor//lib/thor/actions/inject_into_file.rb#37
1254
- def flag; end
1255
-
1256
- # source://thor//lib/thor/actions/inject_into_file.rb#52
1257
- def invoke!; end
1258
-
1259
- # Returns the value of attribute replacement.
1260
- #
1261
- # source://thor//lib/thor/actions/inject_into_file.rb#37
1262
- def replacement; end
1263
-
1264
- # source://thor//lib/thor/actions/inject_into_file.rb#72
1265
- def revoke!; end
1266
-
1267
- protected
1268
-
1269
- # Adds the content to the file.
1270
- #
1271
- # source://thor//lib/thor/actions/inject_into_file.rb#108
1272
- def replace!(regexp, string, force); end
1273
-
1274
- # source://thor//lib/thor/actions/inject_into_file.rb#88
1275
- def say_status(behavior, warning: T.unsafe(nil), color: T.unsafe(nil)); end
1276
- end
1277
-
1278
- # Injects the given content into a file. Different from gsub_file, this
1279
- # method is reversible.
1280
- #
1281
- # ==== Parameters
1282
- # destination<String>:: Relative path to the destination root
1283
- # data<String>:: Data to add to the file. Can be given as a block.
1284
- # config<Hash>:: give :verbose => false to not log the status and the flag
1285
- # for injection (:after or :before) or :force => true for
1286
- # insert two or more times the same content.
1287
- #
1288
- # ==== Examples
1289
- #
1290
- # insert_into_file "config/environment.rb", "config.gem :thor", :after => "Rails::Initializer.run do |config|\n"
1291
- #
1292
- # insert_into_file "config/environment.rb", :after => "Rails::Initializer.run do |config|\n" do
1293
- # gems = ask "Which gems would you like to add?"
1294
- # gems.split(" ").map{ |gem| " config.gem :#{gem}" }.join("\n")
1295
- # end
1296
- #
1297
- # source://thor//lib/thor/actions/inject_into_file.rb#24
1298
- Thor::Actions::WARNINGS = T.let(T.unsafe(nil), Hash)
1299
-
1300
- # source://thor//lib/thor/error.rb#60
1301
- class Thor::AmbiguousCommandError < ::Thor::Error; end
1302
-
1303
- # source://thor//lib/thor/error.rb#62
1304
- Thor::AmbiguousTaskError = Thor::AmbiguousCommandError
1305
-
1306
- # source://thor//lib/thor/parser/argument.rb#2
1307
- class Thor::Argument
1308
- # @raise [ArgumentError]
1309
- # @return [Argument] a new instance of Argument
1310
- #
1311
- # source://thor//lib/thor/parser/argument.rb#8
1312
- def initialize(name, options = T.unsafe(nil)); end
1313
-
1314
- # Returns the value of attribute banner.
1315
- #
1316
- # source://thor//lib/thor/parser/argument.rb#5
1317
- def banner; end
1318
-
1319
- # Returns the value of attribute default.
1320
- #
1321
- # source://thor//lib/thor/parser/argument.rb#5
1322
- def default; end
1323
-
1324
- # Returns the value of attribute description.
1325
- #
1326
- # source://thor//lib/thor/parser/argument.rb#5
1327
- def description; end
1328
-
1329
- # Returns the value of attribute enum.
1330
- #
1331
- # source://thor//lib/thor/parser/argument.rb#5
1332
- def enum; end
1333
-
1334
- # Returns the value of attribute name.
1335
- #
1336
- # source://thor//lib/thor/parser/argument.rb#5
1337
- def human_name; end
1338
-
1339
- # Returns the value of attribute name.
1340
- #
1341
- # source://thor//lib/thor/parser/argument.rb#5
1342
- def name; end
1343
-
1344
- # Returns the value of attribute required.
1345
- #
1346
- # source://thor//lib/thor/parser/argument.rb#5
1347
- def required; end
1348
-
1349
- # @return [Boolean]
1350
- #
1351
- # source://thor//lib/thor/parser/argument.rb#31
1352
- def required?; end
1353
-
1354
- # @return [Boolean]
1355
- #
1356
- # source://thor//lib/thor/parser/argument.rb#35
1357
- def show_default?; end
1358
-
1359
- # Returns the value of attribute type.
1360
- #
1361
- # source://thor//lib/thor/parser/argument.rb#5
1362
- def type; end
1363
-
1364
- # source://thor//lib/thor/parser/argument.rb#27
1365
- def usage; end
1366
-
1367
- protected
1368
-
1369
- # source://thor//lib/thor/parser/argument.rb#55
1370
- def default_banner; end
1371
-
1372
- # @return [Boolean]
1373
- #
1374
- # source://thor//lib/thor/parser/argument.rb#51
1375
- def valid_type?(type); end
1376
-
1377
- # @raise [ArgumentError]
1378
- #
1379
- # source://thor//lib/thor/parser/argument.rb#46
1380
- def validate!; end
1381
- end
1382
-
1383
- # source://thor//lib/thor/parser/argument.rb#3
1384
- Thor::Argument::VALID_TYPES = T.let(T.unsafe(nil), Array)
1385
-
1386
- # source://thor//lib/thor/parser/arguments.rb#2
1387
- class Thor::Arguments
1388
- # Takes an array of Thor::Argument objects.
1389
- #
1390
- # @return [Arguments] a new instance of Arguments
1391
- #
1392
- # source://thor//lib/thor/parser/arguments.rb#26
1393
- def initialize(arguments = T.unsafe(nil)); end
1394
-
1395
- # source://thor//lib/thor/parser/arguments.rb#44
1396
- def parse(args); end
1397
-
1398
- # source://thor//lib/thor/parser/arguments.rb#57
1399
- def remaining; end
1400
-
1401
- private
1402
-
1403
- # Raises an error if @non_assigned_required array is not empty.
1404
- #
1405
- # @raise [RequiredArgumentMissingError]
1406
- #
1407
- # source://thor//lib/thor/parser/arguments.rb#170
1408
- def check_requirement!; end
1409
-
1410
- # @return [Boolean]
1411
- #
1412
- # source://thor//lib/thor/parser/arguments.rb#88
1413
- def current_is_value?; end
1414
-
1415
- # @return [Boolean]
1416
- #
1417
- # source://thor//lib/thor/parser/arguments.rb#68
1418
- def last?; end
1419
-
1420
- # @return [Boolean]
1421
- #
1422
- # source://thor//lib/thor/parser/arguments.rb#63
1423
- def no_or_skip?(arg); end
1424
-
1425
- # Runs through the argument array getting all strings until no string is
1426
- # found or a switch is found.
1427
- #
1428
- # ["a", "b", "c"]
1429
- #
1430
- # And returns it as an array:
1431
- #
1432
- # ["a", "b", "c"]
1433
- #
1434
- # source://thor//lib/thor/parser/arguments.rb#122
1435
- def parse_array(name); end
1436
-
1437
- # Runs through the argument array getting strings that contains ":" and
1438
- # mark it as a hash:
1439
- #
1440
- # [ "name:string", "age:integer" ]
1441
- #
1442
- # Becomes:
1443
- #
1444
- # { "name" => "string", "age" => "integer" }
1445
- #
1446
- # source://thor//lib/thor/parser/arguments.rb#101
1447
- def parse_hash(name); end
1448
-
1449
- # Check if the peek is numeric format and return a Float or Integer.
1450
- # Check if the peek is included in enum if enum is provided.
1451
- # Otherwise raises an error.
1452
- #
1453
- # source://thor//lib/thor/parser/arguments.rb#133
1454
- def parse_numeric(name); end
1455
-
1456
- # Parse string:
1457
- # for --string-arg, just return the current value in the pile
1458
- # for --no-string-arg, nil
1459
- # Check if the peek is included in enum if enum is provided. Otherwise raises an error.
1460
- #
1461
- # source://thor//lib/thor/parser/arguments.rb#154
1462
- def parse_string(name); end
1463
-
1464
- # source://thor//lib/thor/parser/arguments.rb#72
1465
- def peek; end
1466
-
1467
- # source://thor//lib/thor/parser/arguments.rb#76
1468
- def shift; end
1469
-
1470
- # source://thor//lib/thor/parser/arguments.rb#80
1471
- def unshift(arg); end
1472
-
1473
- class << self
1474
- # source://thor//lib/thor/parser/arguments.rb#19
1475
- def parse(*args); end
1476
-
1477
- # Receives an array of args and returns two arrays, one with arguments
1478
- # and one with switches.
1479
- #
1480
- # source://thor//lib/thor/parser/arguments.rb#8
1481
- def split(args); end
1482
- end
1483
- end
1484
-
1485
- # source://thor//lib/thor/parser/arguments.rb#3
1486
- Thor::Arguments::NUMERIC = T.let(T.unsafe(nil), Regexp)
1487
-
1488
- # source://thor//lib/thor/shell.rb#4
1489
- module Thor::Base
1490
- include ::Thor::Invocation
1491
- include ::Thor::Shell
1492
-
1493
- mixes_in_class_methods ::Thor::Base::ClassMethods
1494
- mixes_in_class_methods ::Thor::Invocation::ClassMethods
1495
-
1496
- # It receives arguments in an Array and two hashes, one for options and
1497
- # other for configuration.
1498
- #
1499
- # Notice that it does not check if all required arguments were supplied.
1500
- # It should be done by the parser.
1501
- #
1502
- # ==== Parameters
1503
- # args<Array[Object]>:: An array of objects. The objects are applied to their
1504
- # respective accessors declared with <tt>argument</tt>.
1505
- #
1506
- # options<Hash>:: An options hash that will be available as self.options.
1507
- # The hash given is converted to a hash with indifferent
1508
- # access, magic predicates (options.skip?) and then frozen.
1509
- #
1510
- # config<Hash>:: Configuration for this Thor class.
1511
- #
1512
- # source://thor//lib/thor/base.rb#53
1513
- def initialize(args = T.unsafe(nil), local_options = T.unsafe(nil), config = T.unsafe(nil)); end
1514
-
1515
- # Returns the value of attribute args.
1516
- #
1517
- # source://thor//lib/thor/base.rb#35
1518
- def args; end
1519
-
1520
- # Sets the attribute args
1521
- #
1522
- # @param value the value to set the attribute args to.
1523
- #
1524
- # source://thor//lib/thor/base.rb#35
1525
- def args=(_arg0); end
1526
-
1527
- # Returns the value of attribute options.
1528
- #
1529
- # source://thor//lib/thor/base.rb#35
1530
- def options; end
1531
-
1532
- # Sets the attribute options
1533
- #
1534
- # @param value the value to set the attribute options to.
1535
- #
1536
- # source://thor//lib/thor/base.rb#35
1537
- def options=(_arg0); end
1538
-
1539
- # Returns the value of attribute parent_options.
1540
- #
1541
- # source://thor//lib/thor/base.rb#35
1542
- def parent_options; end
1543
-
1544
- # Sets the attribute parent_options
1545
- #
1546
- # @param value the value to set the attribute parent_options to.
1547
- #
1548
- # source://thor//lib/thor/base.rb#35
1549
- def parent_options=(_arg0); end
1550
-
1551
- class << self
1552
- # source://thor//lib/thor/base.rb#100
1553
- def included(base); end
1554
-
1555
- # Whenever a class inherits from Thor or Thor::Group, we should track the
1556
- # class and the file on Thor::Base. This is the method responsible for it.
1557
- #
1558
- # source://thor//lib/thor/base.rb#128
1559
- def register_klass_file(klass); end
1560
-
1561
- # Returns the shell used in all Thor classes. If you are in a Unix platform
1562
- # it will use a colored log, otherwise it will use a basic one without color.
1563
- #
1564
- # source://thor//lib/thor/shell.rb#11
1565
- def shell; end
1566
-
1567
- # Sets the attribute shell
1568
- #
1569
- # @param value the value to set the attribute shell to.
1570
- #
1571
- # source://thor//lib/thor/shell.rb#6
1572
- def shell=(_arg0); end
1573
-
1574
- # Returns the files where the subclasses are kept.
1575
- #
1576
- # ==== Returns
1577
- # Hash[path<String> => Class]
1578
- #
1579
- # source://thor//lib/thor/base.rb#121
1580
- def subclass_files; end
1581
-
1582
- # Returns the classes that inherits from Thor or Thor::Group.
1583
- #
1584
- # ==== Returns
1585
- # Array[Class]
1586
- #
1587
- # source://thor//lib/thor/base.rb#112
1588
- def subclasses; end
1589
- end
1590
- end
1591
-
1592
- # source://thor//lib/thor/base.rb#137
1593
- module Thor::Base::ClassMethods
1594
- # Returns the commands for this Thor class and all subclasses.
1595
- #
1596
- # ==== Returns
1597
- # Hash:: An ordered hash with commands names as keys and Thor::Command
1598
- # objects as values.
1599
- #
1600
- # source://thor//lib/thor/base.rb#383
1601
- def all_commands; end
1602
-
1603
- # Returns the commands for this Thor class and all subclasses.
1604
- #
1605
- # ==== Returns
1606
- # Hash:: An ordered hash with commands names as keys and Thor::Command
1607
- # objects as values.
1608
- #
1609
- # source://thor//lib/thor/base.rb#383
1610
- def all_tasks; end
1611
-
1612
- # If you want to use defaults that don't match the type of an option,
1613
- # either specify `check_default_type: false` or call `allow_incompatible_default_type!`
1614
- #
1615
- # source://thor//lib/thor/base.rb#173
1616
- def allow_incompatible_default_type!; end
1617
-
1618
- # Adds an argument to the class and creates an attr_accessor for it.
1619
- #
1620
- # Arguments are different from options in several aspects. The first one
1621
- # is how they are parsed from the command line, arguments are retrieved
1622
- # from position:
1623
- #
1624
- # thor command NAME
1625
- #
1626
- # Instead of:
1627
- #
1628
- # thor command --name=NAME
1629
- #
1630
- # Besides, arguments are used inside your code as an accessor (self.argument),
1631
- # while options are all kept in a hash (self.options).
1632
- #
1633
- # Finally, arguments cannot have type :default or :boolean but can be
1634
- # optional (supplying :optional => :true or :required => false), although
1635
- # you cannot have a required argument after a non-required argument. If you
1636
- # try it, an error is raised.
1637
- #
1638
- # ==== Parameters
1639
- # name<Symbol>:: The name of the argument.
1640
- # options<Hash>:: Described below.
1641
- #
1642
- # ==== Options
1643
- # :desc - Description for the argument.
1644
- # :required - If the argument is required or not.
1645
- # :optional - If the argument is optional or not.
1646
- # :type - The type of the argument, can be :string, :hash, :array, :numeric.
1647
- # :default - Default value for this argument. It cannot be required and have default values.
1648
- # :banner - String to show on usage notes.
1649
- #
1650
- # ==== Errors
1651
- # ArgumentError:: Raised if you supply a required argument after a non required one.
1652
- #
1653
- # source://thor//lib/thor/base.rb#245
1654
- def argument(name, options = T.unsafe(nil)); end
1655
-
1656
- # Returns this class arguments, looking up in the ancestors chain.
1657
- #
1658
- # ==== Returns
1659
- # Array[Thor::Argument]
1660
- #
1661
- # source://thor//lib/thor/base.rb#277
1662
- def arguments; end
1663
-
1664
- # source://thor//lib/thor/base.rb#146
1665
- def attr_accessor(*_arg0); end
1666
-
1667
- # source://thor//lib/thor/base.rb#138
1668
- def attr_reader(*_arg0); end
1669
-
1670
- # source://thor//lib/thor/base.rb#142
1671
- def attr_writer(*_arg0); end
1672
-
1673
- # source://thor//lib/thor/base.rb#177
1674
- def check_default_type; end
1675
-
1676
- # If you want to raise an error when the default value of an option does not match
1677
- # the type call check_default_type!
1678
- # This will be the default; for compatibility a deprecation warning is issued if necessary.
1679
- #
1680
- # source://thor//lib/thor/base.rb#167
1681
- def check_default_type!; end
1682
-
1683
- # source://thor//lib/thor/base.rb#156
1684
- def check_unknown_options; end
1685
-
1686
- # If you want to raise an error for unknown options, call check_unknown_options!
1687
- # This is disabled by default to allow dynamic invocations.
1688
- #
1689
- # source://thor//lib/thor/base.rb#152
1690
- def check_unknown_options!; end
1691
-
1692
- # @return [Boolean]
1693
- #
1694
- # source://thor//lib/thor/base.rb#160
1695
- def check_unknown_options?(config); end
1696
-
1697
- # Adds an option to the set of class options
1698
- #
1699
- # ==== Parameters
1700
- # name<Symbol>:: The name of the argument.
1701
- # options<Hash>:: Described below.
1702
- #
1703
- # ==== Options
1704
- # :desc:: -- Description for the argument.
1705
- # :required:: -- If the argument is required or not.
1706
- # :default:: -- Default value for this argument.
1707
- # :group:: -- The group for this options. Use by class options to output options in different levels.
1708
- # :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.
1709
- # :type:: -- The type of the argument, can be :string, :hash, :array, :numeric or :boolean.
1710
- # :banner:: -- String to show on usage notes.
1711
- # :hide:: -- If you want to hide this option from the help.
1712
- #
1713
- # source://thor//lib/thor/base.rb#312
1714
- def class_option(name, options = T.unsafe(nil)); end
1715
-
1716
- # Adds a bunch of options to the set of class options.
1717
- #
1718
- # class_options :foo => false, :bar => :required, :baz => :string
1719
- #
1720
- # If you prefer more detailed declaration, check class_option.
1721
- #
1722
- # ==== Parameters
1723
- # Hash[Symbol => Object]
1724
- #
1725
- # source://thor//lib/thor/base.rb#290
1726
- def class_options(options = T.unsafe(nil)); end
1727
-
1728
- # Returns the commands for this Thor class.
1729
- #
1730
- # ==== Returns
1731
- # Hash:: An ordered hash with commands names as keys and Thor::Command
1732
- # objects as values.
1733
- #
1734
- # source://thor//lib/thor/base.rb#372
1735
- def commands; end
1736
-
1737
- # If true, option set will not suspend the execution of the command when
1738
- # a required option is not provided.
1739
- #
1740
- # @return [Boolean]
1741
- #
1742
- # source://thor//lib/thor/base.rb#191
1743
- def disable_required_check?(command_name); end
1744
-
1745
- # A flag that makes the process exit with status 1 if any error happens.
1746
- #
1747
- # @return [Boolean]
1748
- #
1749
- # source://thor//lib/thor/base.rb#529
1750
- def exit_on_failure?; end
1751
-
1752
- # Defines the group. This is used when thor list is invoked so you can specify
1753
- # that only commands from a pre-defined group will be shown. Defaults to standard.
1754
- #
1755
- # ==== Parameters
1756
- # name<String|Symbol>
1757
- #
1758
- # source://thor//lib/thor/base.rb#358
1759
- def group(name = T.unsafe(nil)); end
1760
-
1761
- # @raise [InvocationError]
1762
- #
1763
- # source://thor//lib/thor/base.rb#519
1764
- def handle_argument_error(command, error, args, arity); end
1765
-
1766
- # @raise [UndefinedCommandError]
1767
- #
1768
- # source://thor//lib/thor/base.rb#514
1769
- def handle_no_command_error(command, has_namespace = T.unsafe(nil)); end
1770
-
1771
- # @raise [UndefinedCommandError]
1772
- #
1773
- # source://thor//lib/thor/base.rb#514
1774
- def handle_no_task_error(command, has_namespace = T.unsafe(nil)); end
1775
-
1776
- # Sets the namespace for the Thor or Thor::Group class. By default the
1777
- # namespace is retrieved from the class name. If your Thor class is named
1778
- # Scripts::MyScript, the help method, for example, will be called as:
1779
- #
1780
- # thor scripts:my_script -h
1781
- #
1782
- # If you change the namespace:
1783
- #
1784
- # namespace :my_scripts
1785
- #
1786
- # You change how your commands are invoked:
1787
- #
1788
- # thor my_scripts -h
1789
- #
1790
- # Finally, if you change your namespace to default:
1791
- #
1792
- # namespace :default
1793
- #
1794
- # Your commands can be invoked with a shortcut. Instead of:
1795
- #
1796
- # thor :my_command
1797
- #
1798
- # source://thor//lib/thor/base.rb#467
1799
- def namespace(name = T.unsafe(nil)); end
1800
-
1801
- # All methods defined inside the given block are not added as commands.
1802
- #
1803
- # So you can do:
1804
- #
1805
- # class MyScript < Thor
1806
- # no_commands do
1807
- # def this_is_not_a_command
1808
- # end
1809
- # end
1810
- # end
1811
- #
1812
- # You can also add the method and remove it from the command list:
1813
- #
1814
- # class MyScript < Thor
1815
- # def this_is_not_a_command
1816
- # end
1817
- # remove_command :this_is_not_a_command
1818
- # end
1819
- #
1820
- # source://thor//lib/thor/base.rb#431
1821
- def no_commands(&block); end
1822
-
1823
- # @return [Boolean]
1824
- #
1825
- # source://thor//lib/thor/base.rb#441
1826
- def no_commands?; end
1827
-
1828
- # source://thor//lib/thor/base.rb#437
1829
- def no_commands_context; end
1830
-
1831
- # All methods defined inside the given block are not added as commands.
1832
- #
1833
- # So you can do:
1834
- #
1835
- # class MyScript < Thor
1836
- # no_commands do
1837
- # def this_is_not_a_command
1838
- # end
1839
- # end
1840
- # end
1841
- #
1842
- # You can also add the method and remove it from the command list:
1843
- #
1844
- # class MyScript < Thor
1845
- # def this_is_not_a_command
1846
- # end
1847
- # remove_command :this_is_not_a_command
1848
- # end
1849
- #
1850
- # source://thor//lib/thor/base.rb#431
1851
- def no_tasks(&block); end
1852
-
1853
- # Allows to use private methods from parent in child classes as commands.
1854
- #
1855
- # ==== Parameters
1856
- # names<Array>:: Method names to be used as commands
1857
- #
1858
- # ==== Examples
1859
- #
1860
- # public_command :foo
1861
- # public_command :foo, :bar, :baz
1862
- #
1863
- # source://thor//lib/thor/base.rb#507
1864
- def public_command(*names); end
1865
-
1866
- # Allows to use private methods from parent in child classes as commands.
1867
- #
1868
- # ==== Parameters
1869
- # names<Array>:: Method names to be used as commands
1870
- #
1871
- # ==== Examples
1872
- #
1873
- # public_command :foo
1874
- # public_command :foo, :bar, :baz
1875
- #
1876
- # source://thor//lib/thor/base.rb#507
1877
- def public_task(*names); end
1878
-
1879
- # Removes a previous defined argument. If :undefine is given, undefine
1880
- # accessors as well.
1881
- #
1882
- # ==== Parameters
1883
- # names<Array>:: Arguments to be removed
1884
- #
1885
- # ==== Examples
1886
- #
1887
- # remove_argument :foo
1888
- # remove_argument :foo, :bar, :baz, :undefine => true
1889
- #
1890
- # source://thor//lib/thor/base.rb#327
1891
- def remove_argument(*names); end
1892
-
1893
- # Removes a previous defined class option.
1894
- #
1895
- # ==== Parameters
1896
- # names<Array>:: Class options to be removed
1897
- #
1898
- # ==== Examples
1899
- #
1900
- # remove_class_option :foo
1901
- # remove_class_option :foo, :bar, :baz
1902
- #
1903
- # source://thor//lib/thor/base.rb#346
1904
- def remove_class_option(*names); end
1905
-
1906
- # Removes a given command from this Thor class. This is usually done if you
1907
- # are inheriting from another class and don't want it to be available
1908
- # anymore.
1909
- #
1910
- # By default it only remove the mapping to the command. But you can supply
1911
- # :undefine => true to undefine the method from the class as well.
1912
- #
1913
- # ==== Parameters
1914
- # name<Symbol|String>:: The name of the command to be removed
1915
- # options<Hash>:: You can give :undefine => true if you want commands the method
1916
- # to be undefined from the class as well.
1917
- #
1918
- # source://thor//lib/thor/base.rb#401
1919
- def remove_command(*names); end
1920
-
1921
- # Removes a given command from this Thor class. This is usually done if you
1922
- # are inheriting from another class and don't want it to be available
1923
- # anymore.
1924
- #
1925
- # By default it only remove the mapping to the command. But you can supply
1926
- # :undefine => true to undefine the method from the class as well.
1927
- #
1928
- # ==== Parameters
1929
- # name<Symbol|String>:: The name of the command to be removed
1930
- # options<Hash>:: You can give :undefine => true if you want commands the method
1931
- # to be undefined from the class as well.
1932
- #
1933
- # source://thor//lib/thor/base.rb#401
1934
- def remove_task(*names); end
1935
-
1936
- # Parses the command and options from the given args, instantiate the class
1937
- # and invoke the command. This method is used when the arguments must be parsed
1938
- # from an array. If you are inside Ruby and want to use a Thor class, you
1939
- # can simply initialize it:
1940
- #
1941
- # script = MyScript.new(args, options, config)
1942
- # script.invoke(:command, first_arg, second_arg, third_arg)
1943
- #
1944
- # source://thor//lib/thor/base.rb#483
1945
- def start(given_args = T.unsafe(nil), config = T.unsafe(nil)); end
1946
-
1947
- # If true, option parsing is suspended as soon as an unknown option or a
1948
- # regular argument is encountered. All remaining arguments are passed to
1949
- # the command as regular arguments.
1950
- #
1951
- # @return [Boolean]
1952
- #
1953
- # source://thor//lib/thor/base.rb#185
1954
- def stop_on_unknown_option?(command_name); end
1955
-
1956
- # source://thor//lib/thor/base.rb#202
1957
- def strict_args_position; end
1958
-
1959
- # If you want only strict string args (useful when cascading thor classes),
1960
- # call strict_args_position! This is disabled by default to allow dynamic
1961
- # invocations.
1962
- #
1963
- # source://thor//lib/thor/base.rb#198
1964
- def strict_args_position!; end
1965
-
1966
- # @return [Boolean]
1967
- #
1968
- # source://thor//lib/thor/base.rb#206
1969
- def strict_args_position?(config); end
1970
-
1971
- # Returns the commands for this Thor class.
1972
- #
1973
- # ==== Returns
1974
- # Hash:: An ordered hash with commands names as keys and Thor::Command
1975
- # objects as values.
1976
- #
1977
- # source://thor//lib/thor/base.rb#372
1978
- def tasks; end
1979
-
1980
- protected
1981
-
1982
- # SIGNATURE: Sets the baseclass. This is where the superclass lookup
1983
- # finishes.
1984
- #
1985
- # source://thor//lib/thor/base.rb#679
1986
- def baseclass; end
1987
-
1988
- # The basename of the program invoking the thor class.
1989
- #
1990
- # source://thor//lib/thor/base.rb#673
1991
- def basename; end
1992
-
1993
- # Build an option and adds it to the given scope.
1994
- #
1995
- # ==== Parameters
1996
- # name<Symbol>:: The name of the argument.
1997
- # options<Hash>:: Described in both class_option and method_option.
1998
- # scope<Hash>:: Options hash that is being built up
1999
- #
2000
- # source://thor//lib/thor/base.rb#590
2001
- def build_option(name, options, scope); end
2002
-
2003
- # Receives a hash of options, parse them and add to the scope. This is a
2004
- # fast way to set a bunch of options:
2005
- #
2006
- # build_options :foo => true, :bar => :required, :baz => :string
2007
- #
2008
- # ==== Parameters
2009
- # Hash[Symbol => Object]
2010
- #
2011
- # source://thor//lib/thor/base.rb#601
2012
- def build_options(options, scope); end
2013
-
2014
- # Prints the class options per group. If an option does not belong to
2015
- # any group, it's printed as Class option.
2016
- #
2017
- # source://thor//lib/thor/base.rb#539
2018
- def class_options_help(shell, groups = T.unsafe(nil)); end
2019
-
2020
- # SIGNATURE: Creates a new command if valid_command? is true. This method is
2021
- # called when a new method is added to the class.
2022
- #
2023
- # source://thor//lib/thor/base.rb#684
2024
- def create_command(meth); end
2025
-
2026
- # SIGNATURE: Creates a new command if valid_command? is true. This method is
2027
- # called when a new method is added to the class.
2028
- #
2029
- # source://thor//lib/thor/base.rb#684
2030
- def create_task(meth); end
2031
-
2032
- # SIGNATURE: The hook invoked by start.
2033
- #
2034
- # @raise [NotImplementedError]
2035
- #
2036
- # source://thor//lib/thor/base.rb#694
2037
- def dispatch(command, given_args, given_opts, config); end
2038
-
2039
- # Finds a command with the given name. If the command belongs to the current
2040
- # class, just return it, otherwise dup it and add the fresh copy to the
2041
- # current command hash.
2042
- #
2043
- # source://thor//lib/thor/base.rb#610
2044
- def find_and_refresh_command(name); end
2045
-
2046
- # Finds a command with the given name. If the command belongs to the current
2047
- # class, just return it, otherwise dup it and add the fresh copy to the
2048
- # current command hash.
2049
- #
2050
- # source://thor//lib/thor/base.rb#610
2051
- def find_and_refresh_task(name); end
2052
-
2053
- # Retrieves a value from superclass. If it reaches the baseclass,
2054
- # returns default.
2055
- #
2056
- # source://thor//lib/thor/base.rb#651
2057
- def from_superclass(method, default = T.unsafe(nil)); end
2058
-
2059
- # Everytime someone inherits from a Thor class, register the klass
2060
- # and file into baseclass.
2061
- #
2062
- # source://thor//lib/thor/base.rb#623
2063
- def inherited(klass); end
2064
-
2065
- # SIGNATURE: Defines behavior when the initialize method is added to the
2066
- # class.
2067
- #
2068
- # source://thor//lib/thor/base.rb#690
2069
- def initialize_added; end
2070
-
2071
- # Raises an error if the word given is a Thor reserved word.
2072
- #
2073
- # @return [Boolean]
2074
- #
2075
- # source://thor//lib/thor/base.rb#579
2076
- def is_thor_reserved_word?(word, type); end
2077
-
2078
- # Fire this callback whenever a method is added. Added methods are
2079
- # tracked as commands by invoking the create_command method.
2080
- #
2081
- # source://thor//lib/thor/base.rb#631
2082
- def method_added(meth); end
2083
-
2084
- # Receives a set of options and print them.
2085
- #
2086
- # source://thor//lib/thor/base.rb#557
2087
- def print_options(shell, options, group_name = T.unsafe(nil)); end
2088
- end
2089
-
2090
- # source://thor//lib/thor/command.rb#2
2091
- class Thor::Command < ::Struct
2092
- # @return [Command] a new instance of Command
2093
- #
2094
- # source://thor//lib/thor/command.rb#5
2095
- def initialize(name, description, long_description, usage, options = T.unsafe(nil)); end
2096
-
2097
- # Returns the formatted usage by injecting given required arguments
2098
- # and required options into the given usage.
2099
- #
2100
- # source://thor//lib/thor/command.rb#41
2101
- def formatted_usage(klass, namespace = T.unsafe(nil), subcommand = T.unsafe(nil)); end
2102
-
2103
- # @return [Boolean]
2104
- #
2105
- # source://thor//lib/thor/command.rb#14
2106
- def hidden?; end
2107
-
2108
- # By default, a command invokes a method in the thor class. You can change this
2109
- # implementation to create custom commands.
2110
- #
2111
- # source://thor//lib/thor/command.rb#20
2112
- def run(instance, args = T.unsafe(nil)); end
2113
-
2114
- protected
2115
-
2116
- # @return [Boolean]
2117
- #
2118
- # source://thor//lib/thor/command.rb#105
2119
- def handle_argument_error?(instance, error, caller); end
2120
-
2121
- # @return [Boolean]
2122
- #
2123
- # source://thor//lib/thor/command.rb#112
2124
- def handle_no_method_error?(instance, error, caller); end
2125
-
2126
- # @return [Boolean]
2127
- #
2128
- # source://thor//lib/thor/command.rb#95
2129
- def local_method?(instance, name); end
2130
-
2131
- # @return [Boolean]
2132
- #
2133
- # source://thor//lib/thor/command.rb#78
2134
- def not_debugging?(instance); end
2135
-
2136
- # @return [Boolean]
2137
- #
2138
- # source://thor//lib/thor/command.rb#91
2139
- def private_method?(instance); end
2140
-
2141
- # Given a target, checks if this class name is a public method.
2142
- #
2143
- # @return [Boolean]
2144
- #
2145
- # source://thor//lib/thor/command.rb#87
2146
- def public_method?(instance); end
2147
-
2148
- # Add usage with required arguments
2149
- #
2150
- # source://thor//lib/thor/command.rb#68
2151
- def required_arguments_for(klass, usage); end
2152
-
2153
- # source://thor//lib/thor/command.rb#82
2154
- def required_options; end
2155
-
2156
- # source://thor//lib/thor/command.rb#100
2157
- def sans_backtrace(backtrace, caller); end
2158
-
2159
- private
2160
-
2161
- # source://thor//lib/thor/command.rb#9
2162
- def initialize_copy(other); end
2163
- end
2164
-
2165
- # source://thor//lib/thor/command.rb#3
2166
- Thor::Command::FILE_REGEXP = T.let(T.unsafe(nil), Regexp)
2167
-
2168
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#2
2169
- module Thor::CoreExt; end
2170
-
2171
- # A hash with indifferent access and magic predicates.
2172
- #
2173
- # hash = Thor::CoreExt::HashWithIndifferentAccess.new 'foo' => 'bar', 'baz' => 'bee', 'force' => true
2174
- #
2175
- # hash[:foo] #=> 'bar'
2176
- # hash['foo'] #=> 'bar'
2177
- # hash.foo? #=> true
2178
- #
2179
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#11
2180
- class Thor::CoreExt::HashWithIndifferentAccess < ::Hash
2181
- # @return [HashWithIndifferentAccess] a new instance of HashWithIndifferentAccess
2182
- #
2183
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#12
2184
- def initialize(hash = T.unsafe(nil)); end
2185
-
2186
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#19
2187
- def [](key); end
2188
-
2189
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#23
2190
- def []=(key, value); end
2191
-
2192
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#27
2193
- def delete(key); end
2194
-
2195
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#31
2196
- def except(*keys); end
2197
-
2198
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#37
2199
- def fetch(key, *args); end
2200
-
2201
- # @return [Boolean]
2202
- #
2203
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#41
2204
- def key?(key); end
2205
-
2206
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#49
2207
- def merge(other); end
2208
-
2209
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#53
2210
- def merge!(other); end
2211
-
2212
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#68
2213
- def replace(other_hash); end
2214
-
2215
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#60
2216
- def reverse_merge(other); end
2217
-
2218
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#64
2219
- def reverse_merge!(other_hash); end
2220
-
2221
- # Convert to a Hash with String keys.
2222
- #
2223
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#73
2224
- def to_hash; end
2225
-
2226
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#45
2227
- def values_at(*indices); end
2228
-
2229
- protected
2230
-
2231
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#79
2232
- def convert_key(key); end
2233
-
2234
- # Magic predicates. For instance:
2235
- #
2236
- # options.force? # => !!options['force']
2237
- # options.shebang # => "/usr/lib/local/ruby"
2238
- # options.test_framework?(:rspec) # => options[:test_framework] == :rspec
2239
- #
2240
- # source://thor//lib/thor/core_ext/hash_with_indifferent_access.rb#89
2241
- def method_missing(method, *args); end
2242
- end
2243
-
2244
- # source://thor//lib/thor/error.rb#2
2245
- Thor::Correctable = DidYouMean::Correctable
2246
-
2247
- # A dynamic command that handles method missing scenarios.
2248
- #
2249
- # source://thor//lib/thor/command.rb#128
2250
- class Thor::DynamicCommand < ::Thor::Command
2251
- # @return [DynamicCommand] a new instance of DynamicCommand
2252
- #
2253
- # source://thor//lib/thor/command.rb#129
2254
- def initialize(name, options = T.unsafe(nil)); end
2255
-
2256
- # source://thor//lib/thor/command.rb#133
2257
- def run(instance, args = T.unsafe(nil)); end
2258
- end
2259
-
2260
- # source://thor//lib/thor/command.rb#141
2261
- Thor::DynamicTask = Thor::DynamicCommand
2262
-
2263
- # Thor::Error is raised when it's caused by wrong usage of thor classes. Those
2264
- # errors have their backtrace suppressed and are nicely shown to the user.
2265
- #
2266
- # Errors that are caused by the developer, like declaring a method which
2267
- # overwrites a thor keyword, SHOULD NOT raise a Thor::Error. This way, we
2268
- # ensure that developer errors are shown with full backtrace.
2269
- #
2270
- # source://thor//lib/thor/error.rb#23
2271
- class Thor::Error < ::StandardError; end
2272
-
2273
- # Thor has a special class called Thor::Group. The main difference to Thor class
2274
- # is that it invokes all commands at once. It also include some methods that allows
2275
- # invocations to be done at the class method, which are not available to Thor
2276
- # commands.
2277
- #
2278
- # source://thor//lib/thor/group.rb#7
2279
- class Thor::Group
2280
- include ::Thor::Base
2281
- include ::Thor::Invocation
2282
- include ::Thor::Shell
2283
- extend ::Thor::Base::ClassMethods
2284
- extend ::Thor::Invocation::ClassMethods
2285
-
2286
- protected
2287
-
2288
- # Shortcut to invoke with padding and block handling. Use internally by
2289
- # invoke and invoke_from_option class methods.
2290
- #
2291
- # source://thor//lib/thor/group.rb#265
2292
- def _invoke_for_class_method(klass, command = T.unsafe(nil), *args, &block); end
2293
-
2294
- class << self
2295
- # Overwrite class options help to allow invoked generators options to be
2296
- # shown recursively when invoking a generator.
2297
- #
2298
- # source://thor//lib/thor/group.rb#161
2299
- def class_options_help(shell, groups = T.unsafe(nil)); end
2300
-
2301
- # The description for this Thor::Group. If none is provided, but a source root
2302
- # exists, tries to find the USAGE one folder above it, otherwise searches
2303
- # in the superclass.
2304
- #
2305
- # ==== Parameters
2306
- # description<String>:: The description for this Thor::Group.
2307
- #
2308
- # source://thor//lib/thor/group.rb#16
2309
- def desc(description = T.unsafe(nil)); end
2310
-
2311
- # Get invocations array and merge options from invocations. Those
2312
- # options are added to group_options hash. Options that already exists
2313
- # in base_options are not added twice.
2314
- #
2315
- # source://thor//lib/thor/group.rb#172
2316
- def get_options_from_invocations(group_options, base_options); end
2317
-
2318
- # @raise [error]
2319
- #
2320
- # source://thor//lib/thor/group.rb#207
2321
- def handle_argument_error(command, error, _args, arity); end
2322
-
2323
- # Prints help information.
2324
- #
2325
- # ==== Options
2326
- # short:: When true, shows only usage.
2327
- #
2328
- # source://thor//lib/thor/group.rb#29
2329
- def help(shell); end
2330
-
2331
- # Stores invocation blocks used on invoke_from_option.
2332
- #
2333
- # source://thor//lib/thor/group.rb#45
2334
- def invocation_blocks; end
2335
-
2336
- # Stores invocations for this class merging with superclass values.
2337
- #
2338
- # source://thor//lib/thor/group.rb#39
2339
- def invocations; end
2340
-
2341
- # Invoke the given namespace or class given. It adds an instance
2342
- # method that will invoke the klass and command. You can give a block to
2343
- # configure how it will be invoked.
2344
- #
2345
- # The namespace/class given will have its options showed on the help
2346
- # usage. Check invoke_from_option for more information.
2347
- #
2348
- # source://thor//lib/thor/group.rb#56
2349
- def invoke(*names, &block); end
2350
-
2351
- # Invoke a thor class based on the value supplied by the user to the
2352
- # given option named "name". A class option must be created before this
2353
- # method is invoked for each name given.
2354
- #
2355
- # ==== Examples
2356
- #
2357
- # class GemGenerator < Thor::Group
2358
- # class_option :test_framework, :type => :string
2359
- # invoke_from_option :test_framework
2360
- # end
2361
- #
2362
- # ==== Boolean options
2363
- #
2364
- # In some cases, you want to invoke a thor class if some option is true or
2365
- # false. This is automatically handled by invoke_from_option. Then the
2366
- # option name is used to invoke the generator.
2367
- #
2368
- # ==== Preparing for invocation
2369
- #
2370
- # In some cases you want to customize how a specified hook is going to be
2371
- # invoked. You can do that by overwriting the class method
2372
- # prepare_for_invocation. The class method must necessarily return a klass
2373
- # and an optional command.
2374
- #
2375
- # ==== Custom invocations
2376
- #
2377
- # You can also supply a block to customize how the option is going to be
2378
- # invoked. The block receives two parameters, an instance of the current
2379
- # class and the klass to be invoked.
2380
- #
2381
- # source://thor//lib/thor/group.rb#110
2382
- def invoke_from_option(*names, &block); end
2383
-
2384
- # Returns commands ready to be printed.
2385
- #
2386
- # source://thor//lib/thor/group.rb#199
2387
- def printable_commands(*_arg0); end
2388
-
2389
- # Returns commands ready to be printed.
2390
- #
2391
- # source://thor//lib/thor/group.rb#199
2392
- def printable_tasks(*_arg0); end
2393
-
2394
- # Remove a previously added invocation.
2395
- #
2396
- # ==== Examples
2397
- #
2398
- # remove_invocation :test_framework
2399
- #
2400
- # source://thor//lib/thor/group.rb#149
2401
- def remove_invocation(*names); end
2402
-
2403
- protected
2404
-
2405
- # The banner for this class. You can customize it if you are invoking the
2406
- # thor class by another ways which is not the Thor::Runner.
2407
- #
2408
- # source://thor//lib/thor/group.rb#238
2409
- def banner; end
2410
-
2411
- # source://thor//lib/thor/group.rb#248
2412
- def baseclass; end
2413
-
2414
- # source://thor//lib/thor/group.rb#252
2415
- def create_command(meth); end
2416
-
2417
- # source://thor//lib/thor/group.rb#252
2418
- def create_task(meth); end
2419
-
2420
- # The method responsible for dispatching given the args.
2421
- #
2422
- # @yield [instance]
2423
- #
2424
- # source://thor//lib/thor/group.rb#217
2425
- def dispatch(command, given_args, given_opts, config); end
2426
-
2427
- # Represents the whole class as a command.
2428
- #
2429
- # source://thor//lib/thor/group.rb#243
2430
- def self_command; end
2431
-
2432
- # Represents the whole class as a command.
2433
- #
2434
- # source://thor//lib/thor/group.rb#243
2435
- def self_task; end
2436
- end
2437
- end
2438
-
2439
- # Shortcuts for help.
2440
- #
2441
- # source://thor//lib/thor/base.rb#17
2442
- Thor::HELP_MAPPINGS = T.let(T.unsafe(nil), Array)
2443
-
2444
- # A command that is hidden in help messages but still invocable.
2445
- #
2446
- # source://thor//lib/thor/command.rb#120
2447
- class Thor::HiddenCommand < ::Thor::Command
2448
- # @return [Boolean]
2449
- #
2450
- # source://thor//lib/thor/command.rb#121
2451
- def hidden?; end
2452
- end
2453
-
2454
- # source://thor//lib/thor/command.rb#125
2455
- Thor::HiddenTask = Thor::HiddenCommand
2456
-
2457
- # source://thor//lib/thor/invocation.rb#2
2458
- module Thor::Invocation
2459
- mixes_in_class_methods ::Thor::Invocation::ClassMethods
2460
-
2461
- # Make initializer aware of invocations and the initialization args.
2462
- #
2463
- # source://thor//lib/thor/invocation.rb#23
2464
- def initialize(args = T.unsafe(nil), options = T.unsafe(nil), config = T.unsafe(nil), &block); end
2465
-
2466
- # Make the current command chain accessible with in a Thor-(sub)command
2467
- #
2468
- # source://thor//lib/thor/invocation.rb#30
2469
- def current_command_chain; end
2470
-
2471
- # Receives a name and invokes it. The name can be a string (either "command" or
2472
- # "namespace:command"), a Thor::Command, a Class or a Thor instance. If the
2473
- # command cannot be guessed by name, it can also be supplied as second argument.
2474
- #
2475
- # You can also supply the arguments, options and configuration values for
2476
- # the command to be invoked, if none is given, the same values used to
2477
- # initialize the invoker are used to initialize the invoked.
2478
- #
2479
- # When no name is given, it will invoke the default command of the current class.
2480
- #
2481
- # ==== Examples
2482
- #
2483
- # class A < Thor
2484
- # def foo
2485
- # invoke :bar
2486
- # invoke "b:hello", ["Erik"]
2487
- # end
2488
- #
2489
- # def bar
2490
- # invoke "b:hello", ["Erik"]
2491
- # end
2492
- # end
2493
- #
2494
- # class B < Thor
2495
- # def hello(name)
2496
- # puts "hello #{name}"
2497
- # end
2498
- # end
2499
- #
2500
- # You can notice that the method "foo" above invokes two commands: "bar",
2501
- # which belongs to the same class and "hello" which belongs to the class B.
2502
- #
2503
- # By using an invocation system you ensure that a command is invoked only once.
2504
- # In the example above, invoking "foo" will invoke "b:hello" just once, even
2505
- # if it's invoked later by "bar" method.
2506
- #
2507
- # When class A invokes class B, all arguments used on A initialization are
2508
- # supplied to B. This allows lazy parse of options. Let's suppose you have
2509
- # some rspec commands:
2510
- #
2511
- # class Rspec < Thor::Group
2512
- # class_option :mock_framework, :type => :string, :default => :rr
2513
- #
2514
- # def invoke_mock_framework
2515
- # invoke "rspec:#{options[:mock_framework]}"
2516
- # end
2517
- # end
2518
- #
2519
- # As you noticed, it invokes the given mock framework, which might have its
2520
- # own options:
2521
- #
2522
- # class Rspec::RR < Thor::Group
2523
- # class_option :style, :type => :string, :default => :mock
2524
- # end
2525
- #
2526
- # Since it's not rspec concern to parse mock framework options, when RR
2527
- # is invoked all options are parsed again, so RR can extract only the options
2528
- # that it's going to use.
2529
- #
2530
- # If you want Rspec::RR to be initialized with its own set of options, you
2531
- # have to do that explicitly:
2532
- #
2533
- # invoke "rspec:rr", [], :style => :foo
2534
- #
2535
- # Besides giving an instance, you can also give a class to invoke:
2536
- #
2537
- # invoke Rspec::RR, [], :style => :foo
2538
- #
2539
- # source://thor//lib/thor/invocation.rb#102
2540
- def invoke(name = T.unsafe(nil), *args); end
2541
-
2542
- # Invoke all commands for the current instance.
2543
- #
2544
- # source://thor//lib/thor/invocation.rb#133
2545
- def invoke_all; end
2546
-
2547
- # Invoke the given command if the given args.
2548
- #
2549
- # source://thor//lib/thor/invocation.rb#122
2550
- def invoke_command(command, *args); end
2551
-
2552
- # Invoke the given command if the given args.
2553
- #
2554
- # source://thor//lib/thor/invocation.rb#122
2555
- def invoke_task(command, *args); end
2556
-
2557
- # Invokes using shell padding.
2558
- #
2559
- # source://thor//lib/thor/invocation.rb#138
2560
- def invoke_with_padding(*args); end
2561
-
2562
- protected
2563
-
2564
- # Initialize klass using values stored in the @_initializer.
2565
- #
2566
- # source://thor//lib/thor/invocation.rb#166
2567
- def _parse_initialization_options(args, opts, config); end
2568
-
2569
- # This method simply retrieves the class and command to be invoked.
2570
- # If the name is nil or the given name is a command in the current class,
2571
- # use the given name and return self as class. Otherwise, call
2572
- # prepare_for_invocation in the current class.
2573
- #
2574
- # source://thor//lib/thor/invocation.rb#153
2575
- def _retrieve_class_and_command(name, sent_command = T.unsafe(nil)); end
2576
-
2577
- # This method simply retrieves the class and command to be invoked.
2578
- # If the name is nil or the given name is a command in the current class,
2579
- # use the given name and return self as class. Otherwise, call
2580
- # prepare_for_invocation in the current class.
2581
- #
2582
- # source://thor//lib/thor/invocation.rb#153
2583
- def _retrieve_class_and_task(name, sent_command = T.unsafe(nil)); end
2584
-
2585
- # Configuration values that are shared between invocations.
2586
- #
2587
- # source://thor//lib/thor/invocation.rb#145
2588
- def _shared_configuration; end
2589
-
2590
- class << self
2591
- # source://thor//lib/thor/invocation.rb#3
2592
- def included(base); end
2593
- end
2594
- end
2595
-
2596
- # source://thor//lib/thor/invocation.rb#8
2597
- module Thor::Invocation::ClassMethods
2598
- # This method is responsible for receiving a name and find the proper
2599
- # class and command for it. The key is an optional parameter which is
2600
- # available only in class methods invocations (i.e. in Thor::Group).
2601
- #
2602
- # source://thor//lib/thor/invocation.rb#12
2603
- def prepare_for_invocation(key, name); end
2604
- end
2605
-
2606
- # Raised when a command was found, but not invoked properly.
2607
- #
2608
- # source://thor//lib/thor/error.rb#65
2609
- class Thor::InvocationError < ::Thor::Error; end
2610
-
2611
- # source://thor//lib/thor/line_editor/basic.rb#2
2612
- module Thor::LineEditor
2613
- class << self
2614
- # source://thor//lib/thor/line_editor.rb#10
2615
- def best_available; end
2616
-
2617
- # source://thor//lib/thor/line_editor.rb#6
2618
- def readline(prompt, options = T.unsafe(nil)); end
2619
- end
2620
- end
2621
-
2622
- # source://thor//lib/thor/line_editor/basic.rb#3
2623
- class Thor::LineEditor::Basic
2624
- # @return [Basic] a new instance of Basic
2625
- #
2626
- # source://thor//lib/thor/line_editor/basic.rb#10
2627
- def initialize(prompt, options); end
2628
-
2629
- # Returns the value of attribute options.
2630
- #
2631
- # source://thor//lib/thor/line_editor/basic.rb#4
2632
- def options; end
2633
-
2634
- # Returns the value of attribute prompt.
2635
- #
2636
- # source://thor//lib/thor/line_editor/basic.rb#4
2637
- def prompt; end
2638
-
2639
- # source://thor//lib/thor/line_editor/basic.rb#15
2640
- def readline; end
2641
-
2642
- private
2643
-
2644
- # @return [Boolean]
2645
- #
2646
- # source://thor//lib/thor/line_editor/basic.rb#32
2647
- def echo?; end
2648
-
2649
- # source://thor//lib/thor/line_editor/basic.rb#22
2650
- def get_input; end
2651
-
2652
- class << self
2653
- # @return [Boolean]
2654
- #
2655
- # source://thor//lib/thor/line_editor/basic.rb#6
2656
- def available?; end
2657
- end
2658
- end
2659
-
2660
- # source://thor//lib/thor/line_editor/readline.rb#3
2661
- class Thor::LineEditor::Readline < ::Thor::LineEditor::Basic
2662
- # source://thor//lib/thor/line_editor/readline.rb#13
2663
- def readline; end
2664
-
2665
- private
2666
-
2667
- # @return [Boolean]
2668
- #
2669
- # source://thor//lib/thor/line_editor/readline.rb#28
2670
- def add_to_history?; end
2671
-
2672
- # source://thor//lib/thor/line_editor/readline.rb#42
2673
- def completion_options; end
2674
-
2675
- # source://thor//lib/thor/line_editor/readline.rb#32
2676
- def completion_proc; end
2677
-
2678
- # @return [Boolean]
2679
- #
2680
- # source://thor//lib/thor/line_editor/readline.rb#46
2681
- def use_path_completion?; end
2682
-
2683
- class << self
2684
- # @return [Boolean]
2685
- #
2686
- # source://thor//lib/thor/line_editor/readline.rb#4
2687
- def available?; end
2688
- end
2689
- end
2690
-
2691
- # source://thor//lib/thor/line_editor/readline.rb#50
2692
- class Thor::LineEditor::Readline::PathCompletion
2693
- # @return [PathCompletion] a new instance of PathCompletion
2694
- #
2695
- # source://thor//lib/thor/line_editor/readline.rb#54
2696
- def initialize(text); end
2697
-
2698
- # source://thor//lib/thor/line_editor/readline.rb#58
2699
- def matches; end
2700
-
2701
- private
2702
-
2703
- # source://thor//lib/thor/line_editor/readline.rb#68
2704
- def absolute_matches; end
2705
-
2706
- # source://thor//lib/thor/line_editor/readline.rb#82
2707
- def base_path; end
2708
-
2709
- # source://thor//lib/thor/line_editor/readline.rb#78
2710
- def glob_pattern; end
2711
-
2712
- # source://thor//lib/thor/line_editor/readline.rb#64
2713
- def relative_matches; end
2714
-
2715
- # Returns the value of attribute text.
2716
- #
2717
- # source://thor//lib/thor/line_editor/readline.rb#51
2718
- def text; end
2719
- end
2720
-
2721
- # source://thor//lib/thor/error.rb#101
2722
- class Thor::MalformattedArgumentError < ::Thor::InvocationError; end
2723
-
2724
- # source://thor//lib/thor/nested_context.rb#2
2725
- class Thor::NestedContext
2726
- # @return [NestedContext] a new instance of NestedContext
2727
- #
2728
- # source://thor//lib/thor/nested_context.rb#3
2729
- def initialize; end
2730
-
2731
- # source://thor//lib/thor/nested_context.rb#7
2732
- def enter; end
2733
-
2734
- # @return [Boolean]
2735
- #
2736
- # source://thor//lib/thor/nested_context.rb#15
2737
- def entered?; end
2738
-
2739
- private
2740
-
2741
- # source://thor//lib/thor/nested_context.rb#25
2742
- def pop; end
2743
-
2744
- # source://thor//lib/thor/nested_context.rb#21
2745
- def push; end
2746
- end
2747
-
2748
- # source://thor//lib/thor/error.rb#8
2749
- class Thor::NoKwargSpellChecker < ::DidYouMean::SpellChecker
2750
- # source://thor//lib/thor/error.rb#9
2751
- def initialize(dictionary); end
2752
- end
2753
-
2754
- # source://thor//lib/thor/parser/option.rb#2
2755
- class Thor::Option < ::Thor::Argument
2756
- # @return [Option] a new instance of Option
2757
- #
2758
- # source://thor//lib/thor/parser/option.rb#7
2759
- def initialize(name, options = T.unsafe(nil)); end
2760
-
2761
- # Returns the value of attribute aliases.
2762
- #
2763
- # source://thor//lib/thor/parser/option.rb#3
2764
- def aliases; end
2765
-
2766
- # source://thor//lib/thor/parser/option.rb#105
2767
- def array?; end
2768
-
2769
- # source://thor//lib/thor/parser/option.rb#105
2770
- def boolean?; end
2771
-
2772
- # Returns the value of attribute group.
2773
- #
2774
- # source://thor//lib/thor/parser/option.rb#3
2775
- def group; end
2776
-
2777
- # source://thor//lib/thor/parser/option.rb#105
2778
- def hash?; end
2779
-
2780
- # Returns the value of attribute hide.
2781
- #
2782
- # source://thor//lib/thor/parser/option.rb#3
2783
- def hide; end
2784
-
2785
- # source://thor//lib/thor/parser/option.rb#79
2786
- def human_name; end
2787
-
2788
- # Returns the value of attribute lazy_default.
2789
- #
2790
- # source://thor//lib/thor/parser/option.rb#3
2791
- def lazy_default; end
2792
-
2793
- # source://thor//lib/thor/parser/option.rb#105
2794
- def numeric?; end
2795
-
2796
- # Returns the value of attribute repeatable.
2797
- #
2798
- # source://thor//lib/thor/parser/option.rb#3
2799
- def repeatable; end
2800
-
2801
- # source://thor//lib/thor/parser/option.rb#105
2802
- def string?; end
2803
-
2804
- # source://thor//lib/thor/parser/option.rb#75
2805
- def switch_name; end
2806
-
2807
- # source://thor//lib/thor/parser/option.rb#83
2808
- def usage(padding = T.unsafe(nil)); end
2809
-
2810
- protected
2811
-
2812
- # source://thor//lib/thor/parser/option.rb#155
2813
- def dasherize(str); end
2814
-
2815
- # @return [Boolean]
2816
- #
2817
- # source://thor//lib/thor/parser/option.rb#147
2818
- def dasherized?; end
2819
-
2820
- # source://thor//lib/thor/parser/option.rb#151
2821
- def undasherize(str); end
2822
-
2823
- # @raise [ArgumentError]
2824
- #
2825
- # source://thor//lib/thor/parser/option.rb#113
2826
- def validate!; end
2827
-
2828
- # source://thor//lib/thor/parser/option.rb#118
2829
- def validate_default_type!; end
2830
-
2831
- class << self
2832
- # This parse quick options given as method_options. It makes several
2833
- # assumptions, but you can be more specific using the option method.
2834
- #
2835
- # parse :foo => "bar"
2836
- # #=> Option foo with default value bar
2837
- #
2838
- # parse [:foo, :baz] => "bar"
2839
- # #=> Option foo with default value bar and alias :baz
2840
- #
2841
- # parse :foo => :required
2842
- # #=> Required option foo without default value
2843
- #
2844
- # parse :foo => 2
2845
- # #=> Option foo with default value 2 and type numeric
2846
- #
2847
- # parse :foo => :numeric
2848
- # #=> Option foo without default value and type numeric
2849
- #
2850
- # parse :foo => true
2851
- # #=> Option foo with default value true and type boolean
2852
- #
2853
- # The valid types are :boolean, :numeric, :hash, :array and :string. If none
2854
- # is given a default type is assumed. This default type accepts arguments as
2855
- # string (--foo=value) or booleans (just --foo).
2856
- #
2857
- # By default all options are optional, unless :required is given.
2858
- #
2859
- # source://thor//lib/thor/parser/option.rb#45
2860
- def parse(key, value); end
2861
- end
2862
- end
2863
-
2864
- # source://thor//lib/thor/parser/option.rb#5
2865
- Thor::Option::VALID_TYPES = T.let(T.unsafe(nil), Array)
2866
-
2867
- # source://thor//lib/thor/parser/options.rb#2
2868
- class Thor::Options < ::Thor::Arguments
2869
- # Takes a hash of Thor::Option and a hash with defaults.
2870
- #
2871
- # If +stop_on_unknown+ is true, #parse will stop as soon as it encounters
2872
- # an unknown option or a regular argument.
2873
- #
2874
- # @return [Options] a new instance of Options
2875
- #
2876
- # source://thor//lib/thor/parser/options.rb#32
2877
- def initialize(hash_options = T.unsafe(nil), defaults = T.unsafe(nil), stop_on_unknown = T.unsafe(nil), disable_required_check = T.unsafe(nil)); end
2878
-
2879
- # @raise [UnknownArgumentError]
2880
- #
2881
- # source://thor//lib/thor/parser/options.rb#141
2882
- def check_unknown!; end
2883
-
2884
- # source://thor//lib/thor/parser/options.rb#88
2885
- def parse(args); end
2886
-
2887
- # source://thor//lib/thor/parser/options.rb#64
2888
- def peek; end
2889
-
2890
- # source://thor//lib/thor/parser/options.rb#60
2891
- def remaining; end
2892
-
2893
- # source://thor//lib/thor/parser/options.rb#78
2894
- def shift; end
2895
-
2896
- # source://thor//lib/thor/parser/options.rb#83
2897
- def unshift(arg, is_value: T.unsafe(nil)); end
2898
-
2899
- protected
2900
-
2901
- # source://thor//lib/thor/parser/options.rb#151
2902
- def assign_result!(option, result); end
2903
-
2904
- # Check if the current value in peek is a registered switch.
2905
- #
2906
- # Two booleans are returned. The first is true if the current value
2907
- # starts with a hyphen; the second is true if it is a registered switch.
2908
- #
2909
- # @return [Boolean]
2910
- #
2911
- # source://thor//lib/thor/parser/options.rb#165
2912
- def current_is_switch?; end
2913
-
2914
- # @return [Boolean]
2915
- #
2916
- # source://thor//lib/thor/parser/options.rb#177
2917
- def current_is_switch_formatted?; end
2918
-
2919
- # @return [Boolean]
2920
- #
2921
- # source://thor//lib/thor/parser/options.rb#187
2922
- def current_is_value?; end
2923
-
2924
- # Check if the given argument is actually a shortcut.
2925
- #
2926
- # source://thor//lib/thor/parser/options.rb#206
2927
- def normalize_switch(arg); end
2928
-
2929
- # Parse boolean values which can be given as --foo=true, --foo or --no-foo.
2930
- #
2931
- # source://thor//lib/thor/parser/options.rb#217
2932
- def parse_boolean(switch); end
2933
-
2934
- # Parse the value at the peek analyzing if it requires an input or not.
2935
- #
2936
- # source://thor//lib/thor/parser/options.rb#235
2937
- def parse_peek(switch, option); end
2938
-
2939
- # @return [Boolean]
2940
- #
2941
- # source://thor//lib/thor/parser/options.rb#210
2942
- def parsing_options?; end
2943
-
2944
- # @return [Boolean]
2945
- #
2946
- # source://thor//lib/thor/parser/options.rb#192
2947
- def switch?(arg); end
2948
-
2949
- # source://thor//lib/thor/parser/options.rb#196
2950
- def switch_option(arg); end
2951
-
2952
- class << self
2953
- # Receives a hash and makes it switches.
2954
- #
2955
- # source://thor//lib/thor/parser/options.rb#11
2956
- def to_switches(options); end
2957
- end
2958
- end
2959
-
2960
- # source://thor//lib/thor/parser/options.rb#5
2961
- Thor::Options::EQ_RE = T.let(T.unsafe(nil), Regexp)
2962
-
2963
- # source://thor//lib/thor/parser/options.rb#3
2964
- Thor::Options::LONG_RE = T.let(T.unsafe(nil), Regexp)
2965
-
2966
- # source://thor//lib/thor/parser/options.rb#8
2967
- Thor::Options::OPTS_END = T.let(T.unsafe(nil), String)
2968
-
2969
- # source://thor//lib/thor/parser/options.rb#7
2970
- Thor::Options::SHORT_NUM = T.let(T.unsafe(nil), Regexp)
2971
-
2972
- # source://thor//lib/thor/parser/options.rb#4
2973
- Thor::Options::SHORT_RE = T.let(T.unsafe(nil), Regexp)
2974
-
2975
- # Allow either -x -v or -xv style for single char args
2976
- #
2977
- # source://thor//lib/thor/parser/options.rb#6
2978
- Thor::Options::SHORT_SQ_RE = T.let(T.unsafe(nil), Regexp)
2979
-
2980
- # Adds a compatibility layer to your Thor classes which allows you to use
2981
- # rake package tasks. For example, to use rspec rake tasks, one can do:
2982
- #
2983
- # require 'thor/rake_compat'
2984
- # require 'rspec/core/rake_task'
2985
- #
2986
- # class Default < Thor
2987
- # include Thor::RakeCompat
2988
- #
2989
- # RSpec::Core::RakeTask.new(:spec) do |t|
2990
- # t.spec_opts = ['--options', './.rspec']
2991
- # t.spec_files = FileList['spec/**/*_spec.rb']
2992
- # end
2993
- # end
2994
- #
2995
- # source://thor//lib/thor/rake_compat.rb#20
2996
- module Thor::RakeCompat
2997
- include ::FileUtils::StreamUtils_
2998
- include ::FileUtils
2999
- include ::Rake::FileUtilsExt
3000
- include ::Rake::DSL
3001
-
3002
- class << self
3003
- # @private
3004
- #
3005
- # source://thor//lib/thor/rake_compat.rb#27
3006
- def included(base); end
3007
-
3008
- # source://thor//lib/thor/rake_compat.rb#23
3009
- def rake_classes; end
3010
- end
3011
- end
3012
-
3013
- # source://thor//lib/thor/error.rb#98
3014
- class Thor::RequiredArgumentMissingError < ::Thor::InvocationError; end
3015
-
3016
- # source://thor//lib/thor/util.rb#4
3017
- module Thor::Sandbox; end
3018
-
3019
- # source://thor//lib/thor/shell.rb#23
3020
- module Thor::Shell
3021
- # Add shell to initialize config values.
3022
- #
3023
- # ==== Configuration
3024
- # shell<Object>:: An instance of the shell to be used.
3025
- #
3026
- # ==== Examples
3027
- #
3028
- # class MyScript < Thor
3029
- # argument :first, :type => :numeric
3030
- # end
3031
- #
3032
- # MyScript.new [1.0], { :foo => :bar }, :shell => Thor::Shell::Basic.new
3033
- #
3034
- # source://thor//lib/thor/shell.rb#44
3035
- def initialize(args = T.unsafe(nil), options = T.unsafe(nil), config = T.unsafe(nil)); end
3036
-
3037
- # source://thor//lib/thor/shell.rb#59
3038
- def ask(*args, &block); end
3039
-
3040
- # source://thor//lib/thor/shell.rb#59
3041
- def error(*args, &block); end
3042
-
3043
- # source://thor//lib/thor/shell.rb#59
3044
- def file_collision(*args, &block); end
3045
-
3046
- # source://thor//lib/thor/shell.rb#59
3047
- def no?(*args, &block); end
3048
-
3049
- # source://thor//lib/thor/shell.rb#59
3050
- def print_in_columns(*args, &block); end
3051
-
3052
- # source://thor//lib/thor/shell.rb#59
3053
- def print_table(*args, &block); end
3054
-
3055
- # source://thor//lib/thor/shell.rb#59
3056
- def print_wrapped(*args, &block); end
3057
-
3058
- # source://thor//lib/thor/shell.rb#59
3059
- def say(*args, &block); end
3060
-
3061
- # source://thor//lib/thor/shell.rb#59
3062
- def say_error(*args, &block); end
3063
-
3064
- # source://thor//lib/thor/shell.rb#59
3065
- def say_status(*args, &block); end
3066
-
3067
- # source://thor//lib/thor/shell.rb#59
3068
- def set_color(*args, &block); end
3069
-
3070
- # Holds the shell for the given Thor instance. If no shell is given,
3071
- # it gets a default shell from Thor::Base.shell.
3072
- #
3073
- # source://thor//lib/thor/shell.rb#52
3074
- def shell; end
3075
-
3076
- # Sets the attribute shell
3077
- #
3078
- # @param value the value to set the attribute shell to.
3079
- #
3080
- # source://thor//lib/thor/shell.rb#25
3081
- def shell=(_arg0); end
3082
-
3083
- # source://thor//lib/thor/shell.rb#59
3084
- def terminal_width(*args, &block); end
3085
-
3086
- # Yields the given block with padding.
3087
- #
3088
- # source://thor//lib/thor/shell.rb#66
3089
- def with_padding; end
3090
-
3091
- # source://thor//lib/thor/shell.rb#59
3092
- def yes?(*args, &block); end
3093
-
3094
- protected
3095
-
3096
- # Allow shell to be shared between invocations.
3097
- #
3098
- # source://thor//lib/thor/shell.rb#77
3099
- def _shared_configuration; end
3100
- end
3101
-
3102
- # source://thor//lib/thor/shell/basic.rb#3
3103
- class Thor::Shell::Basic
3104
- # Initialize base, mute and padding to nil.
3105
- #
3106
- # @return [Basic] a new instance of Basic
3107
- #
3108
- # source://thor//lib/thor/shell/basic.rb#11
3109
- def initialize; end
3110
-
3111
- # Asks something to the user and receives a response.
3112
- #
3113
- # If a default value is specified it will be presented to the user
3114
- # and allows them to select that value with an empty response. This
3115
- # option is ignored when limited answers are supplied.
3116
- #
3117
- # If asked to limit the correct responses, you can pass in an
3118
- # array of acceptable answers. If one of those is not supplied,
3119
- # they will be shown a message stating that one of those answers
3120
- # must be given and re-asked the question.
3121
- #
3122
- # If asking for sensitive information, the :echo option can be set
3123
- # to false to mask user input from $stdin.
3124
- #
3125
- # If the required input is a path, then set the path option to
3126
- # true. This will enable tab completion for file paths relative
3127
- # to the current working directory on systems that support
3128
- # Readline.
3129
- #
3130
- # ==== Example
3131
- # ask("What is your name?")
3132
- #
3133
- # ask("What is the planet furthest from the sun?", :default => "Pluto")
3134
- #
3135
- # ask("What is your favorite Neopolitan flavor?", :limited_to => ["strawberry", "chocolate", "vanilla"])
3136
- #
3137
- # ask("What is your password?", :echo => false)
3138
- #
3139
- # ask("Where should the file be saved?", :path => true)
3140
- #
3141
- # source://thor//lib/thor/shell/basic.rb#78
3142
- def ask(statement, *args); end
3143
-
3144
- # Returns the value of attribute base.
3145
- #
3146
- # source://thor//lib/thor/shell/basic.rb#6
3147
- def base; end
3148
-
3149
- # Sets the attribute base
3150
- #
3151
- # @param value the value to set the attribute base to.
3152
- #
3153
- # source://thor//lib/thor/shell/basic.rb#6
3154
- def base=(_arg0); end
3155
-
3156
- # Called if something goes wrong during the execution. This is used by Thor
3157
- # internally and should not be used inside your scripts. If something went
3158
- # wrong, you can always raise an exception. If you raise a Thor::Error, it
3159
- # will be rescued and wrapped in the method below.
3160
- #
3161
- # source://thor//lib/thor/shell/basic.rb#342
3162
- def error(statement); end
3163
-
3164
- # Deals with file collision and returns true if the file should be
3165
- # overwritten and false otherwise. If a block is given, it uses the block
3166
- # response as the content for the diff.
3167
- #
3168
- # ==== Parameters
3169
- # destination<String>:: the destination file to solve conflicts
3170
- # block<Proc>:: an optional block that returns the value to be used in diff and merge
3171
- #
3172
- # source://thor//lib/thor/shell/basic.rb#285
3173
- def file_collision(destination); end
3174
-
3175
- # Sets the output padding while executing a block and resets it.
3176
- #
3177
- # source://thor//lib/thor/shell/basic.rb#41
3178
- def indent(count = T.unsafe(nil)); end
3179
-
3180
- # Mute everything that's inside given block
3181
- #
3182
- # source://thor//lib/thor/shell/basic.rb#20
3183
- def mute; end
3184
-
3185
- # Check if base is muted
3186
- #
3187
- # @return [Boolean]
3188
- #
3189
- # source://thor//lib/thor/shell/basic.rb#29
3190
- def mute?; end
3191
-
3192
- # Make a question the to user and returns true if the user replies "n" or
3193
- # "no".
3194
- #
3195
- # @return [Boolean]
3196
- #
3197
- # source://thor//lib/thor/shell/basic.rb#154
3198
- def no?(statement, color = T.unsafe(nil)); end
3199
-
3200
- # Returns the value of attribute padding.
3201
- #
3202
- # source://thor//lib/thor/shell/basic.rb#7
3203
- def padding; end
3204
-
3205
- # Sets the output padding, not allowing less than zero values.
3206
- #
3207
- # source://thor//lib/thor/shell/basic.rb#35
3208
- def padding=(value); end
3209
-
3210
- # Prints values in columns
3211
- #
3212
- # ==== Parameters
3213
- # Array[String, String, ...]
3214
- #
3215
- # source://thor//lib/thor/shell/basic.rb#163
3216
- def print_in_columns(array); end
3217
-
3218
- # Prints a table.
3219
- #
3220
- # ==== Parameters
3221
- # Array[Array[String, String, ...]]
3222
- #
3223
- # ==== Options
3224
- # indent<Integer>:: Indent the first column by indent value.
3225
- # colwidth<Integer>:: Force the first column to colwidth spaces wide.
3226
- #
3227
- # source://thor//lib/thor/shell/basic.rb#185
3228
- def print_table(array, options = T.unsafe(nil)); end
3229
-
3230
- # Prints a long string, word-wrapping the text to the current width of the
3231
- # terminal display. Ideal for printing heredocs.
3232
- #
3233
- # ==== Parameters
3234
- # String
3235
- #
3236
- # ==== Options
3237
- # indent<Integer>:: Indent each line of the printed paragraph by indent value.
3238
- #
3239
- # source://thor//lib/thor/shell/basic.rb#247
3240
- def print_wrapped(message, options = T.unsafe(nil)); end
3241
-
3242
- # Say (print) something to the user. If the sentence ends with a whitespace
3243
- # or tab character, a new line is not appended (print + flush). Otherwise
3244
- # are passed straight to puts (behavior got from Highline).
3245
- #
3246
- # ==== Example
3247
- # say("I know you knew that.")
3248
- #
3249
- # source://thor//lib/thor/shell/basic.rb#96
3250
- def say(message = T.unsafe(nil), color = T.unsafe(nil), force_new_line = T.unsafe(nil)); end
3251
-
3252
- # Say (print) an error to the user. If the sentence ends with a whitespace
3253
- # or tab character, a new line is not appended (print + flush). Otherwise
3254
- # are passed straight to puts (behavior got from Highline).
3255
- #
3256
- # ==== Example
3257
- # say_error("error: something went wrong")
3258
- #
3259
- # source://thor//lib/thor/shell/basic.rb#113
3260
- def say_error(message = T.unsafe(nil), color = T.unsafe(nil), force_new_line = T.unsafe(nil)); end
3261
-
3262
- # Say a status with the given color and appends the message. Since this
3263
- # method is used frequently by actions, it allows nil or false to be given
3264
- # in log_status, avoiding the message from being shown. If a Symbol is
3265
- # given in log_status, it's used as the color.
3266
- #
3267
- # source://thor//lib/thor/shell/basic.rb#128
3268
- def say_status(status, message, log_status = T.unsafe(nil)); end
3269
-
3270
- # Apply color to the given string with optional bold. Disabled in the
3271
- # Thor::Shell::Basic class.
3272
- #
3273
- # source://thor//lib/thor/shell/basic.rb#349
3274
- def set_color(string, *_arg1); end
3275
-
3276
- # source://thor//lib/thor/shell/basic.rb#326
3277
- def terminal_width; end
3278
-
3279
- # Make a question the to user and returns true if the user replies "y" or
3280
- # "yes".
3281
- #
3282
- # @return [Boolean]
3283
- #
3284
- # source://thor//lib/thor/shell/basic.rb#147
3285
- def yes?(statement, color = T.unsafe(nil)); end
3286
-
3287
- protected
3288
-
3289
- # source://thor//lib/thor/shell/basic.rb#486
3290
- def answer_match(possibilities, answer, case_insensitive); end
3291
-
3292
- # source://thor//lib/thor/shell/basic.rb#443
3293
- def as_unicode; end
3294
-
3295
- # source://thor//lib/thor/shell/basic.rb#473
3296
- def ask_filtered(statement, color, options); end
3297
-
3298
- # source://thor//lib/thor/shell/basic.rb#456
3299
- def ask_simply(statement, color, options); end
3300
-
3301
- # @return [Boolean]
3302
- #
3303
- # source://thor//lib/thor/shell/basic.rb#360
3304
- def can_display_colors?; end
3305
-
3306
- # Calculate the dynamic width of the terminal
3307
- #
3308
- # source://thor//lib/thor/shell/basic.rb#415
3309
- def dynamic_width; end
3310
-
3311
- # source://thor//lib/thor/shell/basic.rb#419
3312
- def dynamic_width_stty; end
3313
-
3314
- # source://thor//lib/thor/shell/basic.rb#423
3315
- def dynamic_width_tput; end
3316
-
3317
- # source://thor//lib/thor/shell/basic.rb#387
3318
- def file_collision_help; end
3319
-
3320
- # source://thor//lib/thor/shell/basic.rb#507
3321
- def git_merge_tool; end
3322
-
3323
- # @return [Boolean]
3324
- #
3325
- # source://thor//lib/thor/shell/basic.rb#377
3326
- def is?(value); end
3327
-
3328
- # source://thor//lib/thor/shell/basic.rb#364
3329
- def lookup_color(color); end
3330
-
3331
- # source://thor//lib/thor/shell/basic.rb#494
3332
- def merge(destination, content); end
3333
-
3334
- # source://thor//lib/thor/shell/basic.rb#503
3335
- def merge_tool; end
3336
-
3337
- # source://thor//lib/thor/shell/basic.rb#355
3338
- def prepare_message(message, *color); end
3339
-
3340
- # @return [Boolean]
3341
- #
3342
- # source://thor//lib/thor/shell/basic.rb#410
3343
- def quiet?; end
3344
-
3345
- # source://thor//lib/thor/shell/basic.rb#399
3346
- def show_diff(destination, content); end
3347
-
3348
- # source://thor//lib/thor/shell/basic.rb#373
3349
- def stderr; end
3350
-
3351
- # source://thor//lib/thor/shell/basic.rb#369
3352
- def stdout; end
3353
-
3354
- # source://thor//lib/thor/shell/basic.rb#431
3355
- def truncate(string, width); end
3356
-
3357
- # @return [Boolean]
3358
- #
3359
- # source://thor//lib/thor/shell/basic.rb#427
3360
- def unix?; end
3361
- end
3362
-
3363
- # source://thor//lib/thor/shell/basic.rb#4
3364
- Thor::Shell::Basic::DEFAULT_TERMINAL_WIDTH = T.let(T.unsafe(nil), Integer)
3365
-
3366
- # Inherit from Thor::Shell::Basic and add set_color behavior. Check
3367
- # Thor::Shell::Basic to see all available methods.
3368
- #
3369
- # source://thor//lib/thor/shell/color.rb#9
3370
- class Thor::Shell::Color < ::Thor::Shell::Basic
3371
- # Set color by using a string or one of the defined constants. If a third
3372
- # option is set to true, it also adds bold to the string. This is based
3373
- # on Highline implementation and it automatically appends CLEAR to the end
3374
- # of the returned String.
3375
- #
3376
- # Pass foreground, background and bold options to this method as
3377
- # symbols.
3378
- #
3379
- # Example:
3380
- #
3381
- # set_color "Hi!", :red, :on_white, :bold
3382
- #
3383
- # The available colors are:
3384
- #
3385
- # :bold
3386
- # :black
3387
- # :red
3388
- # :green
3389
- # :yellow
3390
- # :blue
3391
- # :magenta
3392
- # :cyan
3393
- # :white
3394
- # :on_black
3395
- # :on_red
3396
- # :on_green
3397
- # :on_yellow
3398
- # :on_blue
3399
- # :on_magenta
3400
- # :on_cyan
3401
- # :on_white
3402
- #
3403
- # source://thor//lib/thor/shell/color.rb#79
3404
- def set_color(string, *colors); end
3405
-
3406
- protected
3407
-
3408
- # @return [Boolean]
3409
- #
3410
- # source://thor//lib/thor/shell/color.rb#107
3411
- def are_colors_disabled?; end
3412
-
3413
- # @return [Boolean]
3414
- #
3415
- # source://thor//lib/thor/shell/color.rb#103
3416
- def are_colors_supported?; end
3417
-
3418
- # @return [Boolean]
3419
- #
3420
- # source://thor//lib/thor/shell/color.rb#99
3421
- def can_display_colors?; end
3422
-
3423
- # Check if Diff::LCS is loaded. If it is, use it to create pretty output
3424
- # for diff.
3425
- #
3426
- # @return [Boolean]
3427
- #
3428
- # source://thor//lib/thor/shell/color.rb#144
3429
- def diff_lcs_loaded?; end
3430
-
3431
- # source://thor//lib/thor/shell/color.rb#127
3432
- def output_diff_line(diff); end
3433
-
3434
- # Overwrite show_diff to show diff with colors if Diff::LCS is
3435
- # available.
3436
- #
3437
- # source://thor//lib/thor/shell/color.rb#114
3438
- def show_diff(destination, content); end
3439
- end
3440
-
3441
- # Set the terminal's foreground ANSI color to black.
3442
- #
3443
- # source://thor//lib/thor/shell/color.rb#15
3444
- Thor::Shell::Color::BLACK = T.let(T.unsafe(nil), String)
3445
-
3446
- # Set the terminal's foreground ANSI color to blue.
3447
- #
3448
- # source://thor//lib/thor/shell/color.rb#23
3449
- Thor::Shell::Color::BLUE = T.let(T.unsafe(nil), String)
3450
-
3451
- # The start of an ANSI bold sequence.
3452
- #
3453
- # source://thor//lib/thor/shell/color.rb#12
3454
- Thor::Shell::Color::BOLD = T.let(T.unsafe(nil), String)
3455
-
3456
- # Embed in a String to clear all previous ANSI sequences.
3457
- #
3458
- # source://thor//lib/thor/shell/color.rb#10
3459
- Thor::Shell::Color::CLEAR = T.let(T.unsafe(nil), String)
3460
-
3461
- # Set the terminal's foreground ANSI color to cyan.
3462
- #
3463
- # source://thor//lib/thor/shell/color.rb#27
3464
- Thor::Shell::Color::CYAN = T.let(T.unsafe(nil), String)
3465
-
3466
- # Set the terminal's foreground ANSI color to green.
3467
- #
3468
- # source://thor//lib/thor/shell/color.rb#19
3469
- Thor::Shell::Color::GREEN = T.let(T.unsafe(nil), String)
3470
-
3471
- # Set the terminal's foreground ANSI color to magenta.
3472
- #
3473
- # source://thor//lib/thor/shell/color.rb#25
3474
- Thor::Shell::Color::MAGENTA = T.let(T.unsafe(nil), String)
3475
-
3476
- # Set the terminal's background ANSI color to black.
3477
- #
3478
- # source://thor//lib/thor/shell/color.rb#32
3479
- Thor::Shell::Color::ON_BLACK = T.let(T.unsafe(nil), String)
3480
-
3481
- # Set the terminal's background ANSI color to blue.
3482
- #
3483
- # source://thor//lib/thor/shell/color.rb#40
3484
- Thor::Shell::Color::ON_BLUE = T.let(T.unsafe(nil), String)
3485
-
3486
- # Set the terminal's background ANSI color to cyan.
3487
- #
3488
- # source://thor//lib/thor/shell/color.rb#44
3489
- Thor::Shell::Color::ON_CYAN = T.let(T.unsafe(nil), String)
3490
-
3491
- # Set the terminal's background ANSI color to green.
3492
- #
3493
- # source://thor//lib/thor/shell/color.rb#36
3494
- Thor::Shell::Color::ON_GREEN = T.let(T.unsafe(nil), String)
3495
-
3496
- # Set the terminal's background ANSI color to magenta.
3497
- #
3498
- # source://thor//lib/thor/shell/color.rb#42
3499
- Thor::Shell::Color::ON_MAGENTA = T.let(T.unsafe(nil), String)
3500
-
3501
- # Set the terminal's background ANSI color to red.
3502
- #
3503
- # source://thor//lib/thor/shell/color.rb#34
3504
- Thor::Shell::Color::ON_RED = T.let(T.unsafe(nil), String)
3505
-
3506
- # Set the terminal's background ANSI color to white.
3507
- #
3508
- # source://thor//lib/thor/shell/color.rb#46
3509
- Thor::Shell::Color::ON_WHITE = T.let(T.unsafe(nil), String)
3510
-
3511
- # Set the terminal's background ANSI color to yellow.
3512
- #
3513
- # source://thor//lib/thor/shell/color.rb#38
3514
- Thor::Shell::Color::ON_YELLOW = T.let(T.unsafe(nil), String)
3515
-
3516
- # Set the terminal's foreground ANSI color to red.
3517
- #
3518
- # source://thor//lib/thor/shell/color.rb#17
3519
- Thor::Shell::Color::RED = T.let(T.unsafe(nil), String)
3520
-
3521
- # Set the terminal's foreground ANSI color to white.
3522
- #
3523
- # source://thor//lib/thor/shell/color.rb#29
3524
- Thor::Shell::Color::WHITE = T.let(T.unsafe(nil), String)
3525
-
3526
- # Set the terminal's foreground ANSI color to yellow.
3527
- #
3528
- # source://thor//lib/thor/shell/color.rb#21
3529
- Thor::Shell::Color::YELLOW = T.let(T.unsafe(nil), String)
3530
-
3531
- # Inherit from Thor::Shell::Basic and add set_color behavior. Check
3532
- # Thor::Shell::Basic to see all available methods.
3533
- #
3534
- # source://thor//lib/thor/shell/html.rb#9
3535
- class Thor::Shell::HTML < ::Thor::Shell::Basic
3536
- # Ask something to the user and receives a response.
3537
- #
3538
- # ==== Example
3539
- # ask("What is your name?")
3540
- #
3541
- # TODO: Implement #ask for Thor::Shell::HTML
3542
- #
3543
- # @raise [NotImplementedError]
3544
- #
3545
- # source://thor//lib/thor/shell/html.rb#70
3546
- def ask(statement, color = T.unsafe(nil)); end
3547
-
3548
- # Set color by using a string or one of the defined constants. If a third
3549
- # option is set to true, it also adds bold to the string. This is based
3550
- # on Highline implementation and it automatically appends CLEAR to the end
3551
- # of the returned String.
3552
- #
3553
- # source://thor//lib/thor/shell/html.rb#51
3554
- def set_color(string, *colors); end
3555
-
3556
- protected
3557
-
3558
- # @return [Boolean]
3559
- #
3560
- # source://thor//lib/thor/shell/html.rb#76
3561
- def can_display_colors?; end
3562
-
3563
- # Check if Diff::LCS is loaded. If it is, use it to create pretty output
3564
- # for diff.
3565
- #
3566
- # @return [Boolean]
3567
- #
3568
- # source://thor//lib/thor/shell/html.rb#113
3569
- def diff_lcs_loaded?; end
3570
-
3571
- # source://thor//lib/thor/shell/html.rb#96
3572
- def output_diff_line(diff); end
3573
-
3574
- # Overwrite show_diff to show diff with colors if Diff::LCS is
3575
- # available.
3576
- #
3577
- # source://thor//lib/thor/shell/html.rb#83
3578
- def show_diff(destination, content); end
3579
- end
3580
-
3581
- # Set the terminal's foreground HTML color to black.
3582
- #
3583
- # source://thor//lib/thor/shell/html.rb#13
3584
- Thor::Shell::HTML::BLACK = T.let(T.unsafe(nil), String)
3585
-
3586
- # Set the terminal's foreground HTML color to blue.
3587
- #
3588
- # source://thor//lib/thor/shell/html.rb#21
3589
- Thor::Shell::HTML::BLUE = T.let(T.unsafe(nil), String)
3590
-
3591
- # The start of an HTML bold sequence.
3592
- #
3593
- # source://thor//lib/thor/shell/html.rb#10
3594
- Thor::Shell::HTML::BOLD = T.let(T.unsafe(nil), String)
3595
-
3596
- # Set the terminal's foreground HTML color to cyan.
3597
- #
3598
- # source://thor//lib/thor/shell/html.rb#25
3599
- Thor::Shell::HTML::CYAN = T.let(T.unsafe(nil), String)
3600
-
3601
- # Set the terminal's foreground HTML color to green.
3602
- #
3603
- # source://thor//lib/thor/shell/html.rb#17
3604
- Thor::Shell::HTML::GREEN = T.let(T.unsafe(nil), String)
3605
-
3606
- # Set the terminal's foreground HTML color to magenta.
3607
- #
3608
- # source://thor//lib/thor/shell/html.rb#23
3609
- Thor::Shell::HTML::MAGENTA = T.let(T.unsafe(nil), String)
3610
-
3611
- # Set the terminal's background HTML color to black.
3612
- #
3613
- # source://thor//lib/thor/shell/html.rb#30
3614
- Thor::Shell::HTML::ON_BLACK = T.let(T.unsafe(nil), String)
3615
-
3616
- # Set the terminal's background HTML color to blue.
3617
- #
3618
- # source://thor//lib/thor/shell/html.rb#38
3619
- Thor::Shell::HTML::ON_BLUE = T.let(T.unsafe(nil), String)
3620
-
3621
- # Set the terminal's background HTML color to cyan.
3622
- #
3623
- # source://thor//lib/thor/shell/html.rb#42
3624
- Thor::Shell::HTML::ON_CYAN = T.let(T.unsafe(nil), String)
3625
-
3626
- # Set the terminal's background HTML color to green.
3627
- #
3628
- # source://thor//lib/thor/shell/html.rb#34
3629
- Thor::Shell::HTML::ON_GREEN = T.let(T.unsafe(nil), String)
3630
-
3631
- # Set the terminal's background HTML color to magenta.
3632
- #
3633
- # source://thor//lib/thor/shell/html.rb#40
3634
- Thor::Shell::HTML::ON_MAGENTA = T.let(T.unsafe(nil), String)
3635
-
3636
- # Set the terminal's background HTML color to red.
3637
- #
3638
- # source://thor//lib/thor/shell/html.rb#32
3639
- Thor::Shell::HTML::ON_RED = T.let(T.unsafe(nil), String)
3640
-
3641
- # Set the terminal's background HTML color to white.
3642
- #
3643
- # source://thor//lib/thor/shell/html.rb#44
3644
- Thor::Shell::HTML::ON_WHITE = T.let(T.unsafe(nil), String)
3645
-
3646
- # Set the terminal's background HTML color to yellow.
3647
- #
3648
- # source://thor//lib/thor/shell/html.rb#36
3649
- Thor::Shell::HTML::ON_YELLOW = T.let(T.unsafe(nil), String)
3650
-
3651
- # Set the terminal's foreground HTML color to red.
3652
- #
3653
- # source://thor//lib/thor/shell/html.rb#15
3654
- Thor::Shell::HTML::RED = T.let(T.unsafe(nil), String)
3655
-
3656
- # Set the terminal's foreground HTML color to white.
3657
- #
3658
- # source://thor//lib/thor/shell/html.rb#27
3659
- Thor::Shell::HTML::WHITE = T.let(T.unsafe(nil), String)
3660
-
3661
- # Set the terminal's foreground HTML color to yellow.
3662
- #
3663
- # source://thor//lib/thor/shell/html.rb#19
3664
- Thor::Shell::HTML::YELLOW = T.let(T.unsafe(nil), String)
3665
-
3666
- # source://thor//lib/thor/shell.rb#24
3667
- Thor::Shell::SHELL_DELEGATED_METHODS = T.let(T.unsafe(nil), Array)
3668
-
3669
- # source://thor//lib/thor/base.rb#23
3670
- Thor::TEMPLATE_EXTNAME = T.let(T.unsafe(nil), String)
3671
-
3672
- # Thor methods that should not be overwritten by the user.
3673
- #
3674
- # source://thor//lib/thor/base.rb#20
3675
- Thor::THOR_RESERVED_WORDS = T.let(T.unsafe(nil), Array)
3676
-
3677
- # source://thor//lib/thor/command.rb#117
3678
- Thor::Task = Thor::Command
3679
-
3680
- # Raised when a command was not found.
3681
- #
3682
- # source://thor//lib/thor/error.rb#27
3683
- class Thor::UndefinedCommandError < ::Thor::Error
3684
- include ::DidYouMean::Correctable
3685
-
3686
- # @return [UndefinedCommandError] a new instance of UndefinedCommandError
3687
- #
3688
- # source://thor//lib/thor/error.rb#46
3689
- def initialize(command, all_commands, namespace); end
3690
-
3691
- # Returns the value of attribute all_commands.
3692
- #
3693
- # source://thor//lib/thor/error.rb#44
3694
- def all_commands; end
3695
-
3696
- # Returns the value of attribute command.
3697
- #
3698
- # source://thor//lib/thor/error.rb#44
3699
- def command; end
3700
- end
3701
-
3702
- # source://thor//lib/thor/error.rb#28
3703
- class Thor::UndefinedCommandError::SpellChecker
3704
- # @return [SpellChecker] a new instance of SpellChecker
3705
- #
3706
- # source://thor//lib/thor/error.rb#31
3707
- def initialize(error); end
3708
-
3709
- # source://thor//lib/thor/error.rb#35
3710
- def corrections; end
3711
-
3712
- # Returns the value of attribute error.
3713
- #
3714
- # source://thor//lib/thor/error.rb#29
3715
- def error; end
3716
-
3717
- # source://thor//lib/thor/error.rb#39
3718
- def spell_checker; end
3719
- end
3720
-
3721
- # source://thor//lib/thor/error.rb#58
3722
- Thor::UndefinedTaskError = Thor::UndefinedCommandError
3723
-
3724
- # source://thor//lib/thor/error.rb#68
3725
- class Thor::UnknownArgumentError < ::Thor::Error
3726
- include ::DidYouMean::Correctable
3727
-
3728
- # @return [UnknownArgumentError] a new instance of UnknownArgumentError
3729
- #
3730
- # source://thor//lib/thor/error.rb#88
3731
- def initialize(switches, unknown); end
3732
-
3733
- # Returns the value of attribute switches.
3734
- #
3735
- # source://thor//lib/thor/error.rb#86
3736
- def switches; end
3737
-
3738
- # Returns the value of attribute unknown.
3739
- #
3740
- # source://thor//lib/thor/error.rb#86
3741
- def unknown; end
3742
- end
3743
-
3744
- # source://thor//lib/thor/error.rb#69
3745
- class Thor::UnknownArgumentError::SpellChecker
3746
- # @return [SpellChecker] a new instance of SpellChecker
3747
- #
3748
- # source://thor//lib/thor/error.rb#72
3749
- def initialize(error); end
3750
-
3751
- # source://thor//lib/thor/error.rb#76
3752
- def corrections; end
3753
-
3754
- # Returns the value of attribute error.
3755
- #
3756
- # source://thor//lib/thor/error.rb#70
3757
- def error; end
3758
-
3759
- # source://thor//lib/thor/error.rb#81
3760
- def spell_checker; end
3761
- end
3762
-
3763
- # This module holds several utilities:
3764
- #
3765
- # 1) Methods to convert thor namespaces to constants and vice-versa.
3766
- #
3767
- # Thor::Util.namespace_from_thor_class(Foo::Bar::Baz) #=> "foo:bar:baz"
3768
- #
3769
- # 2) Loading thor files and sandboxing:
3770
- #
3771
- # Thor::Util.load_thorfile("~/.thor/foo")
3772
- #
3773
- # source://thor//lib/thor/util.rb#17
3774
- module Thor::Util
3775
- class << self
3776
- # Receives a string and convert it to camel case. camel_case returns CamelCase.
3777
- #
3778
- # ==== Parameters
3779
- # String
3780
- #
3781
- # ==== Returns
3782
- # String
3783
- #
3784
- # source://thor//lib/thor/util.rb#104
3785
- def camel_case(str); end
3786
-
3787
- # Returns a string that has had any glob characters escaped.
3788
- # The glob characters are `* ? { } [ ]`.
3789
- #
3790
- # ==== Examples
3791
- #
3792
- # Thor::Util.escape_globs('[apps]') # => '\[apps\]'
3793
- #
3794
- # ==== Parameters
3795
- # String
3796
- #
3797
- # ==== Returns
3798
- # String
3799
- #
3800
- # source://thor//lib/thor/util.rb#263
3801
- def escape_globs(path); end
3802
-
3803
- # Returns a string that has had any HTML characters escaped.
3804
- #
3805
- # ==== Examples
3806
- #
3807
- # Thor::Util.escape_html('<div>') # => "&lt;div&gt;"
3808
- #
3809
- # ==== Parameters
3810
- # String
3811
- #
3812
- # ==== Returns
3813
- # String
3814
- #
3815
- # source://thor//lib/thor/util.rb#279
3816
- def escape_html(string); end
3817
-
3818
- # Receives a namespace and search for it in the Thor::Base subclasses.
3819
- #
3820
- # ==== Parameters
3821
- # namespace<String>:: The namespace to search for.
3822
- #
3823
- # source://thor//lib/thor/util.rb#24
3824
- def find_by_namespace(namespace); end
3825
-
3826
- # Receives a namespace and tries to retrieve a Thor or Thor::Group class
3827
- # from it. It first searches for a class using the all the given namespace,
3828
- # if it's not found, removes the highest entry and searches for the class
3829
- # again. If found, returns the highest entry as the class name.
3830
- #
3831
- # ==== Examples
3832
- #
3833
- # class Foo::Bar < Thor
3834
- # def baz
3835
- # end
3836
- # end
3837
- #
3838
- # class Baz::Foo < Thor::Group
3839
- # end
3840
- #
3841
- # Thor::Util.namespace_to_thor_class("foo:bar") #=> Foo::Bar, nil # will invoke default command
3842
- # Thor::Util.namespace_to_thor_class("baz:foo") #=> Baz::Foo, nil
3843
- # Thor::Util.namespace_to_thor_class("foo:bar:baz") #=> Foo::Bar, "baz"
3844
- #
3845
- # ==== Parameters
3846
- # namespace<String>
3847
- #
3848
- # source://thor//lib/thor/util.rb#131
3849
- def find_class_and_command_by_namespace(namespace, fallback = T.unsafe(nil)); end
3850
-
3851
- # Receives a namespace and tries to retrieve a Thor or Thor::Group class
3852
- # from it. It first searches for a class using the all the given namespace,
3853
- # if it's not found, removes the highest entry and searches for the class
3854
- # again. If found, returns the highest entry as the class name.
3855
- #
3856
- # ==== Examples
3857
- #
3858
- # class Foo::Bar < Thor
3859
- # def baz
3860
- # end
3861
- # end
3862
- #
3863
- # class Baz::Foo < Thor::Group
3864
- # end
3865
- #
3866
- # Thor::Util.namespace_to_thor_class("foo:bar") #=> Foo::Bar, nil # will invoke default command
3867
- # Thor::Util.namespace_to_thor_class("baz:foo") #=> Baz::Foo, nil
3868
- # Thor::Util.namespace_to_thor_class("foo:bar:baz") #=> Foo::Bar, "baz"
3869
- #
3870
- # ==== Parameters
3871
- # namespace<String>
3872
- #
3873
- # source://thor//lib/thor/util.rb#131
3874
- def find_class_and_task_by_namespace(namespace, fallback = T.unsafe(nil)); end
3875
-
3876
- # Where to look for Thor files.
3877
- #
3878
- # source://thor//lib/thor/util.rb#212
3879
- def globs_for(path); end
3880
-
3881
- # Receives a path and load the thor file in the path. The file is evaluated
3882
- # inside the sandbox to avoid namespacing conflicts.
3883
- #
3884
- # source://thor//lib/thor/util.rb#152
3885
- def load_thorfile(path, content = T.unsafe(nil), debug = T.unsafe(nil)); end
3886
-
3887
- # Receives a constant and converts it to a Thor namespace. Since Thor
3888
- # commands can be added to a sandbox, this method is also responsible for
3889
- # removing the sandbox namespace.
3890
- #
3891
- # This method should not be used in general because it's used to deal with
3892
- # older versions of Thor. On current versions, if you need to get the
3893
- # namespace from a class, just call namespace on it.
3894
- #
3895
- # ==== Parameters
3896
- # constant<Object>:: The constant to be converted to the thor path.
3897
- #
3898
- # ==== Returns
3899
- # String:: If we receive Foo::Bar::Baz it returns "foo:bar:baz"
3900
- #
3901
- # source://thor//lib/thor/util.rb#43
3902
- def namespace_from_thor_class(constant); end
3903
-
3904
- # Given the contents, evaluate it inside the sandbox and returns the
3905
- # namespaces defined in the sandbox.
3906
- #
3907
- # ==== Parameters
3908
- # contents<String>
3909
- #
3910
- # ==== Returns
3911
- # Array[Object]
3912
- #
3913
- # source://thor//lib/thor/util.rb#58
3914
- def namespaces_in_content(contents, file = T.unsafe(nil)); end
3915
-
3916
- # Return the path to the ruby interpreter taking into account multiple
3917
- # installations and windows extensions.
3918
- #
3919
- # source://thor//lib/thor/util.rb#220
3920
- def ruby_command; end
3921
-
3922
- # Receives a string and convert it to snake case. SnakeCase returns snake_case.
3923
- #
3924
- # ==== Parameters
3925
- # String
3926
- #
3927
- # ==== Returns
3928
- # String
3929
- #
3930
- # source://thor//lib/thor/util.rb#90
3931
- def snake_case(str); end
3932
-
3933
- # Returns the thor classes declared inside the given class.
3934
- #
3935
- # source://thor//lib/thor/util.rb#74
3936
- def thor_classes_in(klass); end
3937
-
3938
- # Returns the root where thor files are located, depending on the OS.
3939
- #
3940
- # source://thor//lib/thor/util.rb#191
3941
- def thor_root; end
3942
-
3943
- # Returns the files in the thor root. On Windows thor_root will be something
3944
- # like this:
3945
- #
3946
- # C:\Documents and Settings\james\.thor
3947
- #
3948
- # If we don't #gsub the \ character, Dir.glob will fail.
3949
- #
3950
- # source://thor//lib/thor/util.rb#202
3951
- def thor_root_glob; end
3952
-
3953
- # source://thor//lib/thor/util.rb#167
3954
- def user_home; end
3955
- end
3956
- end