rbs_rails 0.3.0 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +18 -0
  3. data/.gitignore +3 -0
  4. data/.gitmodules +0 -0
  5. data/CHANGELOG.md +8 -0
  6. data/Gemfile +3 -2
  7. data/README.md +23 -43
  8. data/Rakefile +11 -2
  9. data/Steepfile +10 -1
  10. data/assets/sig/pg.rbs +5 -0
  11. data/assets/sig/que.rbs +4 -0
  12. data/assets/sig/queue_classic.rbs +4 -0
  13. data/assets/sig/rack.rbs +1 -0
  14. data/assets/sig/rails.rbs +1 -5
  15. data/assets/sig/sidekiq.rbs +4 -0
  16. data/assets/sig/sneakers.rbs +4 -0
  17. data/assets/sig/sucker_punch.rbs +4 -0
  18. data/bin/add-type-params.rb +7 -0
  19. data/bin/gem_rbs +94 -0
  20. data/bin/postprocess.rb +15 -6
  21. data/bin/rbs +29 -2
  22. data/bin/rbs-prototype-rb.rb +59 -6
  23. data/lib/rbs_rails.rb +4 -0
  24. data/lib/rbs_rails/active_record.rb +100 -50
  25. data/lib/rbs_rails/dependency_builder.rb +43 -0
  26. data/lib/rbs_rails/rake_task.rb +83 -0
  27. data/lib/rbs_rails/util.rb +25 -0
  28. data/lib/rbs_rails/version.rb +1 -1
  29. data/rbs_rails.gemspec +2 -1
  30. data/sig/fileutils.rbs +1 -0
  31. data/sig/rake.rbs +6 -0
  32. data/sig/rbs_rails/active_record.rbs +8 -2
  33. data/sig/rbs_rails/dependency_builder.rbs +9 -0
  34. data/sig/rbs_rails/rake_task.rbs +26 -0
  35. data/sig/rbs_rails/util.rbs +11 -0
  36. metadata +34 -13
  37. data/.travis.yml +0 -8
  38. data/assets/sig/action_controller.rbs +0 -49
  39. data/assets/sig/active_record.rbs +0 -137
  40. data/assets/sig/generated/actionpack.rbs +0 -11677
  41. data/assets/sig/generated/actionview.rbs +0 -10491
  42. data/assets/sig/generated/activemodel.rbs +0 -4139
  43. data/assets/sig/generated/activerecord-meta-programming.rbs +0 -98
  44. data/assets/sig/generated/activerecord.rbs +0 -24023
  45. data/assets/sig/generated/activesupport.rbs +0 -12207
  46. data/assets/sig/generated/railties.rbs +0 -4647
@@ -1,4647 +0,0 @@
1
- module Minitest
2
- class SuppressedSummaryReporter < SummaryReporter
3
- # Disable extra failure output after a run if output is inline.
4
- def aggregated_results: () -> untyped
5
- end
6
-
7
- def self.plugin_rails_options: (untyped opts, untyped options) -> untyped
8
-
9
- # Owes great inspiration to test runner trailblazers like RSpec,
10
- # minitest-reporters, maxitest and others.
11
- def self.plugin_rails_init: (untyped options) -> untyped
12
- end
13
-
14
- class RDoc::Generator::API < RDoc::Generator::SDoc
15
- def generate_class_tree_level: (untyped classes, ?::Hash[untyped, untyped] visited) -> untyped
16
-
17
- def build_core_ext_subtree: (untyped classes, untyped visited) -> untyped
18
-
19
- def core_extension?: (untyped klass) -> untyped
20
-
21
- def active_storage?: (untyped klass) -> untyped
22
- end
23
-
24
- module Rails
25
- module API
26
- class Task < RDoc::Task
27
- RDOC_FILES: ::Hash[untyped, untyped]
28
-
29
- def initialize: (untyped name) -> untyped
30
-
31
- # Hack, ignore the desc calls performed by the original initializer.
32
- def desc: (untyped description) -> nil
33
-
34
- def configure_sdoc: () -> untyped
35
-
36
- def configure_rdoc_files: () -> untyped
37
-
38
- def setup_horo_variables: () -> untyped
39
-
40
- def api_main: () -> untyped
41
- end
42
-
43
- class RepoTask < Task
44
- def configure_sdoc: () -> untyped
45
-
46
- def component_root_dir: (untyped component) -> untyped
47
-
48
- def api_dir: () -> "doc/rdoc"
49
- end
50
-
51
- class EdgeTask < RepoTask
52
- def rails_version: () -> ::String
53
- end
54
-
55
- class StableTask < RepoTask
56
- def rails_version: () -> untyped
57
- end
58
- end
59
- end
60
-
61
- module Rails
62
- class Application
63
- module Bootstrap
64
- include Initializable
65
- end
66
- end
67
- end
68
-
69
- module Rails
70
- class Application
71
- class Configuration < ::Rails::Engine::Configuration
72
- attr_accessor allow_concurrency: untyped
73
-
74
- attr_accessor asset_host: untyped
75
-
76
- attr_accessor autoflush_log: untyped
77
-
78
- attr_accessor cache_classes: untyped
79
-
80
- attr_accessor cache_store: untyped
81
-
82
- attr_accessor consider_all_requests_local: untyped
83
-
84
- attr_accessor console: untyped
85
-
86
- attr_accessor eager_load: untyped
87
-
88
- attr_accessor exceptions_app: untyped
89
-
90
- attr_accessor file_watcher: untyped
91
-
92
- attr_accessor filter_parameters: untyped
93
-
94
- attr_accessor force_ssl: untyped
95
-
96
- attr_accessor helpers_paths: untyped
97
-
98
- attr_accessor hosts: untyped
99
-
100
- attr_accessor logger: untyped
101
-
102
- attr_accessor log_formatter: untyped
103
-
104
- attr_accessor log_tags: untyped
105
-
106
- attr_accessor railties_order: untyped
107
-
108
- attr_accessor relative_url_root: untyped
109
-
110
- attr_accessor secret_key_base: untyped
111
-
112
- attr_accessor ssl_options: untyped
113
-
114
- attr_accessor public_file_server: untyped
115
-
116
- attr_accessor session_options: untyped
117
-
118
- attr_accessor time_zone: untyped
119
-
120
- attr_accessor reload_classes_only_on_change: untyped
121
-
122
- attr_accessor beginning_of_week: untyped
123
-
124
- attr_accessor filter_redirect: untyped
125
-
126
- attr_accessor x: untyped
127
-
128
- attr_accessor enable_dependency_loading: untyped
129
-
130
- attr_accessor read_encrypted_secrets: untyped
131
-
132
- attr_accessor log_level: untyped
133
-
134
- attr_accessor content_security_policy_report_only: untyped
135
-
136
- attr_accessor content_security_policy_nonce_generator: untyped
137
-
138
- attr_accessor content_security_policy_nonce_directives: untyped
139
-
140
- attr_accessor require_master_key: untyped
141
-
142
- attr_accessor credentials: untyped
143
-
144
- attr_accessor disable_sandbox: untyped
145
-
146
- attr_accessor add_autoload_paths_to_load_path: untyped
147
-
148
- attr_reader encoding: untyped
149
-
150
- attr_reader api_only: untyped
151
-
152
- attr_reader loaded_config_version: untyped
153
-
154
- attr_reader autoloader: untyped
155
-
156
- def initialize: () -> untyped
157
-
158
- # Loads default configurations. See {the result of the method for each version}[https://guides.rubyonrails.org/configuring.html#results-of-config-load-defaults].
159
- def load_defaults: (untyped target_version) -> untyped
160
-
161
- def encoding=: (untyped value) -> untyped
162
-
163
- def api_only=: (untyped value) -> untyped
164
-
165
- def debug_exception_response_format: () -> untyped
166
-
167
- attr_writer debug_exception_response_format: untyped
168
-
169
- def paths: () -> untyped
170
-
171
- def load_database_yaml: () -> untyped
172
-
173
- # Loads and returns the entire raw configuration of database from
174
- # values stored in <tt>config/database.yml</tt>.
175
- def database_configuration: () -> untyped
176
-
177
- def colorize_logging: () -> untyped
178
-
179
- def colorize_logging=: (untyped val) -> untyped
180
-
181
- def session_store: (?untyped? new_session_store, **untyped options) -> untyped
182
-
183
- def session_store?: () -> untyped
184
-
185
- def annotations: () -> untyped
186
-
187
- def content_security_policy: () { () -> untyped } -> untyped
188
-
189
- def autoloader=: (untyped autoloader) -> untyped
190
-
191
- def default_log_file: () -> untyped
192
-
193
- class Custom
194
- # nodoc:
195
- def initialize: () -> untyped
196
-
197
- def method_missing: (untyped method, *untyped args) -> untyped
198
-
199
- def respond_to_missing?: (untyped symbol) -> ::TrueClass
200
- end
201
-
202
- def default_credentials_content_path: () -> untyped
203
-
204
- def default_credentials_key_path: () -> untyped
205
-
206
- def credentials_available_for_current_env?: () -> untyped
207
- end
208
- end
209
- end
210
-
211
- class Rails::ApplicationController < ActionController::Base
212
- def require_local!: () -> untyped
213
-
214
- def local_request?: () -> untyped
215
-
216
- def disable_content_security_policy_nonce!: () -> untyped
217
- end
218
-
219
- module Rails
220
- class Application
221
- class DefaultMiddlewareStack
222
- attr_reader config: untyped
223
-
224
- attr_reader paths: untyped
225
-
226
- attr_reader app: untyped
227
-
228
- def initialize: (untyped app, untyped config, untyped paths) -> untyped
229
-
230
- def build_stack: () -> untyped
231
-
232
- def load_rack_cache: () -> (nil | untyped)
233
-
234
- def show_exceptions_app: () -> untyped
235
- end
236
- end
237
- end
238
-
239
- class DummyERB < ERB
240
- # These classes are used to strip out the ERB configuration
241
- # values so we can evaluate the database.yml without evaluating
242
- # the ERB values.
243
- # :nodoc:
244
- def make_compiler: (untyped trim_mode) -> DummyCompiler
245
- end
246
-
247
- class DummyCompiler < ERB::Compiler
248
- # :nodoc:
249
- def compile_content: (untyped stag, untyped `out`) -> untyped
250
- end
251
-
252
- module Rails
253
- class Application
254
- module Finisher
255
- include Initializable
256
-
257
- class MutexHook
258
- def initialize: (?untyped mutex) -> untyped
259
-
260
- def run: () -> untyped
261
-
262
- def complete: (untyped _state) -> untyped
263
- end
264
-
265
- module InterlockHook
266
- def self.run: () -> untyped
267
-
268
- def self.complete: (untyped _state) -> untyped
269
- end
270
- end
271
- end
272
- end
273
-
274
- module Rails
275
- # An Engine with the responsibility of coordinating the whole boot process.
276
- #
277
- # == Initialization
278
- #
279
- # Rails::Application is responsible for executing all railties and engines
280
- # initializers. It also executes some bootstrap initializers (check
281
- # Rails::Application::Bootstrap) and finishing initializers, after all the others
282
- # are executed (check Rails::Application::Finisher).
283
- #
284
- # == Configuration
285
- #
286
- # Besides providing the same configuration as Rails::Engine and Rails::Railtie,
287
- # the application object has several specific configurations, for example
288
- # "cache_classes", "consider_all_requests_local", "filter_parameters",
289
- # "logger" and so forth.
290
- #
291
- # Check Rails::Application::Configuration to see them all.
292
- #
293
- # == Routes
294
- #
295
- # The application object is also responsible for holding the routes and reloading routes
296
- # whenever the files change in development.
297
- #
298
- # == Middlewares
299
- #
300
- # The Application is also responsible for building the middleware stack.
301
- #
302
- # == Booting process
303
- #
304
- # The application is also responsible for setting up and executing the booting
305
- # process. From the moment you require "config/application.rb" in your app,
306
- # the booting process goes like this:
307
- #
308
- # 1) require "config/boot.rb" to setup load paths
309
- # 2) require railties and engines
310
- # 3) Define Rails.application as "class MyApp::Application < Rails::Application"
311
- # 4) Run config.before_configuration callbacks
312
- # 5) Load config/environments/ENV.rb
313
- # 6) Run config.before_initialize callbacks
314
- # 7) Run Railtie#initializer defined by railties, engines and application.
315
- # One by one, each engine sets up its load paths, routes and runs its config/initializers/* files.
316
- # 8) Custom Railtie#initializers added by railties, engines and applications are executed
317
- # 9) Build the middleware stack and run to_prepare callbacks
318
- # 10) Run config.before_eager_load and eager_load! if eager_load is true
319
- # 11) Run config.after_initialize callbacks
320
- #
321
- # == Multiple Applications
322
- #
323
- # If you decide to define multiple applications, then the first application
324
- # that is initialized will be set to +Rails.application+, unless you override
325
- # it with a different application.
326
- #
327
- # To create a new application, you can instantiate a new instance of a class
328
- # that has already been created:
329
- #
330
- # class Application < Rails::Application
331
- # end
332
- #
333
- # first_application = Application.new
334
- # second_application = Application.new(config: first_application.config)
335
- #
336
- # In the above example, the configuration from the first application was used
337
- # to initialize the second application. You can also use the +initialize_copy+
338
- # on one of the applications to create a copy of the application which shares
339
- # the configuration.
340
- #
341
- # If you decide to define Rake tasks, runners, or initializers in an
342
- # application other than +Rails.application+, then you must run them manually.
343
- class Application < Engine
344
- def self.inherited: (untyped base) -> untyped
345
-
346
- def self.`instance`: () -> untyped
347
-
348
- def self.create: (?::Hash[untyped, untyped] initial_variable_values) { () -> untyped } -> untyped
349
-
350
- def self.find_root: (untyped from) -> untyped
351
-
352
- attr_accessor assets: untyped
353
-
354
- attr_accessor sandbox: untyped
355
-
356
- attr_reader reloaders: untyped
357
-
358
- attr_reader reloader: untyped
359
-
360
- attr_reader executor: untyped
361
-
362
- INITIAL_VARIABLES: ::Array[untyped]
363
-
364
- def initialize: (?::Hash[untyped, untyped] initial_variable_values) { () -> untyped } -> untyped
365
-
366
- # Returns true if the application is initialized.
367
- def initialized?: () -> untyped
368
-
369
- def run_load_hooks!: () -> untyped
370
-
371
- # Reload application routes regardless if they changed or not.
372
- def reload_routes!: () -> untyped
373
-
374
- # Returns the application's KeyGenerator
375
- def key_generator: () -> untyped
376
-
377
- # Returns a message verifier object.
378
- #
379
- # This verifier can be used to generate and verify signed messages in the application.
380
- #
381
- # It is recommended not to use the same verifier for different things, so you can get different
382
- # verifiers passing the +verifier_name+ argument.
383
- #
384
- # ==== Parameters
385
- #
386
- # * +verifier_name+ - the name of the message verifier.
387
- #
388
- # ==== Examples
389
- #
390
- # message = Rails.application.message_verifier('sensitive_data').generate('my sensible data')
391
- # Rails.application.message_verifier('sensitive_data').verify(message)
392
- # # => 'my sensible data'
393
- #
394
- # See the +ActiveSupport::MessageVerifier+ documentation for more information.
395
- def message_verifier: (untyped verifier_name) -> untyped
396
-
397
- # Convenience for loading config/foo.yml for the current Rails env.
398
- #
399
- # Example:
400
- #
401
- # # config/exception_notification.yml:
402
- # production:
403
- # url: http://127.0.0.1:8080
404
- # namespace: my_app_production
405
- # development:
406
- # url: http://localhost:3001
407
- # namespace: my_app_development
408
- #
409
- # # config/environments/production.rb
410
- # Rails.application.configure do
411
- # config.middleware.use ExceptionNotifier, config_for(:exception_notification)
412
- # end
413
- def config_for: (untyped name, ?env: untyped env) -> untyped
414
-
415
- # Stores some of the Rails initial environment parameters which
416
- # will be used by middlewares and engines to configure themselves.
417
- def env_config: () -> untyped
418
-
419
- # If you try to define a set of Rake tasks on the instance, these will get
420
- # passed up to the Rake tasks defined on the application's class.
421
- def rake_tasks: () { () -> untyped } -> untyped
422
-
423
- # Sends the initializers to the +initializer+ method defined in the
424
- # Rails::Initializable module. Each Rails::Application class has its own
425
- # set of initializers, as defined by the Initializable module.
426
- def initializer: (untyped name, ?::Hash[untyped, untyped] opts) { () -> untyped } -> untyped
427
-
428
- # Sends any runner called in the instance of a new application up
429
- # to the +runner+ method defined in Rails::Railtie.
430
- def runner: () { () -> untyped } -> untyped
431
-
432
- # Sends any console called in the instance of a new application up
433
- # to the +console+ method defined in Rails::Railtie.
434
- def console: () { () -> untyped } -> untyped
435
-
436
- # Sends any generators called in the instance of a new application up
437
- # to the +generators+ method defined in Rails::Railtie.
438
- def generators: () { () -> untyped } -> untyped
439
-
440
- # Sends the +isolate_namespace+ method up to the class method.
441
- def isolate_namespace: (untyped mod) -> untyped
442
-
443
- def self.add_lib_to_load_path!: (untyped root) -> untyped
444
-
445
- def require_environment!: () -> untyped
446
-
447
- def routes_reloader: () -> untyped
448
-
449
- def watchable_args: () -> ::Array[untyped]
450
-
451
- def initialize!: (?::Symbol group) -> untyped
452
-
453
- def initializers: () -> untyped
454
-
455
- def config: () -> untyped
456
-
457
- attr_writer config: untyped
458
-
459
- # Returns secrets added to config/secrets.yml.
460
- #
461
- # Example:
462
- #
463
- # development:
464
- # secret_key_base: 836fa3665997a860728bcb9e9a1e704d427cfc920e79d847d79c8a9a907b9e965defa4154b2b86bdec6930adbe33f21364523a6f6ce363865724549fdfc08553
465
- # test:
466
- # secret_key_base: 5a37811464e7d378488b0f073e2193b093682e4e21f5d6f3ae0a4e1781e61a351fdc878a843424e81c73fb484a40d23f92c8dafac4870e74ede6e5e174423010
467
- # production:
468
- # secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
469
- # namespace: my_app_production
470
- #
471
- # +Rails.application.secrets.namespace+ returns +my_app_production+ in the
472
- # production environment.
473
- def secrets: () -> untyped
474
-
475
- attr_writer secrets: untyped
476
-
477
- # The secret_key_base is used as the input secret to the application's key generator, which in turn
478
- # is used to create all MessageVerifiers/MessageEncryptors, including the ones that sign and encrypt cookies.
479
- #
480
- # In development and test, this is randomly generated and stored in a
481
- # temporary file in <tt>tmp/development_secret.txt</tt>.
482
- #
483
- # In all other environments, we look for it first in ENV["SECRET_KEY_BASE"],
484
- # then credentials.secret_key_base, and finally secrets.secret_key_base. For most applications,
485
- # the correct place to store it is in the encrypted credentials file.
486
- def secret_key_base: () -> untyped
487
-
488
- # Decrypts the credentials hash as kept in +config/credentials.yml.enc+. This file is encrypted with
489
- # the Rails master key, which is either taken from <tt>ENV["RAILS_MASTER_KEY"]</tt> or from loading
490
- # +config/master.key+.
491
- # If specific credentials file exists for current environment, it takes precedence, thus for +production+
492
- # environment look first for +config/credentials/production.yml.enc+ with master key taken
493
- # from <tt>ENV["RAILS_MASTER_KEY"]</tt> or from loading +config/credentials/production.key+.
494
- # Default behavior can be overwritten by setting +config.credentials.content_path+ and +config.credentials.key_path+.
495
- def credentials: () -> untyped
496
-
497
- # Shorthand to decrypt any encrypted configurations or files.
498
- #
499
- # For any file added with <tt>rails encrypted:edit</tt> call +read+ to decrypt
500
- # the file with the master key.
501
- # The master key is either stored in +config/master.key+ or <tt>ENV["RAILS_MASTER_KEY"]</tt>.
502
- #
503
- # Rails.application.encrypted("config/mystery_man.txt.enc").read
504
- # # => "We've met before, haven't we?"
505
- #
506
- # It's also possible to interpret encrypted YAML files with +config+.
507
- #
508
- # Rails.application.encrypted("config/credentials.yml.enc").config
509
- # # => { next_guys_line: "I don't think so. Where was it you think we met?" }
510
- #
511
- # Any top-level configs are also accessible directly on the return value:
512
- #
513
- # Rails.application.encrypted("config/credentials.yml.enc").next_guys_line
514
- # # => "I don't think so. Where was it you think we met?"
515
- #
516
- # The files or configs can also be encrypted with a custom key. To decrypt with
517
- # a key in the +ENV+, use:
518
- #
519
- # Rails.application.encrypted("config/special_tokens.yml.enc", env_key: "SPECIAL_TOKENS")
520
- #
521
- # Or to decrypt with a file, that should be version control ignored, relative to +Rails.root+:
522
- #
523
- # Rails.application.encrypted("config/special_tokens.yml.enc", key_path: "config/special_tokens.key")
524
- def encrypted: (untyped path, ?key_path: ::String key_path, ?env_key: ::String env_key) -> ActiveSupport::EncryptedConfiguration
525
-
526
- def to_app: () -> untyped
527
-
528
- def helpers_paths: () -> untyped
529
-
530
- def migration_railties: () -> untyped
531
-
532
- # Eager loads the application code.
533
- def eager_load!: () -> untyped
534
-
535
- def run_tasks_blocks: (untyped app) -> untyped
536
-
537
- def run_generators_blocks: (untyped app) -> untyped
538
-
539
- def run_runner_blocks: (untyped app) -> untyped
540
-
541
- def run_console_blocks: (untyped app) -> untyped
542
-
543
- def ordered_railties: () -> untyped
544
-
545
- def railties_initializers: (untyped current) -> untyped
546
-
547
- def default_middleware_stack: () -> untyped
548
-
549
- def validate_secret_key_base: (untyped secret_key_base) -> untyped
550
-
551
- def generate_development_secret: () -> untyped
552
-
553
- def build_request: (untyped env) -> untyped
554
-
555
- def build_middleware: () -> untyped
556
-
557
- class NonSymbolAccessDeprecatedHash[T, U] < HashWithIndifferentAccess[T, U]
558
- # :nodoc:
559
- def initialize: (?untyped? value) -> untyped
560
-
561
- def []=: (untyped key, untyped value) -> untyped
562
-
563
- def convert_key: (untyped key) -> untyped
564
-
565
- def convert_value: (untyped value, ?::Hash[untyped, untyped] options) -> untyped
566
- end
567
- end
568
- end
569
-
570
- module Rails
571
- class Application
572
- class RoutesReloader
573
- attr_reader route_sets: untyped
574
-
575
- attr_reader paths: untyped
576
-
577
- attr_accessor eager_load: untyped
578
-
579
- def initialize: () -> untyped
580
-
581
- def reload!: () -> untyped
582
-
583
- def updater: () -> untyped
584
-
585
- def clear!: () -> untyped
586
-
587
- def load_paths: () -> untyped
588
-
589
- def finalize!: () -> untyped
590
-
591
- def revert: () -> untyped
592
- end
593
- end
594
- end
595
-
596
- module Rails
597
- module AppLoader
598
- RUBY: untyped
599
-
600
- EXECUTABLES: ::Array[untyped]
601
-
602
- BUNDLER_WARNING: ::String
603
-
604
- def exec_app: () -> (nil | untyped)
605
-
606
- def find_executable: () -> untyped
607
- end
608
- end
609
-
610
- module Rails
611
- class AppUpdater
612
- def self.invoke_from_app_generator: (untyped method) -> untyped
613
-
614
- def self.app_generator: () -> untyped
615
-
616
- def self.generator_options: () -> untyped
617
- end
618
- end
619
-
620
- module Rails
621
- module Autoloaders
622
- include Enumerable[untyped, untyped]
623
-
624
- def self.main: () -> untyped
625
-
626
- def self.once: () -> untyped
627
-
628
- def self.each: () { (untyped) -> untyped } -> untyped
629
-
630
- def self.logger=: (untyped logger) -> untyped
631
-
632
- def self.log!: () -> untyped
633
-
634
- def self.zeitwerk_enabled?: () -> untyped
635
- end
636
- end
637
-
638
- module Rails
639
- class BacktraceCleaner < ActiveSupport::BacktraceCleaner
640
- APP_DIRS_PATTERN: untyped
641
-
642
- RENDER_TEMPLATE_PATTERN: untyped
643
-
644
- EMPTY_STRING: ::String
645
-
646
- SLASH: ::String
647
-
648
- DOT_SLASH: ::String
649
-
650
- def initialize: () -> untyped
651
- end
652
- end
653
-
654
- class CodeStatisticsCalculator
655
- # nodoc:
656
- attr_reader lines: untyped
657
-
658
- # nodoc:
659
- attr_reader code_lines: untyped
660
-
661
- # nodoc:
662
- attr_reader classes: untyped
663
-
664
- # nodoc:
665
- attr_reader methods: untyped
666
-
667
- PATTERNS: ::Hash[untyped, untyped]
668
-
669
- def initialize: (?::Integer lines, ?::Integer code_lines, ?::Integer classes, ?::Integer methods) -> untyped
670
-
671
- def add: (untyped code_statistics_calculator) -> untyped
672
-
673
- def add_by_file_path: (untyped file_path) -> untyped
674
-
675
- def add_by_io: (untyped io, untyped file_type) -> untyped
676
-
677
- def file_type: (untyped file_path) -> untyped
678
- end
679
-
680
- class CodeStatistics
681
- # nodoc:
682
- TEST_TYPES: ::Array[untyped]
683
-
684
- HEADERS: ::Hash[untyped, untyped]
685
-
686
- def initialize: (*untyped pairs) -> untyped
687
-
688
- def to_s: () -> untyped
689
-
690
- def calculate_statistics: () -> untyped
691
-
692
- def calculate_directory_statistics: (untyped directory, ?untyped pattern) -> untyped
693
-
694
- def calculate_total: () -> untyped
695
-
696
- def calculate_code: () -> untyped
697
-
698
- def calculate_tests: () -> untyped
699
-
700
- def width_for: (untyped label) -> untyped
701
-
702
- def print_header: () -> untyped
703
-
704
- def print_splitter: () -> untyped
705
-
706
- def print_line: (untyped name, untyped statistics) -> untyped
707
-
708
- def print_code_test_stats: () -> untyped
709
- end
710
-
711
- module Rails
712
- module Command
713
- extend ::Rails::Command::Behavior::ClassMethods
714
-
715
- module Actions
716
- # Change to the application's path if there is no <tt>config.ru</tt> file in current directory.
717
- # This allows us to run <tt>rails server</tt> from other directories, but still get
718
- # the main <tt>config.ru</tt> and properly set the <tt>tmp</tt> directory.
719
- def set_application_directory!: () -> untyped
720
-
721
- def require_application_and_environment!: () -> untyped
722
-
723
- def require_application!: () -> untyped
724
-
725
- def require_environment!: () -> untyped
726
-
727
- def load_tasks: () -> untyped
728
-
729
- def load_generators: () -> untyped
730
- end
731
- end
732
- end
733
-
734
- module Rails
735
- module Command
736
- class Base < Thor
737
- class Error < Thor::Error
738
- end
739
-
740
- include Actions
741
-
742
- def self.exit_on_failure?: () -> ::FalseClass
743
-
744
- # Returns true when the app is a Rails engine.
745
- def self.engine?: () -> untyped
746
-
747
- # Tries to get the description from a USAGE file one folder above the command
748
- # root.
749
- def self.desc: (?untyped? usage, ?untyped? description, ?::Hash[untyped, untyped] options) -> untyped
750
-
751
- # Convenience method to get the namespace from the class name. It's the
752
- # same as Thor default except that the Command at the end of the class
753
- # is removed.
754
- def self.namespace: (?untyped? name) -> untyped
755
-
756
- # Convenience method to hide this command from the available ones when
757
- # running rails command.
758
- def self.hide_command!: () -> untyped
759
-
760
- def self.inherited: (untyped base) -> untyped
761
-
762
- def self.perform: (untyped command, untyped args, untyped config) -> untyped
763
-
764
- def self.printing_commands: () -> untyped
765
-
766
- def self.executable: () -> ::String
767
-
768
- # Use Rails' default banner.
769
- def self.banner: () -> untyped
770
-
771
- # Sets the base_name taking into account the current class namespace.
772
- #
773
- # Rails::Command::TestCommand.base_name # => 'rails'
774
- def self.base_name: () -> untyped
775
-
776
- # Return command name without namespaces.
777
- #
778
- # Rails::Command::TestCommand.command_name # => 'test'
779
- def self.command_name: () -> untyped
780
-
781
- # Path to lookup a USAGE description in a file.
782
- def self.usage_path: () -> untyped
783
-
784
- # Default file root to place extra files a command might need, placed
785
- # one folder above the command file.
786
- #
787
- # For a Rails::Command::TestCommand placed in <tt>rails/command/test_command.rb</tt>
788
- # would return <tt>rails/test</tt>.
789
- def self.default_command_root: () -> untyped
790
-
791
- # Allow the command method to be called perform.
792
- def self.create_command: (untyped meth) -> untyped
793
-
794
- def self.command_root_namespace: () -> untyped
795
-
796
- def self.relative_command_path: () -> untyped
797
-
798
- def self.namespaced_commands: () -> untyped
799
-
800
- def help: () -> untyped
801
- end
802
- end
803
- end
804
-
805
- module Rails
806
- module Command
807
- module Behavior
808
- # nodoc:
809
- extend ActiveSupport::Concern
810
-
811
- module ClassMethods
812
- # Remove the color from output.
813
- def no_color!: () -> untyped
814
-
815
- # Track all command subclasses.
816
- def subclasses: () -> untyped
817
-
818
- # Prints a list of generators.
819
- def print_list: (untyped base, untyped namespaces) -> (nil | untyped)
820
-
821
- # Receives namespaces in an array and tries to find matching generators
822
- # in the load path.
823
- def lookup: (untyped namespaces) -> (nil | untyped)
824
-
825
- # This will try to load any command in the load path to show in help.
826
- def lookup!: () -> untyped
827
-
828
- # Convert namespaces to paths by replacing ":" for "/" and adding
829
- # an extra lookup. For example, "rails:model" should be searched
830
- # in both: "rails/model/model_generator" and "rails/model_generator".
831
- def namespaces_to_paths: (untyped namespaces) -> untyped
832
- end
833
- end
834
- end
835
- end
836
-
837
- module Rails
838
- module Command
839
- module EnvironmentArgument
840
- # nodoc:
841
- extend ActiveSupport::Concern
842
-
843
- def extract_environment_option_from_argument: (?default_environment: untyped default_environment) -> untyped
844
-
845
- def acceptable_environment: (?untyped? env) -> untyped
846
-
847
- def available_environments: () -> untyped
848
- end
849
- end
850
- end
851
-
852
- module Rails
853
- module Command
854
- module Helpers
855
- module Editor
856
- def ensure_editor_available: (command: untyped command) -> untyped
857
-
858
- def catch_editing_exceptions: () { () -> untyped } -> untyped
859
- end
860
- end
861
- end
862
- end
863
-
864
- module Rails
865
- module Command
866
- extend ActiveSupport::Autoload
867
-
868
- include Behavior
869
-
870
- HELP_MAPPINGS: ::Array[untyped]
871
-
872
- def self.hidden_commands: () -> untyped
873
-
874
- def self.environment: () -> untyped
875
-
876
- # Receives a namespace, arguments and the behavior to invoke the command.
877
- def self.invoke: (untyped full_namespace, ?untyped args, **untyped config) -> untyped
878
-
879
- def self.find_by_namespace: (untyped namespace, ?untyped? command_name) -> untyped
880
-
881
- # Returns the root of the Rails engine or app running the command.
882
- def self.root: () -> untyped
883
-
884
- def self.print_commands: () -> untyped
885
-
886
- COMMANDS_IN_USAGE: ::Array[untyped]
887
-
888
- def self.commands: () -> untyped
889
-
890
- def self.command_type: () -> untyped
891
-
892
- def self.lookup_paths: () -> untyped
893
-
894
- def self.file_lookup_paths: () -> untyped
895
- end
896
- end
897
-
898
- module Rails
899
- module Generators
900
- extend ::Rails::Command::Behavior::ClassMethods
901
-
902
- class AppGenerator
903
- # :nodoc:
904
- # We want to exit on failure to be kind to other libraries
905
- # This is only when accessing via CLI
906
- def self.exit_on_failure?: () -> ::TrueClass
907
- end
908
- end
909
-
910
- module Command
911
- class ApplicationCommand < Base
912
- def help: () -> untyped
913
-
914
- def perform: (*untyped args) -> untyped
915
- end
916
- end
917
- end
918
-
919
- module Rails
920
- class Console
921
- module BacktraceCleaner
922
- def filter_backtrace: (untyped bt) -> untyped
923
- end
924
-
925
- def self.start: (*untyped args) -> untyped
926
-
927
- attr_reader options: untyped
928
-
929
- attr_reader app: untyped
930
-
931
- attr_reader console: untyped
932
-
933
- def initialize: (untyped app, ?::Hash[untyped, untyped] options) -> untyped
934
-
935
- def sandbox?: () -> untyped
936
-
937
- def environment: () -> untyped
938
-
939
- def set_environment!: () -> untyped
940
-
941
- def start: () -> untyped
942
- end
943
-
944
- module Command
945
- class ConsoleCommand < Base
946
- # :nodoc:
947
- include EnvironmentArgument
948
-
949
- def initialize: (?untyped args, ?::Hash[untyped, untyped] local_options, ?::Hash[untyped, untyped] config) -> untyped
950
-
951
- def perform: () -> untyped
952
- end
953
- end
954
- end
955
-
956
- module Rails
957
- module Command
958
- class CredentialsCommand < Rails::Command::Base
959
- # :nodoc:
960
- include Helpers::Editor
961
-
962
- include EnvironmentArgument
963
-
964
- def help: () -> untyped
965
-
966
- def edit: () -> untyped
967
-
968
- def show: () -> untyped
969
-
970
- def credentials: () -> untyped
971
-
972
- def ensure_encryption_key_has_been_added: () -> untyped
973
-
974
- def ensure_credentials_have_been_added: () -> untyped
975
-
976
- def change_credentials_in_system_editor: () -> untyped
977
-
978
- def missing_credentials_message: () -> untyped
979
-
980
- def content_path: () -> untyped
981
-
982
- def key_path: () -> untyped
983
-
984
- def encryption_key_file_generator: () -> Rails::Generators::EncryptionKeyFileGenerator
985
-
986
- def encrypted_file_generator: () -> Rails::Generators::EncryptedFileGenerator
987
-
988
- def credentials_generator: () -> Rails::Generators::CredentialsGenerator
989
- end
990
- end
991
- end
992
-
993
- module Rails
994
- class DBConsole
995
- def self.start: (*untyped args) -> untyped
996
-
997
- def initialize: (?::Hash[untyped, untyped] options) -> untyped
998
-
999
- def start: () -> untyped
1000
-
1001
- def config: () -> untyped
1002
-
1003
- def environment: () -> untyped
1004
-
1005
- def database: () -> untyped
1006
-
1007
- def configurations: () -> untyped
1008
-
1009
- def find_cmd_and_exec: (untyped commands, *untyped args) -> untyped
1010
- end
1011
-
1012
- module Command
1013
- class DbconsoleCommand < Base
1014
- # :nodoc:
1015
- include EnvironmentArgument
1016
-
1017
- def perform: () -> untyped
1018
- end
1019
- end
1020
- end
1021
-
1022
- module Rails
1023
- module Command
1024
- module Db
1025
- module System
1026
- class ChangeCommand < Base
1027
- def perform: () -> untyped
1028
- end
1029
- end
1030
- end
1031
- end
1032
- end
1033
-
1034
- module Rails
1035
- module Command
1036
- class DestroyCommand < Base
1037
- def help: () -> untyped
1038
-
1039
- def perform: () -> untyped
1040
- end
1041
- end
1042
- end
1043
-
1044
- module Rails
1045
- module Command
1046
- class DevCommand < Base
1047
- def help: () -> untyped
1048
-
1049
- def cache: () -> untyped
1050
- end
1051
- end
1052
- end
1053
-
1054
- module Rails
1055
- module Command
1056
- class EncryptedCommand < Rails::Command::Base
1057
- # :nodoc:
1058
- include Helpers::Editor
1059
-
1060
- def help: () -> untyped
1061
-
1062
- def edit: (untyped file_path) -> untyped
1063
-
1064
- def show: (untyped file_path) -> untyped
1065
-
1066
- def ensure_encryption_key_has_been_added: (untyped key_path) -> untyped
1067
-
1068
- def ensure_encrypted_file_has_been_added: (untyped file_path, untyped key_path) -> untyped
1069
-
1070
- def change_encrypted_file_in_system_editor: (untyped file_path, untyped key_path) -> untyped
1071
-
1072
- def encryption_key_file_generator: () -> Rails::Generators::EncryptionKeyFileGenerator
1073
-
1074
- def encrypted_file_generator: () -> Rails::Generators::EncryptedFileGenerator
1075
-
1076
- def missing_encrypted_message: (key: untyped key, key_path: untyped key_path, file_path: untyped file_path) -> untyped
1077
- end
1078
- end
1079
- end
1080
-
1081
- module Rails
1082
- module Command
1083
- class GenerateCommand < Base
1084
- def help: () -> untyped
1085
-
1086
- def perform: () -> untyped
1087
- end
1088
- end
1089
- end
1090
-
1091
- module Rails
1092
- module Command
1093
- class HelpCommand < Base
1094
- def help: () -> untyped
1095
- end
1096
- end
1097
- end
1098
-
1099
- module Rails
1100
- module Command
1101
- class InitializersCommand < Base
1102
- # :nodoc:
1103
- include EnvironmentArgument
1104
-
1105
- def perform: () -> untyped
1106
- end
1107
- end
1108
- end
1109
-
1110
- module Rails
1111
- module Command
1112
- class NewCommand < Base
1113
- def help: () -> untyped
1114
-
1115
- def perform: () -> untyped
1116
- end
1117
- end
1118
- end
1119
-
1120
- module Rails
1121
- module Command
1122
- class NotesCommand < Base
1123
- def perform: () -> untyped
1124
-
1125
- def display_annotations: () -> untyped
1126
-
1127
- def directories: () -> untyped
1128
-
1129
- def deprecation_warning: () -> (nil | untyped)
1130
-
1131
- def source_annotation_directories: () -> untyped
1132
- end
1133
- end
1134
- end
1135
-
1136
- module Rails
1137
- module Command
1138
- module Spellchecker
1139
- def self.suggest: (untyped word, from: untyped from) -> untyped
1140
-
1141
- def self.levenshtein_distance: (untyped str1, untyped str2) -> untyped
1142
- end
1143
- end
1144
- end
1145
-
1146
- module Rails
1147
- module Command
1148
- class PluginCommand < Base
1149
- def help: () -> untyped
1150
-
1151
- def self.banner: () -> ::String
1152
-
1153
- def perform: (?untyped? `type`, *untyped plugin_args) -> untyped
1154
-
1155
- def run_plugin_generator: (untyped plugin_args) -> untyped
1156
- end
1157
- end
1158
- end
1159
-
1160
- module Rails
1161
- module Command
1162
- class RakeCommand < Base
1163
- # :nodoc:
1164
- extend Rails::Command::Actions
1165
-
1166
- def self.printing_commands: () -> untyped
1167
-
1168
- def self.perform: (untyped task) -> untyped
1169
-
1170
- def self.rake_tasks: () -> untyped
1171
-
1172
- def self.formatted_rake_tasks: () -> untyped
1173
-
1174
- def self.require_rake: () -> untyped
1175
- end
1176
- end
1177
- end
1178
-
1179
- module Rails
1180
- module Command
1181
- class RoutesCommand < Base
1182
- def perform: () -> untyped
1183
-
1184
- def inspector: () -> ActionDispatch::Routing::RoutesInspector
1185
-
1186
- def formatter: () -> untyped
1187
-
1188
- def routes_filter: () -> untyped
1189
- end
1190
- end
1191
- end
1192
-
1193
- module Rails
1194
- module Command
1195
- class RunnerCommand < Base
1196
- # :nodoc:
1197
- include EnvironmentArgument
1198
-
1199
- def help: () -> untyped
1200
-
1201
- def self.banner: () -> ::String
1202
-
1203
- def perform: (?untyped? code_or_file, *untyped command_argv) -> untyped
1204
- end
1205
- end
1206
- end
1207
-
1208
- module Rails
1209
- module Command
1210
- class SecretsCommand < Rails::Command::Base
1211
- def help: () -> untyped
1212
-
1213
- def setup: () -> untyped
1214
-
1215
- def edit: () -> untyped
1216
-
1217
- def show: () -> untyped
1218
-
1219
- def deprecate_in_favor_of_credentials_and_exit: () -> untyped
1220
- end
1221
- end
1222
- end
1223
-
1224
- module Rails
1225
- class Server < ::Rack::Server
1226
- class Options
1227
- def parse!: (untyped args) -> untyped
1228
- end
1229
-
1230
- def initialize: (?untyped? options) -> untyped
1231
-
1232
- def opt_parser: () -> Options
1233
-
1234
- def set_environment: () -> untyped
1235
-
1236
- def start: (?untyped? after_stop_callback) -> untyped
1237
-
1238
- def serveable?: () -> untyped
1239
-
1240
- def middleware: () -> Hash[untyped, untyped]
1241
-
1242
- def default_options: () -> untyped
1243
-
1244
- def served_url: () -> untyped
1245
-
1246
- def setup_dev_caching: () -> untyped
1247
-
1248
- def create_tmp_directories: () -> untyped
1249
-
1250
- def log_to_stdout: () -> untyped
1251
-
1252
- def use_puma?: () -> untyped
1253
- end
1254
-
1255
- module Command
1256
- class ServerCommand < Base
1257
- # :nodoc:
1258
- include EnvironmentArgument
1259
-
1260
- # Hard-coding a bunch of handlers here as we don't have a public way of
1261
- # querying them from the Rack::Handler registry.
1262
- RACK_SERVERS: ::Array[untyped]
1263
-
1264
- DEFAULT_PORT: ::Integer
1265
-
1266
- DEFAULT_PID_PATH: ::String
1267
-
1268
- def initialize: (untyped args, untyped local_options) -> untyped
1269
-
1270
- def perform: () -> untyped
1271
-
1272
- def server_options: () -> { user_supplied_options: untyped, server: untyped, :log_stdout => untyped, Port: untyped, Host: untyped, DoNotReverseLookup: ::TrueClass, config: untyped, environment: untyped, daemonize: untyped, pid: untyped, caching: untyped, restart_cmd: untyped, early_hints: untyped }
1273
-
1274
- def user_supplied_options: () -> untyped
1275
-
1276
- def port: () -> untyped
1277
-
1278
- def host: () -> untyped
1279
-
1280
- def environment: () -> untyped
1281
-
1282
- def restart_command: () -> ::String
1283
-
1284
- def early_hints: () -> untyped
1285
-
1286
- def log_to_stdout?: () -> untyped
1287
-
1288
- def pid: () -> untyped
1289
-
1290
- def self.banner: () -> "rails server -u [thin/puma/webrick] [options]"
1291
-
1292
- def prepare_restart: () -> untyped
1293
-
1294
- def deprecate_positional_rack_server_and_rewrite_to_option: (untyped original_options) -> untyped
1295
-
1296
- def rack_server_suggestion: (untyped server) -> untyped
1297
-
1298
- def print_boot_information: (untyped server, untyped url) -> untyped
1299
- end
1300
- end
1301
- end
1302
-
1303
- module Rails
1304
- module Command
1305
- class TestCommand < Base
1306
- def help: () -> untyped
1307
-
1308
- def perform: () -> untyped
1309
- end
1310
- end
1311
- end
1312
-
1313
- module Rails
1314
- module Command
1315
- class VersionCommand < Base
1316
- # :nodoc:
1317
- def perform: () -> untyped
1318
- end
1319
- end
1320
- end
1321
-
1322
- module Rails
1323
- module Configuration
1324
- # MiddlewareStackProxy is a proxy for the Rails middleware stack that allows
1325
- # you to configure middlewares in your application. It works basically as a
1326
- # command recorder, saving each command to be applied after initialization
1327
- # over the default middleware stack, so you can add, swap, or remove any
1328
- # middleware in Rails.
1329
- #
1330
- # You can add your own middlewares by using the +config.middleware.use+ method:
1331
- #
1332
- # config.middleware.use Magical::Unicorns
1333
- #
1334
- # This will put the <tt>Magical::Unicorns</tt> middleware on the end of the stack.
1335
- # You can use +insert_before+ if you wish to add a middleware before another:
1336
- #
1337
- # config.middleware.insert_before Rack::Head, Magical::Unicorns
1338
- #
1339
- # There's also +insert_after+ which will insert a middleware after another:
1340
- #
1341
- # config.middleware.insert_after Rack::Head, Magical::Unicorns
1342
- #
1343
- # Middlewares can also be completely swapped out and replaced with others:
1344
- #
1345
- # config.middleware.swap ActionDispatch::Flash, Magical::Unicorns
1346
- #
1347
- # And finally they can also be removed from the stack completely:
1348
- #
1349
- # config.middleware.delete ActionDispatch::Flash
1350
- #
1351
- class MiddlewareStackProxy
1352
- def initialize: (?untyped operations, ?untyped delete_operations) -> untyped
1353
-
1354
- def insert_before: (*untyped args) { () -> untyped } -> untyped
1355
-
1356
- def insert_after: (*untyped args) { () -> untyped } -> untyped
1357
-
1358
- def swap: (*untyped args) { () -> untyped } -> untyped
1359
-
1360
- def use: (*untyped args) { () -> untyped } -> untyped
1361
-
1362
- def delete: (*untyped args) { () -> untyped } -> untyped
1363
-
1364
- def unshift: (*untyped args) { () -> untyped } -> untyped
1365
-
1366
- def merge_into: (untyped other) -> untyped
1367
-
1368
- def +: (untyped other) -> MiddlewareStackProxy
1369
-
1370
- attr_reader operations: untyped
1371
-
1372
- attr_reader delete_operations: untyped
1373
- end
1374
-
1375
- class Generators
1376
- # nodoc:
1377
- attr_accessor aliases: untyped
1378
-
1379
- # nodoc:
1380
- attr_accessor options: untyped
1381
-
1382
- # nodoc:
1383
- attr_accessor templates: untyped
1384
-
1385
- # nodoc:
1386
- attr_accessor fallbacks: untyped
1387
-
1388
- # nodoc:
1389
- attr_accessor colorize_logging: untyped
1390
-
1391
- # nodoc:
1392
- attr_accessor api_only: untyped
1393
-
1394
- attr_reader hidden_namespaces: untyped
1395
-
1396
- def initialize: () -> untyped
1397
-
1398
- def initialize_copy: (untyped source) -> untyped
1399
-
1400
- def hide_namespace: (untyped namespace) -> untyped
1401
-
1402
- def method_missing: (untyped method, *untyped args) -> untyped
1403
- end
1404
- end
1405
- end
1406
-
1407
- module Rails
1408
- module ConsoleMethods
1409
- # reference the global "app" instance, created on demand. To recreate the
1410
- # instance, pass a non-false value as the parameter.
1411
- def app: (?bool create) -> untyped
1412
-
1413
- # create a new session. If a block is given, the new session will be yielded
1414
- # to the block before being returned.
1415
- def new_session: () { (untyped) -> untyped } -> untyped
1416
-
1417
- # reloads the environment
1418
- def reload!: (?bool print) -> ::TrueClass
1419
- end
1420
- end
1421
-
1422
- module Rails
1423
- module ConsoleMethods
1424
- # Gets the helper methods available to the controller.
1425
- #
1426
- # This method assumes an +ApplicationController+ exists, and it extends +ActionController::Base+
1427
- def helper: () -> untyped
1428
-
1429
- # Gets a new instance of a controller object.
1430
- #
1431
- # This method assumes an +ApplicationController+ exists, and it extends +ActionController::Base+
1432
- def controller: () -> untyped
1433
- end
1434
- end
1435
-
1436
- module Rails
1437
- module DevCaching
1438
- FILE: ::String
1439
-
1440
- def self.enable_by_file: () -> untyped
1441
-
1442
- def self.enable_by_argument: (untyped caching) -> untyped
1443
-
1444
- def self.create_cache_file: () -> untyped
1445
-
1446
- def self.delete_cache_file: () -> untyped
1447
- end
1448
- end
1449
-
1450
- APP_PATH: untyped
1451
-
1452
- module Rails
1453
- class Engine
1454
- class Configuration < ::Rails::Railtie::Configuration
1455
- attr_reader root: untyped
1456
-
1457
- attr_accessor middleware: untyped
1458
-
1459
- attr_accessor javascript_path: untyped
1460
-
1461
- attr_writer eager_load_paths: untyped
1462
-
1463
- attr_writer autoload_once_paths: untyped
1464
-
1465
- attr_writer autoload_paths: untyped
1466
-
1467
- def initialize: (?untyped? root) -> untyped
1468
-
1469
- # Holds generators configuration:
1470
- #
1471
- # config.generators do |g|
1472
- # g.orm :data_mapper, migration: true
1473
- # g.template_engine :haml
1474
- # g.test_framework :rspec
1475
- # end
1476
- #
1477
- # If you want to disable color in console, do:
1478
- #
1479
- # config.generators.colorize_logging = false
1480
- #
1481
- def generators: () { (untyped) -> untyped } -> untyped
1482
-
1483
- def paths: () -> untyped
1484
-
1485
- def root=: (untyped value) -> untyped
1486
-
1487
- def eager_load_paths: () -> untyped
1488
-
1489
- def autoload_once_paths: () -> untyped
1490
-
1491
- def autoload_paths: () -> untyped
1492
- end
1493
- end
1494
- end
1495
-
1496
- module Rails
1497
- class Engine < Railtie
1498
- class Railties
1499
- include Enumerable[untyped, untyped]
1500
-
1501
- attr_reader _all: untyped
1502
-
1503
- def initialize: () -> untyped
1504
-
1505
- def each: (*untyped args) { () -> untyped } -> untyped
1506
-
1507
- def -: (untyped others) -> untyped
1508
- end
1509
- end
1510
- end
1511
-
1512
- module Rails
1513
- # <tt>Rails::Engine</tt> allows you to wrap a specific Rails application or subset of
1514
- # functionality and share it with other applications or within a larger packaged application.
1515
- # Every <tt>Rails::Application</tt> is just an engine, which allows for simple
1516
- # feature and application sharing.
1517
- #
1518
- # Any <tt>Rails::Engine</tt> is also a <tt>Rails::Railtie</tt>, so the same
1519
- # methods (like <tt>rake_tasks</tt> and +generators+) and configuration
1520
- # options that are available in railties can also be used in engines.
1521
- #
1522
- # == Creating an Engine
1523
- #
1524
- # If you want a gem to behave as an engine, you have to specify an +Engine+
1525
- # for it somewhere inside your plugin's +lib+ folder (similar to how we
1526
- # specify a +Railtie+):
1527
- #
1528
- # # lib/my_engine.rb
1529
- # module MyEngine
1530
- # class Engine < Rails::Engine
1531
- # end
1532
- # end
1533
- #
1534
- # Then ensure that this file is loaded at the top of your <tt>config/application.rb</tt>
1535
- # (or in your +Gemfile+) and it will automatically load models, controllers and helpers
1536
- # inside +app+, load routes at <tt>config/routes.rb</tt>, load locales at
1537
- # <tt>config/locales/*</tt>, and load tasks at <tt>lib/tasks/*</tt>.
1538
- #
1539
- # == Configuration
1540
- #
1541
- # Besides the +Railtie+ configuration which is shared across the application, in a
1542
- # <tt>Rails::Engine</tt> you can access <tt>autoload_paths</tt>, <tt>eager_load_paths</tt>
1543
- # and <tt>autoload_once_paths</tt>, which, differently from a <tt>Railtie</tt>, are scoped to
1544
- # the current engine.
1545
- #
1546
- # class MyEngine < Rails::Engine
1547
- # # Add a load path for this specific Engine
1548
- # config.autoload_paths << File.expand_path("lib/some/path", __dir__)
1549
- #
1550
- # initializer "my_engine.add_middleware" do |app|
1551
- # app.middleware.use MyEngine::Middleware
1552
- # end
1553
- # end
1554
- #
1555
- # == Generators
1556
- #
1557
- # You can set up generators for engines with <tt>config.generators</tt> method:
1558
- #
1559
- # class MyEngine < Rails::Engine
1560
- # config.generators do |g|
1561
- # g.orm :active_record
1562
- # g.template_engine :erb
1563
- # g.test_framework :test_unit
1564
- # end
1565
- # end
1566
- #
1567
- # You can also set generators for an application by using <tt>config.app_generators</tt>:
1568
- #
1569
- # class MyEngine < Rails::Engine
1570
- # # note that you can also pass block to app_generators in the same way you
1571
- # # can pass it to generators method
1572
- # config.app_generators.orm :datamapper
1573
- # end
1574
- #
1575
- # == Paths
1576
- #
1577
- # Applications and engines have flexible path configuration, meaning that you
1578
- # are not required to place your controllers at <tt>app/controllers</tt>, but
1579
- # in any place which you find convenient.
1580
- #
1581
- # For example, let's suppose you want to place your controllers in <tt>lib/controllers</tt>.
1582
- # You can set that as an option:
1583
- #
1584
- # class MyEngine < Rails::Engine
1585
- # paths["app/controllers"] = "lib/controllers"
1586
- # end
1587
- #
1588
- # You can also have your controllers loaded from both <tt>app/controllers</tt> and
1589
- # <tt>lib/controllers</tt>:
1590
- #
1591
- # class MyEngine < Rails::Engine
1592
- # paths["app/controllers"] << "lib/controllers"
1593
- # end
1594
- #
1595
- # The available paths in an engine are:
1596
- #
1597
- # class MyEngine < Rails::Engine
1598
- # paths["app"] # => ["app"]
1599
- # paths["app/controllers"] # => ["app/controllers"]
1600
- # paths["app/helpers"] # => ["app/helpers"]
1601
- # paths["app/models"] # => ["app/models"]
1602
- # paths["app/views"] # => ["app/views"]
1603
- # paths["lib"] # => ["lib"]
1604
- # paths["lib/tasks"] # => ["lib/tasks"]
1605
- # paths["config"] # => ["config"]
1606
- # paths["config/initializers"] # => ["config/initializers"]
1607
- # paths["config/locales"] # => ["config/locales"]
1608
- # paths["config/routes.rb"] # => ["config/routes.rb"]
1609
- # end
1610
- #
1611
- # The <tt>Application</tt> class adds a couple more paths to this set. And as in your
1612
- # <tt>Application</tt>, all folders under +app+ are automatically added to the load path.
1613
- # If you have an <tt>app/services</tt> folder for example, it will be added by default.
1614
- #
1615
- # == Endpoint
1616
- #
1617
- # An engine can also be a Rack application. It can be useful if you have a Rack application that
1618
- # you would like to wrap with +Engine+ and provide with some of the +Engine+'s features.
1619
- #
1620
- # To do that, use the +endpoint+ method:
1621
- #
1622
- # module MyEngine
1623
- # class Engine < Rails::Engine
1624
- # endpoint MyRackApplication
1625
- # end
1626
- # end
1627
- #
1628
- # Now you can mount your engine in application's routes just like that:
1629
- #
1630
- # Rails.application.routes.draw do
1631
- # mount MyEngine::Engine => "/engine"
1632
- # end
1633
- #
1634
- # == Middleware stack
1635
- #
1636
- # As an engine can now be a Rack endpoint, it can also have a middleware
1637
- # stack. The usage is exactly the same as in <tt>Application</tt>:
1638
- #
1639
- # module MyEngine
1640
- # class Engine < Rails::Engine
1641
- # middleware.use SomeMiddleware
1642
- # end
1643
- # end
1644
- #
1645
- # == Routes
1646
- #
1647
- # If you don't specify an endpoint, routes will be used as the default
1648
- # endpoint. You can use them just like you use an application's routes:
1649
- #
1650
- # # ENGINE/config/routes.rb
1651
- # MyEngine::Engine.routes.draw do
1652
- # get "/" => "posts#index"
1653
- # end
1654
- #
1655
- # == Mount priority
1656
- #
1657
- # Note that now there can be more than one router in your application, and it's better to avoid
1658
- # passing requests through many routers. Consider this situation:
1659
- #
1660
- # Rails.application.routes.draw do
1661
- # mount MyEngine::Engine => "/blog"
1662
- # get "/blog/omg" => "main#omg"
1663
- # end
1664
- #
1665
- # +MyEngine+ is mounted at <tt>/blog</tt>, and <tt>/blog/omg</tt> points to application's
1666
- # controller. In such a situation, requests to <tt>/blog/omg</tt> will go through +MyEngine+,
1667
- # and if there is no such route in +Engine+'s routes, it will be dispatched to <tt>main#omg</tt>.
1668
- # It's much better to swap that:
1669
- #
1670
- # Rails.application.routes.draw do
1671
- # get "/blog/omg" => "main#omg"
1672
- # mount MyEngine::Engine => "/blog"
1673
- # end
1674
- #
1675
- # Now, +Engine+ will get only requests that were not handled by +Application+.
1676
- #
1677
- # == Engine name
1678
- #
1679
- # There are some places where an Engine's name is used:
1680
- #
1681
- # * routes: when you mount an Engine with <tt>mount(MyEngine::Engine => '/my_engine')</tt>,
1682
- # it's used as default <tt>:as</tt> option
1683
- # * rake task for installing migrations <tt>my_engine:install:migrations</tt>
1684
- #
1685
- # Engine name is set by default based on class name. For <tt>MyEngine::Engine</tt> it will be
1686
- # <tt>my_engine_engine</tt>. You can change it manually using the <tt>engine_name</tt> method:
1687
- #
1688
- # module MyEngine
1689
- # class Engine < Rails::Engine
1690
- # engine_name "my_engine"
1691
- # end
1692
- # end
1693
- #
1694
- # == Isolated Engine
1695
- #
1696
- # Normally when you create controllers, helpers and models inside an engine, they are treated
1697
- # as if they were created inside the application itself. This means that all helpers and
1698
- # named routes from the application will be available to your engine's controllers as well.
1699
- #
1700
- # However, sometimes you want to isolate your engine from the application, especially if your engine
1701
- # has its own router. To do that, you simply need to call +isolate_namespace+. This method requires
1702
- # you to pass a module where all your controllers, helpers and models should be nested to:
1703
- #
1704
- # module MyEngine
1705
- # class Engine < Rails::Engine
1706
- # isolate_namespace MyEngine
1707
- # end
1708
- # end
1709
- #
1710
- # With such an engine, everything that is inside the +MyEngine+ module will be isolated from
1711
- # the application.
1712
- #
1713
- # Consider this controller:
1714
- #
1715
- # module MyEngine
1716
- # class FooController < ActionController::Base
1717
- # end
1718
- # end
1719
- #
1720
- # If the +MyEngine+ engine is marked as isolated, +FooController+ only has
1721
- # access to helpers from +MyEngine+, and <tt>url_helpers</tt> from
1722
- # <tt>MyEngine::Engine.routes</tt>.
1723
- #
1724
- # The next thing that changes in isolated engines is the behavior of routes.
1725
- # Normally, when you namespace your controllers, you also need to namespace
1726
- # the related routes. With an isolated engine, the engine's namespace is
1727
- # automatically applied, so you don't need to specify it explicitly in your
1728
- # routes:
1729
- #
1730
- # MyEngine::Engine.routes.draw do
1731
- # resources :articles
1732
- # end
1733
- #
1734
- # If +MyEngine+ is isolated, The routes above will point to
1735
- # <tt>MyEngine::ArticlesController</tt>. You also don't need to use longer
1736
- # URL helpers like +my_engine_articles_path+. Instead, you should simply use
1737
- # +articles_path+, like you would do with your main application.
1738
- #
1739
- # To make this behavior consistent with other parts of the framework,
1740
- # isolated engines also have an effect on <tt>ActiveModel::Naming</tt>. In a
1741
- # normal Rails app, when you use a namespaced model such as
1742
- # <tt>Namespace::Article</tt>, <tt>ActiveModel::Naming</tt> will generate
1743
- # names with the prefix "namespace". In an isolated engine, the prefix will
1744
- # be omitted in URL helpers and form fields, for convenience.
1745
- #
1746
- # polymorphic_url(MyEngine::Article.new)
1747
- # # => "articles_path" # not "my_engine_articles_path"
1748
- #
1749
- # form_for(MyEngine::Article.new) do
1750
- # text_field :title # => <input type="text" name="article[title]" id="article_title" />
1751
- # end
1752
- #
1753
- # Additionally, an isolated engine will set its own name according to its
1754
- # namespace, so <tt>MyEngine::Engine.engine_name</tt> will return
1755
- # "my_engine". It will also set +MyEngine.table_name_prefix+ to "my_engine_",
1756
- # meaning for example that <tt>MyEngine::Article</tt> will use the
1757
- # +my_engine_articles+ database table by default.
1758
- #
1759
- # == Using Engine's routes outside Engine
1760
- #
1761
- # Since you can now mount an engine inside application's routes, you do not have direct access to +Engine+'s
1762
- # <tt>url_helpers</tt> inside +Application+. When you mount an engine in an application's routes, a special helper is
1763
- # created to allow you to do that. Consider such a scenario:
1764
- #
1765
- # # config/routes.rb
1766
- # Rails.application.routes.draw do
1767
- # mount MyEngine::Engine => "/my_engine", as: "my_engine"
1768
- # get "/foo" => "foo#index"
1769
- # end
1770
- #
1771
- # Now, you can use the <tt>my_engine</tt> helper inside your application:
1772
- #
1773
- # class FooController < ApplicationController
1774
- # def index
1775
- # my_engine.root_url # => /my_engine/
1776
- # end
1777
- # end
1778
- #
1779
- # There is also a <tt>main_app</tt> helper that gives you access to application's routes inside Engine:
1780
- #
1781
- # module MyEngine
1782
- # class BarController
1783
- # def index
1784
- # main_app.foo_path # => /foo
1785
- # end
1786
- # end
1787
- # end
1788
- #
1789
- # Note that the <tt>:as</tt> option given to mount takes the <tt>engine_name</tt> as default, so most of the time
1790
- # you can simply omit it.
1791
- #
1792
- # Finally, if you want to generate a URL to an engine's route using
1793
- # <tt>polymorphic_url</tt>, you also need to pass the engine helper. Let's
1794
- # say that you want to create a form pointing to one of the engine's routes.
1795
- # All you need to do is pass the helper as the first element in array with
1796
- # attributes for URL:
1797
- #
1798
- # form_for([my_engine, @user])
1799
- #
1800
- # This code will use <tt>my_engine.user_path(@user)</tt> to generate the proper route.
1801
- #
1802
- # == Isolated engine's helpers
1803
- #
1804
- # Sometimes you may want to isolate engine, but use helpers that are defined for it.
1805
- # If you want to share just a few specific helpers you can add them to application's
1806
- # helpers in ApplicationController:
1807
- #
1808
- # class ApplicationController < ActionController::Base
1809
- # helper MyEngine::SharedEngineHelper
1810
- # end
1811
- #
1812
- # If you want to include all of the engine's helpers, you can use the #helper method on an engine's
1813
- # instance:
1814
- #
1815
- # class ApplicationController < ActionController::Base
1816
- # helper MyEngine::Engine.helpers
1817
- # end
1818
- #
1819
- # It will include all of the helpers from engine's directory. Take into account that this does
1820
- # not include helpers defined in controllers with helper_method or other similar solutions,
1821
- # only helpers defined in the helpers directory will be included.
1822
- #
1823
- # == Migrations & seed data
1824
- #
1825
- # Engines can have their own migrations. The default path for migrations is exactly the same
1826
- # as in application: <tt>db/migrate</tt>
1827
- #
1828
- # To use engine's migrations in application you can use the rake task below, which copies them to
1829
- # application's dir:
1830
- #
1831
- # rake ENGINE_NAME:install:migrations
1832
- #
1833
- # Note that some of the migrations may be skipped if a migration with the same name already exists
1834
- # in application. In such a situation you must decide whether to leave that migration or rename the
1835
- # migration in the application and rerun copying migrations.
1836
- #
1837
- # If your engine has migrations, you may also want to prepare data for the database in
1838
- # the <tt>db/seeds.rb</tt> file. You can load that data using the <tt>load_seed</tt> method, e.g.
1839
- #
1840
- # MyEngine::Engine.load_seed
1841
- #
1842
- # == Loading priority
1843
- #
1844
- # In order to change engine's priority you can use +config.railties_order+ in the main application.
1845
- # It will affect the priority of loading views, helpers, assets, and all the other files
1846
- # related to engine or application.
1847
- #
1848
- # # load Blog::Engine with highest priority, followed by application and other railties
1849
- # config.railties_order = [Blog::Engine, :main_app, :all]
1850
- class Engine < Railtie
1851
- attr_accessor called_from: untyped
1852
-
1853
- attr_accessor isolated: untyped
1854
-
1855
- def self.inherited: (untyped base) -> untyped
1856
-
1857
- def self.find_root: (untyped from) -> untyped
1858
-
1859
- def self.endpoint: (?untyped? endpoint) -> untyped
1860
-
1861
- def self.isolate_namespace: (untyped mod) -> untyped
1862
-
1863
- # Finds engine with given path.
1864
- def self.find: (untyped path) -> (untyped | nil)
1865
-
1866
- def initialize: () -> untyped
1867
-
1868
- # Load console and invoke the registered hooks.
1869
- # Check <tt>Rails::Railtie.console</tt> for more info.
1870
- def load_console: (?untyped app) -> untyped
1871
-
1872
- # Load Rails runner and invoke the registered hooks.
1873
- # Check <tt>Rails::Railtie.runner</tt> for more info.
1874
- def load_runner: (?untyped app) -> untyped
1875
-
1876
- # Load Rake, railties tasks and invoke the registered hooks.
1877
- # Check <tt>Rails::Railtie.rake_tasks</tt> for more info.
1878
- def load_tasks: (?untyped app) -> untyped
1879
-
1880
- # Load Rails generators and invoke the registered hooks.
1881
- # Check <tt>Rails::Railtie.generators</tt> for more info.
1882
- def load_generators: (?untyped app) -> untyped
1883
-
1884
- def eager_load!: () -> (nil | untyped)
1885
-
1886
- def railties: () -> untyped
1887
-
1888
- # Returns a module with all the helpers defined for the engine.
1889
- def helpers: () -> untyped
1890
-
1891
- # Returns all registered helpers paths.
1892
- def helpers_paths: () -> untyped
1893
-
1894
- # Returns the underlying Rack application for this engine.
1895
- def app: () -> untyped
1896
-
1897
- # Returns the endpoint for this engine. If none is registered,
1898
- # defaults to an ActionDispatch::Routing::RouteSet.
1899
- def endpoint: () -> untyped
1900
-
1901
- # Define the Rack API for this engine.
1902
- def call: (untyped env) -> untyped
1903
-
1904
- # Defines additional Rack env configuration that is added on each call.
1905
- def env_config: () -> untyped
1906
-
1907
- # Defines the routes for this engine. If a block is given to
1908
- # routes, it is appended to the engine.
1909
- def routes: () { () -> untyped } -> untyped
1910
-
1911
- # Define the configuration object for the engine.
1912
- def config: () -> untyped
1913
-
1914
- # Load data from db/seeds.rb file. It can be used in to load engines'
1915
- # seeds, e.g.:
1916
- #
1917
- # Blog::Engine.load_seed
1918
- def load_seed: () -> (nil | untyped)
1919
-
1920
- def routes?: () -> untyped
1921
-
1922
- def run_tasks_blocks: () -> untyped
1923
-
1924
- def load_config_initializer: (untyped initializer) -> untyped
1925
-
1926
- def with_inline_jobs: () { () -> untyped } -> untyped
1927
-
1928
- def has_migrations?: () -> untyped
1929
-
1930
- def self.find_root_with_flag: (untyped flag, untyped root_path, ?untyped? default) -> Pathname
1931
-
1932
- def default_middleware_stack: () -> ActionDispatch::MiddlewareStack
1933
-
1934
- def _all_autoload_once_paths: () -> untyped
1935
-
1936
- def _all_autoload_paths: () -> untyped
1937
-
1938
- def _all_load_paths: (untyped add_autoload_paths_to_load_path) -> untyped
1939
-
1940
- def build_request: (untyped env) -> untyped
1941
-
1942
- def build_middleware: () -> untyped
1943
- end
1944
- end
1945
-
1946
- module Rails
1947
- class Engine
1948
- class Updater
1949
- def self.generator: () -> untyped
1950
-
1951
- def self.run: (untyped action) -> untyped
1952
- end
1953
- end
1954
- end
1955
-
1956
- module Rails
1957
- # Returns the version of the currently loaded Rails as a <tt>Gem::Version</tt>
1958
- def self.gem_version: () -> Gem::Version
1959
-
1960
- module VERSION
1961
- MAJOR: ::Integer
1962
-
1963
- MINOR: ::Integer
1964
-
1965
- TINY: ::Integer
1966
-
1967
- PRE: ::String
1968
-
1969
- STRING: untyped
1970
- end
1971
- end
1972
-
1973
- module Rails
1974
- module Generators
1975
- module Actions
1976
- class CreateMigration < Thor::Actions::CreateFile
1977
- # nodoc:
1978
- def migration_dir: () -> untyped
1979
-
1980
- def migration_file_name: () -> untyped
1981
-
1982
- def identical?: () -> untyped
1983
-
1984
- def revoke!: () -> (nil | untyped)
1985
-
1986
- def relative_existing_migration: () -> untyped
1987
-
1988
- def existing_migration: () -> untyped
1989
-
1990
- def on_conflict_behavior: () { () -> untyped } -> untyped
1991
-
1992
- def say_status: (untyped status, untyped color, ?untyped message) -> untyped
1993
- end
1994
- end
1995
- end
1996
- end
1997
-
1998
- module Rails
1999
- module Generators
2000
- module Actions
2001
- def initialize: () -> untyped
2002
-
2003
- # Adds an entry into +Gemfile+ for the supplied gem.
2004
- #
2005
- # gem "rspec", group: :test
2006
- # gem "technoweenie-restful-authentication", lib: "restful-authentication", source: "http://gems.github.com/"
2007
- # gem "rails", "3.0", git: "https://github.com/rails/rails"
2008
- # gem "RedCloth", ">= 4.1.0", "< 4.2.0"
2009
- def gem: (*untyped args) -> untyped
2010
-
2011
- # Wraps gem entries inside a group.
2012
- #
2013
- # gem_group :development, :test do
2014
- # gem "rspec-rails"
2015
- # end
2016
- def gem_group: (*untyped names) { () -> untyped } -> untyped
2017
-
2018
- def github: (untyped repo, ?::Hash[untyped, untyped] options) { () -> untyped } -> untyped
2019
-
2020
- # Add the given source to +Gemfile+
2021
- #
2022
- # If block is given, gem entries in block are wrapped into the source group.
2023
- #
2024
- # add_source "http://gems.github.com/"
2025
- #
2026
- # add_source "http://gems.github.com/" do
2027
- # gem "rspec-rails"
2028
- # end
2029
- def add_source: (untyped source, ?::Hash[untyped, untyped] options) { () -> untyped } -> untyped
2030
-
2031
- # Adds a line inside the Application class for <tt>config/application.rb</tt>.
2032
- #
2033
- # If options <tt>:env</tt> is specified, the line is appended to the corresponding
2034
- # file in <tt>config/environments</tt>.
2035
- #
2036
- # environment do
2037
- # "config.action_controller.asset_host = 'cdn.provider.com'"
2038
- # end
2039
- #
2040
- # environment(nil, env: "development") do
2041
- # "config.action_controller.asset_host = 'localhost:3000'"
2042
- # end
2043
- def environment: (?untyped? data, ?::Hash[untyped, untyped] options) { () -> untyped } -> untyped
2044
-
2045
- # Run a command in git.
2046
- #
2047
- # git :init
2048
- # git add: "this.file that.rb"
2049
- # git add: "onefile.rb", rm: "badfile.cxx"
2050
- def git: (?::Hash[untyped, untyped] commands) -> untyped
2051
-
2052
- # Create a new file in the <tt>vendor/</tt> directory. Code can be specified
2053
- # in a block or a data string can be given.
2054
- #
2055
- # vendor("sekrit.rb") do
2056
- # sekrit_salt = "#{Time.now}--#{3.years.ago}--#{rand}--"
2057
- # "salt = '#{sekrit_salt}'"
2058
- # end
2059
- #
2060
- # vendor("foreign.rb", "# Foreign code is fun")
2061
- def vendor: (untyped filename, ?untyped? data) { () -> untyped } -> untyped
2062
-
2063
- # Create a new file in the <tt>lib/</tt> directory. Code can be specified
2064
- # in a block or a data string can be given.
2065
- #
2066
- # lib("crypto.rb") do
2067
- # "crypted_special_value = '#{rand}--#{Time.now}--#{rand(1337)}--'"
2068
- # end
2069
- #
2070
- # lib("foreign.rb", "# Foreign code is fun")
2071
- def lib: (untyped filename, ?untyped? data) { () -> untyped } -> untyped
2072
-
2073
- # Create a new +Rakefile+ with the provided code (either in a block or a string).
2074
- #
2075
- # rakefile("bootstrap.rake") do
2076
- # project = ask("What is the UNIX name of your project?")
2077
- #
2078
- # <<-TASK
2079
- # namespace :#{project} do
2080
- # task :bootstrap do
2081
- # puts "I like boots!"
2082
- # end
2083
- # end
2084
- # TASK
2085
- # end
2086
- #
2087
- # rakefile('seed.rake', 'puts "Planting seeds"')
2088
- def rakefile: (untyped filename, ?untyped? data) { () -> untyped } -> untyped
2089
-
2090
- # Create a new initializer with the provided code (either in a block or a string).
2091
- #
2092
- # initializer("globals.rb") do
2093
- # data = ""
2094
- #
2095
- # ['MY_WORK', 'ADMINS', 'BEST_COMPANY_EVAR'].each do |const|
2096
- # data << "#{const} = :entp\n"
2097
- # end
2098
- #
2099
- # data
2100
- # end
2101
- #
2102
- # initializer("api.rb", "API_KEY = '123456'")
2103
- def initializer: (untyped filename, ?untyped? data) { () -> untyped } -> untyped
2104
-
2105
- # Generate something using a generator from Rails or a plugin.
2106
- # The second parameter is the argument string that is passed to
2107
- # the generator or an Array that is joined.
2108
- #
2109
- # generate(:authenticated, "user session")
2110
- def generate: (untyped what, *untyped args) -> untyped
2111
-
2112
- # Runs the supplied rake task (invoked with 'rake ...')
2113
- #
2114
- # rake("db:migrate")
2115
- # rake("db:migrate", env: "production")
2116
- # rake("gems:install", sudo: true)
2117
- # rake("gems:install", capture: true)
2118
- def rake: (untyped command, ?::Hash[untyped, untyped] options) -> untyped
2119
-
2120
- # Runs the supplied rake task (invoked with 'rails ...')
2121
- #
2122
- # rails_command("db:migrate")
2123
- # rails_command("db:migrate", env: "production")
2124
- # rails_command("gems:install", sudo: true)
2125
- # rails_command("gems:install", capture: true)
2126
- def rails_command: (untyped command, ?::Hash[untyped, untyped] options) -> untyped
2127
-
2128
- # Make an entry in Rails routing file <tt>config/routes.rb</tt>
2129
- #
2130
- # route "root 'welcome#index'"
2131
- def route: (untyped routing_code) -> untyped
2132
-
2133
- # Reads the given file at the source root and prints it in the console.
2134
- #
2135
- # readme "README"
2136
- def readme: (untyped path) -> untyped
2137
-
2138
- def log: (*untyped args) -> untyped
2139
-
2140
- def execute_command: (untyped executor, untyped command, ?::Hash[untyped, untyped] options) -> untyped
2141
-
2142
- def extify: (untyped name) -> untyped
2143
-
2144
- def quote: (untyped value) -> untyped
2145
-
2146
- def optimize_indentation: (untyped value, ?::Integer amount) -> (::String | untyped)
2147
-
2148
- def indentation: () -> untyped
2149
-
2150
- def with_indentation: () { () -> untyped } -> untyped
2151
- end
2152
- end
2153
- end
2154
-
2155
- module Rails
2156
- module Generators
2157
- # ActiveModel is a class to be implemented by each ORM to allow Rails to
2158
- # generate customized controller code.
2159
- #
2160
- # The API has the same methods as ActiveRecord, but each method returns a
2161
- # string that matches the ORM API.
2162
- #
2163
- # For example:
2164
- #
2165
- # ActiveRecord::Generators::ActiveModel.find(Foo, "params[:id]")
2166
- # # => "Foo.find(params[:id])"
2167
- #
2168
- # DataMapper::Generators::ActiveModel.find(Foo, "params[:id]")
2169
- # # => "Foo.get(params[:id])"
2170
- #
2171
- # On initialization, the ActiveModel accepts the instance name that will
2172
- # receive the calls:
2173
- #
2174
- # builder = ActiveRecord::Generators::ActiveModel.new "@foo"
2175
- # builder.save # => "@foo.save"
2176
- #
2177
- # The only exception in ActiveModel for ActiveRecord is the use of self.build
2178
- # instead of self.new.
2179
- #
2180
- class ActiveModel
2181
- attr_reader name: untyped
2182
-
2183
- def initialize: (untyped name) -> untyped
2184
-
2185
- # GET index
2186
- def self.all: (untyped klass) -> ::String
2187
-
2188
- # GET show
2189
- # GET edit
2190
- # PATCH/PUT update
2191
- # DELETE destroy
2192
- def self.find: (untyped klass, ?untyped? params) -> ::String
2193
-
2194
- # GET new
2195
- # POST create
2196
- def self.build: (untyped klass, ?untyped? params) -> untyped
2197
-
2198
- # POST create
2199
- def save: () -> ::String
2200
-
2201
- # PATCH/PUT update
2202
- def update: (?untyped? params) -> ::String
2203
-
2204
- # POST create
2205
- # PATCH/PUT update
2206
- def errors: () -> ::String
2207
-
2208
- # DELETE destroy
2209
- def destroy: () -> ::String
2210
- end
2211
- end
2212
- end
2213
-
2214
- module Rails
2215
- module Generators
2216
- class AppBase < Base
2217
- # :nodoc:
2218
- include Database
2219
-
2220
- include AppName
2221
-
2222
- attr_accessor rails_template: untyped
2223
-
2224
- def self.strict_args_position: () -> ::FalseClass
2225
-
2226
- def self.add_shared_options_for: (untyped name) -> untyped
2227
-
2228
- def initialize: (*untyped args) -> untyped
2229
-
2230
- def gemfile_entry: (untyped name, *untyped args) -> untyped
2231
-
2232
- def gemfile_entries: () -> untyped
2233
-
2234
- def add_gem_entry_filter: () { (untyped) -> untyped } -> untyped
2235
-
2236
- def builder: () -> untyped
2237
-
2238
- def build: (untyped meth, *untyped args) -> untyped
2239
-
2240
- def create_root: () -> untyped
2241
-
2242
- def apply_rails_template: () -> untyped
2243
-
2244
- def set_default_accessors!: () -> untyped
2245
-
2246
- def database_gemfile_entry: () -> (::Array[untyped] | untyped)
2247
-
2248
- def web_server_gemfile_entry: () -> (::Array[untyped] | GemfileEntry)
2249
-
2250
- def include_all_railties?: () -> untyped
2251
-
2252
- def comment_if: (untyped value) -> untyped
2253
-
2254
- def keeps?: () -> untyped
2255
-
2256
- def sqlite3?: () -> untyped
2257
-
2258
- def skip_active_storage?: () -> untyped
2259
-
2260
- def skip_action_mailbox?: () -> untyped
2261
-
2262
- def skip_action_text?: () -> untyped
2263
-
2264
- # Note: It inherits unnamed class, but omitted
2265
- class GemfileEntry
2266
- def initialize: (untyped name, untyped version, untyped comment, ?::Hash[untyped, untyped] options, ?bool commented_out) -> untyped
2267
-
2268
- def self.github: (untyped name, untyped github, ?untyped? branch, ?untyped? comment) -> untyped
2269
-
2270
- def self.version: (untyped name, untyped version, ?untyped? comment) -> untyped
2271
-
2272
- def self.path: (untyped name, untyped path, ?untyped? comment) -> untyped
2273
-
2274
- def version: () -> untyped
2275
- end
2276
-
2277
- def rails_gemfile_entry: () -> untyped
2278
-
2279
- def rails_version_specifier: (?untyped gem_version) -> untyped
2280
-
2281
- def assets_gemfile_entry: () -> (::Array[untyped] | untyped)
2282
-
2283
- def webpacker_gemfile_entry: () -> (::Array[untyped] | untyped)
2284
-
2285
- def jbuilder_gemfile_entry: () -> GemfileEntry
2286
-
2287
- def javascript_gemfile_entry: () -> untyped
2288
-
2289
- def psych_gemfile_entry: () -> (::Array[untyped] | GemfileEntry)
2290
-
2291
- def cable_gemfile_entry: () -> (::Array[untyped] | untyped)
2292
-
2293
- def bundle_command: (untyped command, ?::Hash[untyped, untyped] env) -> untyped
2294
-
2295
- def exec_bundle_command: (untyped bundle_command, untyped command, untyped env) -> untyped
2296
-
2297
- def bundle_install?: () -> untyped
2298
-
2299
- def spring_install?: () -> untyped
2300
-
2301
- def webpack_install?: () -> untyped
2302
-
2303
- def depends_on_system_test?: () -> untyped
2304
-
2305
- def depend_on_listen?: () -> untyped
2306
-
2307
- def depend_on_bootsnap?: () -> untyped
2308
-
2309
- def os_supports_listen_out_of_the_box?: () -> untyped
2310
-
2311
- def run_bundle: () -> untyped
2312
-
2313
- def run_webpack: () -> untyped
2314
-
2315
- def generate_bundler_binstub: () -> untyped
2316
-
2317
- def generate_spring_binstubs: () -> untyped
2318
-
2319
- def empty_directory_with_keep_file: (untyped destination, ?::Hash[untyped, untyped] config) -> untyped
2320
-
2321
- def keep_file: (untyped destination) -> untyped
2322
- end
2323
- end
2324
- end
2325
-
2326
- module Rails
2327
- module Generators
2328
- module AppName
2329
- # :nodoc:
2330
- RESERVED_NAMES: ::Array[untyped]
2331
-
2332
- def app_name: () -> untyped
2333
-
2334
- def original_app_name: () -> untyped
2335
-
2336
- def defined_app_name: () -> untyped
2337
-
2338
- def defined_app_const_base: () -> untyped
2339
-
2340
- def app_const_base: () -> untyped
2341
-
2342
- def app_const: () -> untyped
2343
-
2344
- def valid_const?: () -> untyped
2345
- end
2346
- end
2347
- end
2348
-
2349
- module Rails
2350
- module Generators
2351
- class Error < Thor::Error
2352
- end
2353
-
2354
- class Base < Thor::Group
2355
- include Thor::Actions
2356
-
2357
- include Rails::Generators::Actions
2358
-
2359
- def self.exit_on_failure?: () -> ::FalseClass
2360
-
2361
- # Returns the source root for this generator using default_source_root as default.
2362
- def self.source_root: (?untyped? path) -> untyped
2363
-
2364
- # Tries to get the description from a USAGE file one folder above the source
2365
- # root otherwise uses a default description.
2366
- def self.desc: (?untyped? description) -> untyped
2367
-
2368
- # Convenience method to get the namespace from the class name. It's the
2369
- # same as Thor default except that the Generator at the end of the class
2370
- # is removed.
2371
- def self.namespace: (?untyped? name) -> untyped
2372
-
2373
- # Convenience method to hide this generator from the available ones when
2374
- # running rails generator command.
2375
- def self.hide!: () -> untyped
2376
-
2377
- # Invoke a generator based on the value supplied by the user to the
2378
- # given option named "name". A class option is created when this method
2379
- # is invoked and you can set a hash to customize it.
2380
- #
2381
- # ==== Examples
2382
- #
2383
- # module Rails::Generators
2384
- # class ControllerGenerator < Base
2385
- # hook_for :test_framework, aliases: "-t"
2386
- # end
2387
- # end
2388
- #
2389
- # The example above will create a test framework option and will invoke
2390
- # a generator based on the user supplied value.
2391
- #
2392
- # For example, if the user invoke the controller generator as:
2393
- #
2394
- # rails generate controller Account --test-framework=test_unit
2395
- #
2396
- # The controller generator will then try to invoke the following generators:
2397
- #
2398
- # "rails:test_unit", "test_unit:controller", "test_unit"
2399
- #
2400
- # Notice that "rails:generators:test_unit" could be loaded as well, what
2401
- # Rails looks for is the first and last parts of the namespace. This is what
2402
- # allows any test framework to hook into Rails as long as it provides any
2403
- # of the hooks above.
2404
- #
2405
- # ==== Options
2406
- #
2407
- # The first and last part used to find the generator to be invoked are
2408
- # guessed based on class invokes hook_for, as noticed in the example above.
2409
- # This can be customized with two options: :in and :as.
2410
- #
2411
- # Let's suppose you are creating a generator that needs to invoke the
2412
- # controller generator from test unit. Your first attempt is:
2413
- #
2414
- # class AwesomeGenerator < Rails::Generators::Base
2415
- # hook_for :test_framework
2416
- # end
2417
- #
2418
- # The lookup in this case for test_unit as input is:
2419
- #
2420
- # "test_unit:awesome", "test_unit"
2421
- #
2422
- # Which is not the desired lookup. You can change it by providing the
2423
- # :as option:
2424
- #
2425
- # class AwesomeGenerator < Rails::Generators::Base
2426
- # hook_for :test_framework, as: :controller
2427
- # end
2428
- #
2429
- # And now it will look up at:
2430
- #
2431
- # "test_unit:controller", "test_unit"
2432
- #
2433
- # Similarly, if you want it to also look up in the rails namespace, you
2434
- # just need to provide the :in value:
2435
- #
2436
- # class AwesomeGenerator < Rails::Generators::Base
2437
- # hook_for :test_framework, in: :rails, as: :controller
2438
- # end
2439
- #
2440
- # And the lookup is exactly the same as previously:
2441
- #
2442
- # "rails:test_unit", "test_unit:controller", "test_unit"
2443
- #
2444
- # ==== Switches
2445
- #
2446
- # All hooks come with switches for user interface. If you do not want
2447
- # to use any test framework, you can do:
2448
- #
2449
- # rails generate controller Account --skip-test-framework
2450
- #
2451
- # Or similarly:
2452
- #
2453
- # rails generate controller Account --no-test-framework
2454
- #
2455
- # ==== Boolean hooks
2456
- #
2457
- # In some cases, you may want to provide a boolean hook. For example, webrat
2458
- # developers might want to have webrat available on controller generator.
2459
- # This can be achieved as:
2460
- #
2461
- # Rails::Generators::ControllerGenerator.hook_for :webrat, type: :boolean
2462
- #
2463
- # Then, if you want webrat to be invoked, just supply:
2464
- #
2465
- # rails generate controller Account --webrat
2466
- #
2467
- # The hooks lookup is similar as above:
2468
- #
2469
- # "rails:generators:webrat", "webrat:generators:controller", "webrat"
2470
- #
2471
- # ==== Custom invocations
2472
- #
2473
- # You can also supply a block to hook_for to customize how the hook is
2474
- # going to be invoked. The block receives two arguments, an instance
2475
- # of the current class and the class to be invoked.
2476
- #
2477
- # For example, in the resource generator, the controller should be invoked
2478
- # with a pluralized class name. But by default it is invoked with the same
2479
- # name as the resource generator, which is singular. To change this, we
2480
- # can give a block to customize how the controller can be invoked.
2481
- #
2482
- # hook_for :resource_controller do |instance, controller|
2483
- # instance.invoke controller, [ instance.name.pluralize ]
2484
- # end
2485
- #
2486
- def self.hook_for: (*untyped names) { () -> untyped } -> untyped
2487
-
2488
- # Remove a previously added hook.
2489
- #
2490
- # remove_hook_for :orm
2491
- def self.remove_hook_for: (*untyped names) -> untyped
2492
-
2493
- def self.class_option: (untyped name, ?::Hash[untyped, untyped] options) -> untyped
2494
-
2495
- # Returns the default source root for a given generator. This is used internally
2496
- # by rails to set its generators source root. If you want to customize your source
2497
- # root, you should use source_root.
2498
- def self.default_source_root: () -> (nil | untyped)
2499
-
2500
- # Returns the base root for a common set of generators. This is used to dynamically
2501
- # guess the default source root.
2502
- def self.base_root: () -> untyped
2503
-
2504
- def self.inherited: (untyped base) -> untyped
2505
-
2506
- # Check whether the given class names are already taken by user
2507
- # application or Ruby on Rails.
2508
- def class_collisions: (*untyped class_names) -> (nil | untyped)
2509
-
2510
- def extract_last_module: (untyped nesting) -> untyped
2511
-
2512
- def module_namespacing: () { () -> untyped } -> untyped
2513
-
2514
- def indent: (untyped content, ?::Integer multiplier) -> untyped
2515
-
2516
- def wrap_with_namespace: (untyped content) -> ::String
2517
-
2518
- def namespace: () -> untyped
2519
-
2520
- def namespaced?: () -> untyped
2521
-
2522
- def namespace_dirs: () -> untyped
2523
-
2524
- def namespaced_path: () -> untyped
2525
-
2526
- def self.banner: () -> untyped
2527
-
2528
- def self.base_name: () -> untyped
2529
-
2530
- def self.generator_name: () -> untyped
2531
-
2532
- def self.default_value_for_option: (untyped name, untyped options) -> untyped
2533
-
2534
- def self.default_aliases_for_option: (untyped name, untyped options) -> untyped
2535
-
2536
- def self.default_for_option: (untyped config, untyped name, untyped options, untyped default) -> untyped
2537
-
2538
- def self.hooks: () -> untyped
2539
-
2540
- def self.prepare_for_invocation: (untyped name, untyped value) -> untyped
2541
-
2542
- def self.add_shebang_option!: () -> untyped
2543
-
2544
- def self.usage_path: () -> untyped
2545
-
2546
- def self.default_generator_root: () -> untyped
2547
- end
2548
- end
2549
- end
2550
-
2551
- module Css
2552
- module Generators
2553
- class AssetsGenerator < Rails::Generators::NamedBase
2554
- def copy_stylesheet: () -> untyped
2555
- end
2556
- end
2557
- end
2558
-
2559
- module Css
2560
- module Generators
2561
- class ScaffoldGenerator < Rails::Generators::NamedBase
2562
- # In order to allow the Sass generators to pick up the default Rails CSS and
2563
- # transform it, we leave it in a standard location for the CSS stylesheet
2564
- # generators to handle. For the simple, default case, just copy it over.
2565
- def copy_stylesheet: () -> untyped
2566
- end
2567
- end
2568
- end
2569
-
2570
- module Rails
2571
- module Generators
2572
- module Database
2573
- # :nodoc:
2574
- JDBC_DATABASES: ::Array[untyped]
2575
-
2576
- DATABASES: untyped
2577
-
2578
- def initialize: () -> untyped
2579
-
2580
- def gem_for_database: (?untyped database) -> untyped
2581
-
2582
- def convert_database_option_for_jruby: () -> untyped
2583
-
2584
- def mysql_socket: () -> untyped
2585
- end
2586
- end
2587
- end
2588
-
2589
- module Erb
2590
- module Generators
2591
- class ControllerGenerator < Base
2592
- def copy_view_files: () -> untyped
2593
- end
2594
- end
2595
- end
2596
-
2597
- module Erb
2598
- module Generators
2599
- class MailerGenerator < Base
2600
- def copy_view_files: () -> untyped
2601
-
2602
- def formats: () -> ::Array[:text | :html]
2603
-
2604
- def file_name: () -> untyped
2605
- end
2606
- end
2607
- end
2608
-
2609
- module Erb
2610
- module Generators
2611
- class Base < Rails::Generators::NamedBase
2612
- def formats: () -> ::Array[untyped]
2613
-
2614
- def format: () -> :html
2615
-
2616
- def handler: () -> :erb
2617
-
2618
- def filename_with_extensions: (untyped name, ?untyped file_format) -> untyped
2619
- end
2620
- end
2621
- end
2622
-
2623
- module Erb
2624
- module Generators
2625
- class ScaffoldGenerator < Base
2626
- # :nodoc:
2627
- # :nodoc:
2628
- # :nodoc:
2629
- include Rails::Generators::ResourceHelpers
2630
-
2631
- def create_root_folder: () -> untyped
2632
-
2633
- def copy_view_files: () -> untyped
2634
-
2635
- def available_views: () -> ::Array["index" | "edit" | "show" | "new" | "_form"]
2636
- end
2637
- end
2638
- end
2639
-
2640
- module Rails
2641
- module Generators
2642
- class GeneratedAttribute
2643
- # :nodoc:
2644
- INDEX_OPTIONS: ::Array[untyped]
2645
-
2646
- UNIQ_INDEX_OPTIONS: ::Array[untyped]
2647
-
2648
- attr_accessor name: untyped
2649
-
2650
- attr_accessor type: untyped
2651
-
2652
- attr_reader attr_options: untyped
2653
-
2654
- attr_writer index_name: untyped
2655
-
2656
- def self.parse: (untyped column_definition) -> untyped
2657
-
2658
- def self.reference?: (untyped `type`) -> untyped
2659
-
2660
- # parse possible attribute options like :limit for string/text/binary/integer, :precision/:scale for decimals or :polymorphic for references/belongs_to
2661
- # when declaring options curly brackets should be used
2662
- def self.parse_type_and_options: (untyped `type`) -> untyped
2663
-
2664
- def initialize: (untyped name, ?untyped? `type`, ?bool index_type, ?::Hash[untyped, untyped] attr_options) -> untyped
2665
-
2666
- def field_type: () -> untyped
2667
-
2668
- def default: () -> untyped
2669
-
2670
- def plural_name: () -> untyped
2671
-
2672
- def singular_name: () -> untyped
2673
-
2674
- def human_name: () -> untyped
2675
-
2676
- def index_name: () -> untyped
2677
-
2678
- def column_name: () -> untyped
2679
-
2680
- def foreign_key?: () -> untyped
2681
-
2682
- def reference?: () -> untyped
2683
-
2684
- def polymorphic?: () -> untyped
2685
-
2686
- def required?: () -> untyped
2687
-
2688
- def has_index?: () -> untyped
2689
-
2690
- def has_uniq_index?: () -> untyped
2691
-
2692
- def password_digest?: () -> untyped
2693
-
2694
- def token?: () -> untyped
2695
-
2696
- def rich_text?: () -> untyped
2697
-
2698
- def attachment?: () -> untyped
2699
-
2700
- def attachments?: () -> untyped
2701
-
2702
- def virtual?: () -> untyped
2703
-
2704
- def inject_options: () -> untyped
2705
-
2706
- def inject_index_options: () -> untyped
2707
-
2708
- def options_for_migration: () -> untyped
2709
- end
2710
- end
2711
- end
2712
-
2713
- module Rails
2714
- module Generators
2715
- # Holds common methods for migrations. It assumes that migrations have the
2716
- # [0-9]*_name format and can be used by other frameworks (like Sequel)
2717
- # just by implementing the next migration version method.
2718
- module Migration
2719
- extend ActiveSupport::Concern
2720
-
2721
- attr_reader migration_number: untyped
2722
-
2723
- attr_reader migration_file_name: untyped
2724
-
2725
- attr_reader migration_class_name: untyped
2726
-
2727
- module ClassMethods
2728
- # nodoc:
2729
- def migration_lookup_at: (untyped dirname) -> untyped
2730
-
2731
- def migration_exists?: (untyped dirname, untyped file_name) -> untyped
2732
-
2733
- def current_migration_number: (untyped dirname) -> untyped
2734
-
2735
- def next_migration_number: (untyped dirname) -> untyped
2736
- end
2737
-
2738
- def create_migration: (untyped destination, untyped data, ?::Hash[untyped, untyped] config) { () -> untyped } -> untyped
2739
-
2740
- def set_migration_assigns!: (untyped destination) -> untyped
2741
-
2742
- # Creates a migration template at the given destination. The difference
2743
- # to the default template method is that the migration version is appended
2744
- # to the destination file name.
2745
- #
2746
- # The migration version, migration file name, migration class name are
2747
- # available as instance variables in the template to be rendered.
2748
- #
2749
- # migration_template "migration.rb", "db/migrate/add_foo_to_bar.rb"
2750
- def migration_template: (untyped source, untyped destination, ?::Hash[untyped, untyped] config) -> untyped
2751
- end
2752
- end
2753
- end
2754
-
2755
- module Rails
2756
- module Generators
2757
- module ModelHelpers
2758
- # :nodoc:
2759
- PLURAL_MODEL_NAME_WARN_MESSAGE: ::String
2760
-
2761
- IRREGULAR_MODEL_NAME_WARN_MESSAGE: ::String
2762
-
2763
- def self.included: (untyped base) -> untyped
2764
-
2765
- def initialize: (untyped args, *untyped _options) -> untyped
2766
- end
2767
- end
2768
- end
2769
-
2770
- module Rails
2771
- module Generators
2772
- class NamedBase < Base
2773
- def initialize: (untyped args, *untyped options) -> untyped
2774
-
2775
- def template: (untyped source, *untyped args) { () -> untyped } -> untyped
2776
-
2777
- def js_template: (untyped source, untyped destination) -> untyped
2778
-
2779
- attr_reader file_name: untyped
2780
-
2781
- def singular_name: () -> untyped
2782
-
2783
- def inside_template: () { () -> untyped } -> untyped
2784
-
2785
- def inside_template?: () -> untyped
2786
-
2787
- def file_path: () -> untyped
2788
-
2789
- def class_path: () -> untyped
2790
-
2791
- def regular_class_path: () -> untyped
2792
-
2793
- def namespaced_class_path: () -> untyped
2794
-
2795
- def class_name: () -> untyped
2796
-
2797
- def human_name: () -> untyped
2798
-
2799
- def plural_name: () -> untyped
2800
-
2801
- def i18n_scope: () -> untyped
2802
-
2803
- def table_name: () -> untyped
2804
-
2805
- def uncountable?: () -> untyped
2806
-
2807
- def index_helper: () -> untyped
2808
-
2809
- def show_helper: () -> ::String
2810
-
2811
- def edit_helper: () -> ::String
2812
-
2813
- def new_helper: () -> ::String
2814
-
2815
- def singular_table_name: () -> untyped
2816
-
2817
- def plural_table_name: () -> untyped
2818
-
2819
- def plural_file_name: () -> untyped
2820
-
2821
- def fixture_file_name: () -> untyped
2822
-
2823
- def route_url: () -> untyped
2824
-
2825
- def url_helper_prefix: () -> untyped
2826
-
2827
- def application_name: () -> untyped
2828
-
2829
- def redirect_resource_name: () -> untyped
2830
-
2831
- def model_resource_name: (?prefix: ::String prefix) -> untyped
2832
-
2833
- def singular_route_name: () -> untyped
2834
-
2835
- def plural_route_name: () -> untyped
2836
-
2837
- def assign_names!: (untyped name) -> untyped
2838
-
2839
- # Convert attributes array into GeneratedAttribute objects.
2840
- def parse_attributes!: () -> untyped
2841
-
2842
- def attributes_names: () -> untyped
2843
-
2844
- def pluralize_table_names?: () -> untyped
2845
-
2846
- def mountable_engine?: () -> untyped
2847
-
2848
- def self.check_class_collision: (?::Hash[untyped, untyped] options) -> untyped
2849
- end
2850
- end
2851
- end
2852
-
2853
- module Rails
2854
- module ActionMethods
2855
- # :nodoc:
2856
- attr_reader options: untyped
2857
-
2858
- def initialize: (untyped generator) -> untyped
2859
-
2860
- def method_missing: (untyped meth, *untyped args) { () -> untyped } -> untyped
2861
- end
2862
-
2863
- # The application builder allows you to override elements of the application
2864
- # generator without being forced to reverse the operations of the default
2865
- # generator.
2866
- #
2867
- # This allows you to override entire operations, like the creation of the
2868
- # Gemfile, README, or JavaScript files, without needing to know exactly
2869
- # what those operations do so you can create another template action.
2870
- #
2871
- # class CustomAppBuilder < Rails::AppBuilder
2872
- # def test
2873
- # @generator.gem "rspec-rails", group: [:development, :test]
2874
- # run "bundle install"
2875
- # generate "rspec:install"
2876
- # end
2877
- # end
2878
- class AppBuilder
2879
- def rakefile: () -> untyped
2880
-
2881
- def readme: () -> untyped
2882
-
2883
- def ruby_version: () -> untyped
2884
-
2885
- def gemfile: () -> untyped
2886
-
2887
- def configru: () -> untyped
2888
-
2889
- def gitignore: () -> untyped
2890
-
2891
- def version_control: () -> untyped
2892
-
2893
- def package_json: () -> untyped
2894
-
2895
- def app: () -> untyped
2896
-
2897
- def bin: () -> untyped
2898
-
2899
- def bin_when_updating: () -> untyped
2900
-
2901
- def config: () -> untyped
2902
-
2903
- def config_when_updating: () -> untyped
2904
-
2905
- def master_key: () -> (nil | untyped)
2906
-
2907
- def credentials: () -> (nil | untyped)
2908
-
2909
- def database_yml: () -> untyped
2910
-
2911
- def db: () -> untyped
2912
-
2913
- def lib: () -> untyped
2914
-
2915
- def log: () -> untyped
2916
-
2917
- def public_directory: () -> untyped
2918
-
2919
- def storage: () -> untyped
2920
-
2921
- def test: () -> untyped
2922
-
2923
- def system_test: () -> untyped
2924
-
2925
- def tmp: () -> untyped
2926
-
2927
- def vendor: () -> untyped
2928
-
2929
- def config_target_version: () -> untyped
2930
- end
2931
-
2932
- module Generators
2933
- # We need to store the RAILS_DEV_PATH in a constant, otherwise the path
2934
- # can change in Ruby 1.8.7 when we FileUtils.cd.
2935
- RAILS_DEV_PATH: untyped
2936
-
2937
- class AppGenerator < AppBase
2938
- # :nodoc:
2939
- WEBPACKS: ::Array[untyped]
2940
-
2941
- def initialize: (*untyped args) -> untyped
2942
-
2943
- def create_root_files: () -> untyped
2944
-
2945
- def create_app_files: () -> untyped
2946
-
2947
- def create_bin_files: () -> untyped
2948
-
2949
- def update_bin_files: () -> untyped
2950
-
2951
- def update_active_storage: () -> untyped
2952
-
2953
- def create_config_files: () -> untyped
2954
-
2955
- def update_config_files: () -> untyped
2956
-
2957
- def create_master_key: () -> untyped
2958
-
2959
- def create_credentials: () -> untyped
2960
-
2961
- def display_upgrade_guide_info: () -> untyped
2962
-
2963
- def create_boot_file: () -> untyped
2964
-
2965
- def create_active_record_files: () -> (nil | untyped)
2966
-
2967
- def create_db_files: () -> (nil | untyped)
2968
-
2969
- def create_lib_files: () -> untyped
2970
-
2971
- def create_log_files: () -> untyped
2972
-
2973
- def create_public_files: () -> untyped
2974
-
2975
- def create_tmp_files: () -> untyped
2976
-
2977
- def create_vendor_files: () -> untyped
2978
-
2979
- def create_test_files: () -> untyped
2980
-
2981
- def create_system_test_files: () -> untyped
2982
-
2983
- def create_storage_files: () -> untyped
2984
-
2985
- def delete_app_assets_if_api_option: () -> untyped
2986
-
2987
- def delete_app_helpers_if_api_option: () -> untyped
2988
-
2989
- def delete_app_views_if_api_option: () -> untyped
2990
-
2991
- def delete_public_files_if_api_option: () -> untyped
2992
-
2993
- def delete_js_folder_skipping_javascript: () -> untyped
2994
-
2995
- def delete_assets_initializer_skipping_sprockets: () -> untyped
2996
-
2997
- def delete_application_record_skipping_active_record: () -> untyped
2998
-
2999
- def delete_action_mailer_files_skipping_action_mailer: () -> untyped
3000
-
3001
- def delete_action_cable_files_skipping_action_cable: () -> untyped
3002
-
3003
- def delete_non_api_initializers_if_api_option: () -> untyped
3004
-
3005
- def delete_api_initializers: () -> untyped
3006
-
3007
- def delete_new_framework_defaults: () -> untyped
3008
-
3009
- def delete_bin_yarn: () -> untyped
3010
-
3011
- def finish_template: () -> untyped
3012
-
3013
- def run_after_bundle_callbacks: () -> untyped
3014
-
3015
- def self.banner: () -> ::String
3016
-
3017
- # Define file as an alias to create_file for backwards compatibility.
3018
- def file: (*untyped args) { () -> untyped } -> untyped
3019
-
3020
- def after_bundle: () { () -> untyped } -> untyped
3021
-
3022
- def get_builder_class: () -> untyped
3023
- end
3024
-
3025
- class ARGVScrubber
3026
- # This class handles preparation of the arguments before the AppGenerator is
3027
- # called. The class provides version or help information if they were
3028
- # requested, and also constructs the railsrc file (used for extra configuration
3029
- # options).
3030
- #
3031
- # This class should be called before the AppGenerator is required and started
3032
- # since it configures and mutates ARGV correctly.
3033
- # :nodoc:
3034
- def initialize: (?untyped argv) -> untyped
3035
-
3036
- def prepare!: () -> untyped
3037
-
3038
- def self.default_rc_file: () -> untyped
3039
-
3040
- def handle_version_request!: (untyped argument) -> untyped
3041
-
3042
- def handle_invalid_command!: (untyped argument, untyped argv) { () -> untyped } -> untyped
3043
-
3044
- def handle_rails_rc!: (untyped argv) -> untyped
3045
-
3046
- def railsrc: (untyped argv) { (untyped, untyped) -> untyped } -> untyped
3047
-
3048
- def read_rc_file: (untyped railsrc) -> untyped
3049
-
3050
- def insert_railsrc_into_argv!: (untyped argv, untyped railsrc) -> untyped
3051
- end
3052
- end
3053
- end
3054
-
3055
- module Rails
3056
- module Generators
3057
- class ApplicationRecordGenerator < Base
3058
- end
3059
- end
3060
- end
3061
-
3062
- module Rails
3063
- module Generators
3064
- class AssetsGenerator < NamedBase
3065
- def asset_name: () -> untyped
3066
- end
3067
- end
3068
- end
3069
-
3070
- module Rails
3071
- module Generators
3072
- class ControllerGenerator < NamedBase
3073
- def create_controller_files: () -> untyped
3074
-
3075
- def add_routes: () -> (nil | untyped)
3076
-
3077
- def file_name: () -> untyped
3078
-
3079
- def remove_possible_suffix: (untyped name) -> untyped
3080
-
3081
- # This method creates nested route entry for namespaced resources.
3082
- # For eg. rails g controller foo/bar/baz index show
3083
- # Will generate -
3084
- # namespace :foo do
3085
- # namespace :bar do
3086
- # get 'baz/index'
3087
- # get 'baz/show'
3088
- # end
3089
- # end
3090
- def generate_routing_code: () -> untyped
3091
- end
3092
- end
3093
- end
3094
-
3095
- module Rails
3096
- module Generators
3097
- class CredentialsGenerator < Base
3098
- # :nodoc:
3099
- def add_credentials_file: () -> untyped
3100
-
3101
- def add_credentials_file_silently: (?untyped? template) -> untyped
3102
-
3103
- def credentials: () -> ActiveSupport::EncryptedConfiguration
3104
-
3105
- def credentials_template: () -> ::String
3106
- end
3107
- end
3108
- end
3109
-
3110
- module Rails
3111
- module Generators
3112
- module Db
3113
- module System
3114
- class ChangeGenerator < Base
3115
- # :nodoc:
3116
- include Database
3117
-
3118
- include AppName
3119
-
3120
- def self.default_generator_root: () -> untyped
3121
-
3122
- def initialize: () -> untyped
3123
-
3124
- def edit_database_config: () -> untyped
3125
-
3126
- def edit_gemfile: () -> untyped
3127
-
3128
- def all_database_gems: () -> untyped
3129
-
3130
- def all_database_gems_regex: () -> ::Regexp
3131
-
3132
- def gem_entry_regex_for: (untyped gem_name) -> ::Regexp
3133
-
3134
- def gem_entry_for: (*untyped gem_name_and_version) -> ::String
3135
- end
3136
- end
3137
- end
3138
- end
3139
- end
3140
-
3141
- module Rails
3142
- module Generators
3143
- class EncryptedFileGenerator < Base
3144
- # :nodoc:
3145
- def add_encrypted_file_silently: (untyped file_path, untyped key_path, ?untyped template) -> untyped
3146
-
3147
- def encrypted_file_template: () -> ::String
3148
- end
3149
- end
3150
- end
3151
-
3152
- module Rails
3153
- module Generators
3154
- class EncryptionKeyFileGenerator < Base
3155
- # :nodoc:
3156
- def add_key_file: (untyped key_path) -> untyped
3157
-
3158
- def add_key_file_silently: (untyped key_path, ?untyped? key) -> untyped
3159
-
3160
- def ignore_key_file: (untyped key_path, ?ignore: untyped ignore) -> untyped
3161
-
3162
- def ignore_key_file_silently: (untyped key_path, ?ignore: untyped ignore) -> untyped
3163
-
3164
- def key_ignore: (untyped key_path) -> untyped
3165
- end
3166
- end
3167
- end
3168
-
3169
- module Rails
3170
- module Generators
3171
- class GeneratorGenerator < NamedBase
3172
- def create_generator_files: () -> untyped
3173
-
3174
- def generator_dir: () -> untyped
3175
- end
3176
- end
3177
- end
3178
-
3179
- module Rails
3180
- module Generators
3181
- class HelperGenerator < NamedBase
3182
- def create_helper_files: () -> untyped
3183
-
3184
- def file_name: () -> untyped
3185
- end
3186
- end
3187
- end
3188
-
3189
- module Rails
3190
- module Generators
3191
- class IntegrationTestGenerator < NamedBase
3192
- end
3193
- end
3194
- end
3195
-
3196
- module Rails
3197
- module Generators
3198
- class MasterKeyGenerator < Base
3199
- # :nodoc:
3200
- MASTER_KEY_PATH: untyped
3201
-
3202
- def add_master_key_file: () -> untyped
3203
-
3204
- def add_master_key_file_silently: (?untyped? key) -> untyped
3205
-
3206
- def ignore_master_key_file: () -> untyped
3207
-
3208
- def ignore_master_key_file_silently: () -> untyped
3209
-
3210
- def key_file_generator: () -> EncryptionKeyFileGenerator
3211
-
3212
- def key_ignore: () -> untyped
3213
- end
3214
- end
3215
- end
3216
-
3217
- module Rails
3218
- module Generators
3219
- class MigrationGenerator < NamedBase
3220
- end
3221
- end
3222
- end
3223
-
3224
- module Rails
3225
- module Generators
3226
- class ModelGenerator < NamedBase
3227
- # :nodoc:
3228
- include Rails::Generators::ModelHelpers
3229
- end
3230
- end
3231
- end
3232
-
3233
- module Rails
3234
- # The plugin builder allows you to override elements of the plugin
3235
- # generator without being forced to reverse the operations of the default
3236
- # generator.
3237
- #
3238
- # This allows you to override entire operations, like the creation of the
3239
- # Gemfile, \README, or JavaScript files, without needing to know exactly
3240
- # what those operations do so you can create another template action.
3241
- class PluginBuilder
3242
- def rakefile: () -> untyped
3243
-
3244
- def app: () -> untyped
3245
-
3246
- def readme: () -> untyped
3247
-
3248
- def gemfile: () -> untyped
3249
-
3250
- def license: () -> untyped
3251
-
3252
- def gemspec: () -> untyped
3253
-
3254
- def gitignore: () -> untyped
3255
-
3256
- def lib: () -> untyped
3257
-
3258
- def config: () -> untyped
3259
-
3260
- def test: () -> untyped
3261
-
3262
- PASSTHROUGH_OPTIONS: ::Array[untyped]
3263
-
3264
- def generate_test_dummy: (?bool force) -> untyped
3265
-
3266
- def test_dummy_config: () -> untyped
3267
-
3268
- def test_dummy_assets: () -> untyped
3269
-
3270
- def test_dummy_clean: () -> untyped
3271
-
3272
- def assets_manifest: () -> untyped
3273
-
3274
- def stylesheets: () -> untyped
3275
-
3276
- def bin: (?bool force) -> untyped
3277
-
3278
- def gemfile_entry: () -> (nil | untyped)
3279
- end
3280
-
3281
- module Generators
3282
- class PluginGenerator < AppBase
3283
- def initialize: (*untyped args) -> untyped
3284
-
3285
- def create_root_files: () -> untyped
3286
-
3287
- def create_app_files: () -> untyped
3288
-
3289
- def create_config_files: () -> untyped
3290
-
3291
- def create_lib_files: () -> untyped
3292
-
3293
- def create_assets_manifest_file: () -> untyped
3294
-
3295
- def create_public_stylesheets_files: () -> untyped
3296
-
3297
- def create_bin_files: () -> untyped
3298
-
3299
- def create_test_files: () -> untyped
3300
-
3301
- def create_test_dummy_files: () -> (nil | untyped)
3302
-
3303
- def update_gemfile: () -> untyped
3304
-
3305
- def finish_template: () -> untyped
3306
-
3307
- def name: () -> untyped
3308
-
3309
- def underscored_name: () -> untyped
3310
-
3311
- def namespaced_name: () -> untyped
3312
-
3313
- def create_dummy_app: (?untyped? path) -> untyped
3314
-
3315
- def engine?: () -> untyped
3316
-
3317
- def full?: () -> untyped
3318
-
3319
- def mountable?: () -> untyped
3320
-
3321
- def skip_git?: () -> untyped
3322
-
3323
- def with_dummy_app?: () -> untyped
3324
-
3325
- def api?: () -> untyped
3326
-
3327
- def self.banner: () -> ::String
3328
-
3329
- def original_name: () -> untyped
3330
-
3331
- def modules: () -> untyped
3332
-
3333
- def wrap_in_modules: (untyped unwrapped_code) -> untyped
3334
-
3335
- def camelized_modules: () -> untyped
3336
-
3337
- def humanized: () -> untyped
3338
-
3339
- def camelized: () -> untyped
3340
-
3341
- def author: () -> untyped
3342
-
3343
- def email: () -> untyped
3344
-
3345
- def valid_const?: () -> untyped
3346
-
3347
- def application_definition: () -> untyped
3348
-
3349
- def get_builder_class: () -> untyped
3350
-
3351
- def rakefile_test_tasks: () -> ::String
3352
-
3353
- def dummy_path: (?untyped? path) -> untyped
3354
-
3355
- def mute: () { () -> untyped } -> untyped
3356
-
3357
- def rails_app_path: () -> untyped
3358
-
3359
- def inside_application?: () -> untyped
3360
-
3361
- def relative_path: () -> (nil | untyped)
3362
- end
3363
- end
3364
- end
3365
-
3366
- module Rails
3367
- module Generators
3368
- class ResourceGenerator < ModelGenerator
3369
- # :nodoc:
3370
- include ResourceHelpers
3371
- end
3372
- end
3373
- end
3374
-
3375
- module Rails
3376
- module Generators
3377
- class ResourceRouteGenerator < NamedBase
3378
- # :nodoc:
3379
- # Properly nests namespaces passed into a generator
3380
- #
3381
- # $ rails generate resource admin/users/products
3382
- #
3383
- # should give you
3384
- #
3385
- # namespace :admin do
3386
- # namespace :users do
3387
- # resources :products
3388
- # end
3389
- # end
3390
- def add_resource_route: () -> (nil | untyped)
3391
- end
3392
- end
3393
- end
3394
-
3395
- module Rails
3396
- module Generators
3397
- class ScaffoldControllerGenerator < NamedBase
3398
- # :nodoc:
3399
- include ResourceHelpers
3400
-
3401
- def create_controller_files: () -> untyped
3402
-
3403
- def permitted_params: () -> untyped
3404
-
3405
- def attachments?: (untyped name) -> untyped
3406
- end
3407
- end
3408
- end
3409
-
3410
- module Rails
3411
- module Generators
3412
- class ScaffoldGenerator < ResourceGenerator
3413
- def handle_skip: () -> untyped
3414
- end
3415
- end
3416
- end
3417
-
3418
- module Rails
3419
- module Generators
3420
- class SystemTestGenerator < NamedBase
3421
- end
3422
- end
3423
- end
3424
-
3425
- module Rails
3426
- module Generators
3427
- class TaskGenerator < NamedBase
3428
- def create_task_files: () -> untyped
3429
- end
3430
- end
3431
- end
3432
-
3433
- module Rails
3434
- module Generators
3435
- include Rails::Command::Behavior
3436
-
3437
- DEFAULT_ALIASES: ::Hash[untyped, untyped]
3438
-
3439
- DEFAULT_OPTIONS: ::Hash[untyped, untyped]
3440
-
3441
- def self.configure!: (untyped config) -> untyped
3442
-
3443
- def self.templates_path: () -> untyped
3444
-
3445
- def self.aliases: () -> untyped
3446
-
3447
- def self.options: () -> untyped
3448
-
3449
- # Hold configured generators fallbacks. If a plugin developer wants a
3450
- # generator group to fallback to another group in case of missing generators,
3451
- # they can add a fallback.
3452
- #
3453
- # For example, shoulda is considered a test_framework and is an extension
3454
- # of test_unit. However, most part of shoulda generators are similar to
3455
- # test_unit ones.
3456
- #
3457
- # Shoulda then can tell generators to search for test_unit generators when
3458
- # some of them are not available by adding a fallback:
3459
- #
3460
- # Rails::Generators.fallbacks[:shoulda] = :test_unit
3461
- def self.fallbacks: () -> untyped
3462
-
3463
- # Configure generators for API only applications. It basically hides
3464
- # everything that is usually browser related, such as assets and session
3465
- # migration generators, and completely disable helpers and assets
3466
- # so generators such as scaffold won't create them.
3467
- def self.api_only!: () -> untyped
3468
-
3469
- # Remove the color from output.
3470
- def self.no_color!: () -> untyped
3471
-
3472
- # Returns an array of generator namespaces that are hidden.
3473
- # Generator namespaces may be hidden for a variety of reasons.
3474
- # Some are aliased such as "rails:migration" and can be
3475
- # invoked with the shorter "migration", others are private to other generators
3476
- # such as "css:scaffold".
3477
- def self.hidden_namespaces: () -> untyped
3478
-
3479
- def self.hide_namespaces: (*untyped namespaces) -> untyped
3480
-
3481
- # Show help message with available generators.
3482
- def self.help: (?::String command) -> untyped
3483
-
3484
- def self.public_namespaces: () -> untyped
3485
-
3486
- def self.print_generators: () -> untyped
3487
-
3488
- def self.sorted_groups: () -> untyped
3489
-
3490
- def self.find_by_namespace: (untyped name, ?untyped? base, ?untyped? context) -> untyped
3491
-
3492
- # Receives a namespace, arguments and the behavior to invoke the generator.
3493
- # It's used as the default entry point for generate, destroy and update
3494
- # commands.
3495
- def self.invoke: (untyped namespace, ?untyped args, ?::Hash[untyped, untyped] config) -> untyped
3496
-
3497
- def self.print_list: (untyped base, untyped namespaces) -> untyped
3498
-
3499
- # Try fallbacks for the given base.
3500
- def self.invoke_fallbacks_for: (untyped name, untyped base) -> (nil | untyped)
3501
-
3502
- def self.command_type: () -> untyped
3503
-
3504
- def self.lookup_paths: () -> untyped
3505
-
3506
- def self.file_lookup_paths: () -> untyped
3507
- end
3508
- end
3509
-
3510
- module Rails
3511
- module Generators
3512
- module ResourceHelpers
3513
- def self.included: (untyped base) -> untyped
3514
-
3515
- def initialize: (*untyped args) -> untyped
3516
-
3517
- attr_reader controller_name: untyped
3518
-
3519
- attr_reader controller_file_name: untyped
3520
-
3521
- def controller_class_path: () -> untyped
3522
-
3523
- def assign_controller_names!: (untyped name) -> untyped
3524
-
3525
- def controller_file_path: () -> untyped
3526
-
3527
- def controller_class_name: () -> untyped
3528
-
3529
- def controller_i18n_scope: () -> untyped
3530
-
3531
- # Loads the ORM::Generators::ActiveModel class. This class is responsible
3532
- # to tell scaffold entities how to generate a specific method for the
3533
- # ORM. Check Rails::Generators::ActiveModel for more information.
3534
- def orm_class: () -> untyped
3535
-
3536
- # Initialize ORM::Generators::ActiveModel to access instance methods.
3537
- def orm_instance: (?untyped name) -> untyped
3538
- end
3539
- end
3540
- end
3541
-
3542
- module Rails
3543
- module Generators
3544
- # This class provides a TestCase for testing generators. To setup, you need
3545
- # just to configure the destination and set which generator is being tested:
3546
- #
3547
- # class AppGeneratorTest < Rails::Generators::TestCase
3548
- # tests AppGenerator
3549
- # destination File.expand_path("../tmp", __dir__)
3550
- # end
3551
- #
3552
- # If you want to ensure your destination root is clean before running each test,
3553
- # you can set a setup callback:
3554
- #
3555
- # class AppGeneratorTest < Rails::Generators::TestCase
3556
- # tests AppGenerator
3557
- # destination File.expand_path("../tmp", __dir__)
3558
- # setup :prepare_destination
3559
- # end
3560
- class TestCase < ActiveSupport::TestCase
3561
- include Rails::Generators::Testing::Behaviour
3562
-
3563
- extend ::Rails::Generators::Testing::Behaviour::ClassMethods
3564
-
3565
- include Rails::Generators::Testing::SetupAndTeardown
3566
-
3567
- include Rails::Generators::Testing::Assertions
3568
-
3569
- include FileUtils
3570
- end
3571
- end
3572
- end
3573
-
3574
- module Rails
3575
- module Generators
3576
- module Testing
3577
- module Assertions
3578
- # Asserts a given file exists. You need to supply an absolute path or a path relative
3579
- # to the configured destination:
3580
- #
3581
- # assert_file "config/environment.rb"
3582
- #
3583
- # You can also give extra arguments. If the argument is a regexp, it will check if the
3584
- # regular expression matches the given file content. If it's a string, it compares the
3585
- # file with the given string:
3586
- #
3587
- # assert_file "config/environment.rb", /initialize/
3588
- #
3589
- # Finally, when a block is given, it yields the file content:
3590
- #
3591
- # assert_file "app/controllers/products_controller.rb" do |controller|
3592
- # assert_instance_method :index, controller do |index|
3593
- # assert_match(/Product\.all/, index)
3594
- # end
3595
- # end
3596
- def assert_file: (untyped relative, *untyped contents) { (untyped) -> untyped } -> untyped
3597
-
3598
- # Asserts a given file does not exist. You need to supply an absolute path or a
3599
- # path relative to the configured destination:
3600
- #
3601
- # assert_no_file "config/random.rb"
3602
- def assert_no_file: (untyped relative) -> untyped
3603
-
3604
- # Asserts a given migration exists. You need to supply an absolute path or a
3605
- # path relative to the configured destination:
3606
- #
3607
- # assert_migration "db/migrate/create_products.rb"
3608
- #
3609
- # This method manipulates the given path and tries to find any migration which
3610
- # matches the migration name. For example, the call above is converted to:
3611
- #
3612
- # assert_file "db/migrate/003_create_products.rb"
3613
- #
3614
- # Consequently, assert_migration accepts the same arguments has assert_file.
3615
- def assert_migration: (untyped relative, *untyped contents) { () -> untyped } -> untyped
3616
-
3617
- # Asserts a given migration does not exist. You need to supply an absolute path or a
3618
- # path relative to the configured destination:
3619
- #
3620
- # assert_no_migration "db/migrate/create_products.rb"
3621
- def assert_no_migration: (untyped relative) -> untyped
3622
-
3623
- # Asserts the given class method exists in the given content. This method does not detect
3624
- # class methods inside (class << self), only class methods which starts with "self.".
3625
- # When a block is given, it yields the content of the method.
3626
- #
3627
- # assert_migration "db/migrate/create_products.rb" do |migration|
3628
- # assert_class_method :up, migration do |up|
3629
- # assert_match(/create_table/, up)
3630
- # end
3631
- # end
3632
- def assert_class_method: (untyped method, untyped content) { () -> untyped } -> untyped
3633
-
3634
- # Asserts the given method exists in the given content. When a block is given,
3635
- # it yields the content of the method.
3636
- #
3637
- # assert_file "app/controllers/products_controller.rb" do |controller|
3638
- # assert_instance_method :index, controller do |index|
3639
- # assert_match(/Product\.all/, index)
3640
- # end
3641
- # end
3642
- def assert_instance_method: (untyped method, untyped content) { (untyped) -> untyped } -> untyped
3643
-
3644
- # Asserts the given attribute type gets translated to a field type
3645
- # properly:
3646
- #
3647
- # assert_field_type :date, :date_select
3648
- def assert_field_type: (untyped attribute_type, untyped field_type) -> untyped
3649
-
3650
- # Asserts the given attribute type gets a proper default value:
3651
- #
3652
- # assert_field_default_value :string, "MyString"
3653
- def assert_field_default_value: (untyped attribute_type, untyped value) -> untyped
3654
- end
3655
- end
3656
- end
3657
- end
3658
-
3659
- module Rails
3660
- module Generators
3661
- module Testing
3662
- module Behaviour
3663
- extend ActiveSupport::Concern
3664
-
3665
- include ActiveSupport::Testing::Stream
3666
-
3667
- module ClassMethods
3668
- # Sets which generator should be tested:
3669
- #
3670
- # tests AppGenerator
3671
- def tests: (untyped klass) -> untyped
3672
-
3673
- # Sets default arguments on generator invocation. This can be overwritten when
3674
- # invoking it.
3675
- #
3676
- # arguments %w(app_name --skip-active-record)
3677
- def arguments: (untyped array) -> untyped
3678
-
3679
- # Sets the destination of generator files:
3680
- #
3681
- # destination File.expand_path("../tmp", __dir__)
3682
- def destination: (untyped path) -> untyped
3683
- end
3684
-
3685
- # Runs the generator configured for this class. The first argument is an array like
3686
- # command line arguments:
3687
- #
3688
- # class AppGeneratorTest < Rails::Generators::TestCase
3689
- # tests AppGenerator
3690
- # destination File.expand_path("../tmp", __dir__)
3691
- # setup :prepare_destination
3692
- #
3693
- # test "database.yml is not created when skipping Active Record" do
3694
- # run_generator %w(myapp --skip-active-record)
3695
- # assert_no_file "config/database.yml"
3696
- # end
3697
- # end
3698
- #
3699
- # You can provide a configuration hash as second argument. This method returns the output
3700
- # printed by the generator.
3701
- def run_generator: (?untyped args, ?::Hash[untyped, untyped] config) -> untyped
3702
-
3703
- # Instantiate the generator.
3704
- def generator: (?untyped args, ?::Hash[untyped, untyped] options, ?::Hash[untyped, untyped] config) -> untyped
3705
-
3706
- # Create a Rails::Generators::GeneratedAttribute by supplying the
3707
- # attribute type and, optionally, the attribute name:
3708
- #
3709
- # create_generated_attribute(:string, 'name')
3710
- def create_generated_attribute: (untyped attribute_type, ?::String name, ?untyped? index) -> untyped
3711
-
3712
- def destination_root_is_set?: () -> untyped
3713
-
3714
- def ensure_current_path: () -> untyped
3715
-
3716
- def prepare_destination: () -> untyped
3717
-
3718
- def migration_file_name: (untyped relative) -> untyped
3719
- end
3720
- end
3721
- end
3722
- end
3723
-
3724
- module Rails
3725
- module Generators
3726
- module Testing
3727
- module SetupAndTeardown
3728
- def setup: () -> untyped
3729
-
3730
- def teardown: () -> untyped
3731
- end
3732
- end
3733
- end
3734
- end
3735
-
3736
- module TestUnit
3737
- module Generators
3738
- class ControllerGenerator < Base
3739
- def create_test_files: () -> untyped
3740
- end
3741
- end
3742
- end
3743
-
3744
- module TestUnit
3745
- module Generators
3746
- class GeneratorGenerator < Base
3747
- def create_generator_files: () -> untyped
3748
-
3749
- def generator_path: () -> untyped
3750
- end
3751
- end
3752
- end
3753
-
3754
- module TestUnit
3755
- module Generators
3756
- class HelperGenerator < Base
3757
- end
3758
- end
3759
- end
3760
-
3761
- module TestUnit
3762
- module Generators
3763
- class IntegrationGenerator < Base
3764
- def create_test_files: () -> untyped
3765
-
3766
- def file_name: () -> untyped
3767
- end
3768
- end
3769
- end
3770
-
3771
- module TestUnit
3772
- module Generators
3773
- class JobGenerator < Base
3774
- def create_test_file: () -> untyped
3775
-
3776
- def file_name: () -> untyped
3777
- end
3778
- end
3779
- end
3780
-
3781
- module TestUnit
3782
- module Generators
3783
- class MailerGenerator < Base
3784
- def check_class_collision: () -> untyped
3785
-
3786
- def create_test_files: () -> untyped
3787
-
3788
- def create_preview_files: () -> untyped
3789
-
3790
- def file_name: () -> untyped
3791
- end
3792
- end
3793
- end
3794
-
3795
- module TestUnit
3796
- module Generators
3797
- class ModelGenerator < Base
3798
- # :nodoc:
3799
- # :nodoc:
3800
- # :nodoc:
3801
- RESERVED_YAML_KEYWORDS: ::Array[untyped]
3802
-
3803
- def create_test_file: () -> untyped
3804
-
3805
- def create_fixture_file: () -> untyped
3806
-
3807
- def yaml_key_value: (untyped key, untyped value) -> untyped
3808
- end
3809
- end
3810
- end
3811
-
3812
- module TestUnit
3813
- module Generators
3814
- class PluginGenerator < Base
3815
- def create_test_files: () -> untyped
3816
- end
3817
- end
3818
- end
3819
-
3820
- module TestUnit
3821
- module Generators
3822
- class Base < Rails::Generators::NamedBase
3823
- end
3824
- end
3825
- end
3826
-
3827
- module TestUnit
3828
- module Generators
3829
- class ScaffoldGenerator < Base
3830
- # :nodoc:
3831
- # :nodoc:
3832
- # :nodoc:
3833
- include Rails::Generators::ResourceHelpers
3834
-
3835
- def create_test_files: () -> untyped
3836
-
3837
- def fixture_name: () -> untyped
3838
-
3839
- def attributes_string: () -> untyped
3840
-
3841
- def attributes_hash: () -> (::Hash[untyped, untyped] | untyped)
3842
-
3843
- def boolean?: (untyped name) -> untyped
3844
-
3845
- def virtual?: (untyped name) -> untyped
3846
- end
3847
- end
3848
- end
3849
-
3850
- module TestUnit
3851
- module Generators
3852
- class SystemGenerator < Base
3853
- def create_test_files: () -> untyped
3854
-
3855
- def file_name: () -> untyped
3856
- end
3857
- end
3858
- end
3859
-
3860
- class Rails::InfoController < Rails::ApplicationController
3861
- def index: () -> untyped
3862
-
3863
- def properties: () -> untyped
3864
-
3865
- def routes: () -> untyped
3866
-
3867
- def match_route: () { (untyped) -> untyped } -> untyped
3868
-
3869
- def with_leading_slash: (untyped path) -> untyped
3870
- end
3871
-
3872
- module Rails
3873
- # This module helps build the runtime properties that are displayed in
3874
- # Rails::InfoController responses. These include the active Rails version,
3875
- # Ruby version, Rack version, and so on.
3876
- module Info
3877
- def self.names: () -> untyped
3878
-
3879
- def self.value_for: (untyped property_name) -> untyped
3880
-
3881
- # nodoc:
3882
- def self.property: (untyped name, ?untyped? value) { () -> untyped } -> untyped
3883
-
3884
- def self.to_s: () -> untyped
3885
-
3886
- def self.to_html: () -> untyped
3887
- end
3888
- end
3889
-
3890
- module Rails
3891
- module Initializable
3892
- def self.included: (untyped base) -> untyped
3893
-
3894
- class Initializer
3895
- attr_reader name: untyped
3896
-
3897
- attr_reader block: untyped
3898
-
3899
- def initialize: (untyped name, untyped context, untyped options) { () -> untyped } -> untyped
3900
-
3901
- def before: () -> untyped
3902
-
3903
- def after: () -> untyped
3904
-
3905
- def belongs_to?: (untyped group) -> untyped
3906
-
3907
- def run: (*untyped args) -> untyped
3908
-
3909
- def bind: (untyped context) -> (untyped | Initializer)
3910
-
3911
- def context_class: () -> untyped
3912
- end
3913
-
3914
- class Collection[T] < Array[T]
3915
- include TSort
3916
-
3917
- def tsort_each_child: (untyped initializer) { () -> untyped } -> untyped
3918
-
3919
- def +: (untyped other) -> Collection[untyped]
3920
- end
3921
-
3922
- def run_initializers: (?::Symbol group, *untyped args) -> (nil | untyped)
3923
-
3924
- def initializers: () -> untyped
3925
-
3926
- module ClassMethods
3927
- def initializers: () -> untyped
3928
-
3929
- def initializers_chain: () -> untyped
3930
-
3931
- def initializers_for: (untyped binding) -> Collection[untyped]
3932
-
3933
- def initializer: (untyped name, ?::Hash[untyped, untyped] opts) { () -> untyped } -> untyped
3934
- end
3935
- end
3936
- end
3937
-
3938
- class Rails::MailersController < Rails::ApplicationController
3939
- def index: () -> untyped
3940
-
3941
- def preview: () -> untyped
3942
-
3943
- def show_previews?: () -> untyped
3944
-
3945
- def find_preview: () -> untyped
3946
-
3947
- def find_preferred_part: (*untyped formats) -> untyped
3948
-
3949
- def find_part: (untyped format) -> untyped
3950
-
3951
- def part_query: (untyped mime_type) -> untyped
3952
-
3953
- def locale_query: (untyped locale) -> untyped
3954
-
3955
- def set_locale: () { () -> untyped } -> untyped
3956
- end
3957
-
3958
- module Rails
3959
- module Paths
3960
- # This object is an extended hash that behaves as root of the <tt>Rails::Paths</tt> system.
3961
- # It allows you to collect information about how you want to structure your application
3962
- # paths through a Hash-like API. It requires you to give a physical path on initialization.
3963
- #
3964
- # root = Root.new "/rails"
3965
- # root.add "app/controllers", eager_load: true
3966
- #
3967
- # The above command creates a new root object and adds "app/controllers" as a path.
3968
- # This means we can get a <tt>Rails::Paths::Path</tt> object back like below:
3969
- #
3970
- # path = root["app/controllers"]
3971
- # path.eager_load? # => true
3972
- # path.is_a?(Rails::Paths::Path) # => true
3973
- #
3974
- # The +Path+ object is simply an enumerable and allows you to easily add extra paths:
3975
- #
3976
- # path.is_a?(Enumerable) # => true
3977
- # path.to_ary.inspect # => ["app/controllers"]
3978
- #
3979
- # path << "lib/controllers"
3980
- # path.to_ary.inspect # => ["app/controllers", "lib/controllers"]
3981
- #
3982
- # Notice that when you add a path using +add+, the path object created already
3983
- # contains the path with the same path value given to +add+. In some situations,
3984
- # you may not want this behavior, so you can give <tt>:with</tt> as option.
3985
- #
3986
- # root.add "config/routes", with: "config/routes.rb"
3987
- # root["config/routes"].inspect # => ["config/routes.rb"]
3988
- #
3989
- # The +add+ method accepts the following options as arguments:
3990
- # eager_load, autoload, autoload_once, and glob.
3991
- #
3992
- # Finally, the +Path+ object also provides a few helpers:
3993
- #
3994
- # root = Root.new "/rails"
3995
- # root.add "app/controllers"
3996
- #
3997
- # root["app/controllers"].expanded # => ["/rails/app/controllers"]
3998
- # root["app/controllers"].existent # => ["/rails/app/controllers"]
3999
- #
4000
- # Check the <tt>Rails::Paths::Path</tt> documentation for more information.
4001
- class Root
4002
- attr_accessor path: untyped
4003
-
4004
- def initialize: (untyped path) -> untyped
4005
-
4006
- def []=: (untyped path, untyped value) -> untyped
4007
-
4008
- def add: (untyped path, ?::Hash[untyped, untyped] options) -> untyped
4009
-
4010
- def []: (untyped path) -> untyped
4011
-
4012
- def values: () -> untyped
4013
-
4014
- def keys: () -> untyped
4015
-
4016
- def values_at: (*untyped list) -> untyped
4017
-
4018
- def all_paths: () -> untyped
4019
-
4020
- def autoload_once: () -> untyped
4021
-
4022
- def eager_load: () -> untyped
4023
-
4024
- def autoload_paths: () -> untyped
4025
-
4026
- def load_paths: () -> untyped
4027
-
4028
- def filter_by: () { (untyped) -> untyped } -> untyped
4029
- end
4030
-
4031
- class Path
4032
- include Enumerable[untyped, untyped]
4033
-
4034
- attr_accessor glob: untyped
4035
-
4036
- def initialize: (untyped root, untyped current, untyped paths, ?::Hash[untyped, untyped] options) -> untyped
4037
-
4038
- def absolute_current: () -> untyped
4039
-
4040
- def children: () -> untyped
4041
-
4042
- def first: () -> untyped
4043
-
4044
- def last: () -> untyped
4045
-
4046
- def each: () { () -> untyped } -> untyped
4047
-
4048
- def <<: (untyped path) -> untyped
4049
-
4050
- def concat: (untyped paths) -> untyped
4051
-
4052
- def unshift: (*untyped paths) -> untyped
4053
-
4054
- def to_ary: () -> untyped
4055
-
4056
- def extensions: () -> untyped
4057
-
4058
- # Expands all paths against the root and return all unique values.
4059
- def expanded: () -> untyped
4060
-
4061
- # Returns all expanded paths but only if they exist in the filesystem.
4062
- def existent: () -> untyped
4063
-
4064
- def existent_directories: () -> untyped
4065
-
4066
- def files_in: (untyped path) -> untyped
4067
- end
4068
- end
4069
- end
4070
-
4071
- module Rails
4072
- module Rack
4073
- # Sets log tags, logs the request, calls the app, and flushes the logs.
4074
- #
4075
- # Log tags (+taggers+) can be an Array containing: methods that the +request+
4076
- # object responds to, objects that respond to +to_s+ or Proc objects that accept
4077
- # an instance of the +request+ object.
4078
- class Logger < ActiveSupport::LogSubscriber
4079
- def initialize: (untyped app, ?untyped? taggers) -> untyped
4080
-
4081
- def call: (untyped env) -> untyped
4082
-
4083
- def call_app: (untyped request, untyped env) -> untyped
4084
-
4085
- def started_request_message: (untyped request) -> untyped
4086
-
4087
- def compute_tags: (untyped request) -> untyped
4088
-
4089
- def finish: (untyped request) -> untyped
4090
-
4091
- def logger: () -> untyped
4092
- end
4093
- end
4094
- end
4095
-
4096
- module Rails
4097
- module Rack
4098
- end
4099
- end
4100
-
4101
- module Rails
4102
- class Railtie
4103
- module Configurable
4104
- extend ActiveSupport::Concern
4105
-
4106
- module ClassMethods
4107
- def inherited: (untyped base) -> untyped
4108
-
4109
- def `instance`: () -> untyped
4110
-
4111
- def respond_to?: (*untyped args) -> untyped
4112
-
4113
- def configure: () { () -> untyped } -> untyped
4114
-
4115
- def method_missing: (*untyped args) { () -> untyped } -> untyped
4116
- end
4117
- end
4118
- end
4119
- end
4120
-
4121
- module Rails
4122
- class Railtie
4123
- class Configuration
4124
- def initialize: () -> untyped
4125
-
4126
- def self.eager_load_namespaces: () -> untyped
4127
-
4128
- # All namespaces that are eager loaded
4129
- def eager_load_namespaces: () -> untyped
4130
-
4131
- # Add files that should be watched for change.
4132
- def watchable_files: () -> untyped
4133
-
4134
- # Add directories that should be watched for change.
4135
- # The key of the hashes should be directories and the values should
4136
- # be an array of extensions to match in each directory.
4137
- def watchable_dirs: () -> untyped
4138
-
4139
- # This allows you to modify the application's middlewares from Engines.
4140
- #
4141
- # All operations you run on the app_middleware will be replayed on the
4142
- # application once it is defined and the default_middlewares are
4143
- # created
4144
- def app_middleware: () -> untyped
4145
-
4146
- # This allows you to modify application's generators from Railties.
4147
- #
4148
- # Values set on app_generators will become defaults for application, unless
4149
- # application overwrites them.
4150
- def app_generators: () { (untyped) -> untyped } -> untyped
4151
-
4152
- # First configurable block to run. Called before any initializers are run.
4153
- def before_configuration: () { () -> untyped } -> untyped
4154
-
4155
- # Third configurable block to run. Does not run if +config.eager_load+
4156
- # set to false.
4157
- def before_eager_load: () { () -> untyped } -> untyped
4158
-
4159
- # Second configurable block to run. Called before frameworks initialize.
4160
- def before_initialize: () { () -> untyped } -> untyped
4161
-
4162
- # Last configurable block to run. Called after frameworks initialize.
4163
- def after_initialize: () { () -> untyped } -> untyped
4164
-
4165
- # Array of callbacks defined by #to_prepare.
4166
- def to_prepare_blocks: () -> untyped
4167
-
4168
- # Defines generic callbacks to run before #after_initialize. Useful for
4169
- # Rails::Railtie subclasses.
4170
- def to_prepare: () { () -> untyped } -> untyped
4171
-
4172
- def respond_to?: (untyped name, ?bool include_private) -> untyped
4173
-
4174
- def method_missing: (untyped name, *untyped args) { () -> untyped } -> untyped
4175
- end
4176
- end
4177
- end
4178
-
4179
- module Rails
4180
- # <tt>Rails::Railtie</tt> is the core of the Rails framework and provides
4181
- # several hooks to extend Rails and/or modify the initialization process.
4182
- #
4183
- # Every major component of Rails (Action Mailer, Action Controller, Active
4184
- # Record, etc.) implements a railtie. Each of them is responsible for their
4185
- # own initialization. This makes Rails itself absent of any component hooks,
4186
- # allowing other components to be used in place of any of the Rails defaults.
4187
- #
4188
- # Developing a Rails extension does _not_ require implementing a railtie, but
4189
- # if you need to interact with the Rails framework during or after boot, then
4190
- # a railtie is needed.
4191
- #
4192
- # For example, an extension doing any of the following would need a railtie:
4193
- #
4194
- # * creating initializers
4195
- # * configuring a Rails framework for the application, like setting a generator
4196
- # * adding <tt>config.*</tt> keys to the environment
4197
- # * setting up a subscriber with <tt>ActiveSupport::Notifications</tt>
4198
- # * adding Rake tasks
4199
- #
4200
- # == Creating a Railtie
4201
- #
4202
- # To extend Rails using a railtie, create a subclass of <tt>Rails::Railtie</tt>.
4203
- # This class must be loaded during the Rails boot process, and is conventionally
4204
- # called <tt>MyNamespace::Railtie</tt>.
4205
- #
4206
- # The following example demonstrates an extension which can be used with or
4207
- # without Rails.
4208
- #
4209
- # # lib/my_gem/railtie.rb
4210
- # module MyGem
4211
- # class Railtie < Rails::Railtie
4212
- # end
4213
- # end
4214
- #
4215
- # # lib/my_gem.rb
4216
- # require 'my_gem/railtie' if defined?(Rails)
4217
- #
4218
- # == Initializers
4219
- #
4220
- # To add an initialization step to the Rails boot process from your railtie, just
4221
- # define the initialization code with the +initializer+ macro:
4222
- #
4223
- # class MyRailtie < Rails::Railtie
4224
- # initializer "my_railtie.configure_rails_initialization" do
4225
- # # some initialization behavior
4226
- # end
4227
- # end
4228
- #
4229
- # If specified, the block can also receive the application object, in case you
4230
- # need to access some application-specific configuration, like middleware:
4231
- #
4232
- # class MyRailtie < Rails::Railtie
4233
- # initializer "my_railtie.configure_rails_initialization" do |app|
4234
- # app.middleware.use MyRailtie::Middleware
4235
- # end
4236
- # end
4237
- #
4238
- # Finally, you can also pass <tt>:before</tt> and <tt>:after</tt> as options to
4239
- # +initializer+, in case you want to couple it with a specific step in the
4240
- # initialization process.
4241
- #
4242
- # == Configuration
4243
- #
4244
- # Railties can access a config object which contains configuration shared by all
4245
- # railties and the application:
4246
- #
4247
- # class MyRailtie < Rails::Railtie
4248
- # # Customize the ORM
4249
- # config.app_generators.orm :my_railtie_orm
4250
- #
4251
- # # Add a to_prepare block which is executed once in production
4252
- # # and before each request in development.
4253
- # config.to_prepare do
4254
- # MyRailtie.setup!
4255
- # end
4256
- # end
4257
- #
4258
- # == Loading Rake Tasks and Generators
4259
- #
4260
- # If your railtie has Rake tasks, you can tell Rails to load them through the method
4261
- # +rake_tasks+:
4262
- #
4263
- # class MyRailtie < Rails::Railtie
4264
- # rake_tasks do
4265
- # load 'path/to/my_railtie.tasks'
4266
- # end
4267
- # end
4268
- #
4269
- # By default, Rails loads generators from your load path. However, if you want to place
4270
- # your generators at a different location, you can specify in your railtie a block which
4271
- # will load them during normal generators lookup:
4272
- #
4273
- # class MyRailtie < Rails::Railtie
4274
- # generators do
4275
- # require 'path/to/my_railtie_generator'
4276
- # end
4277
- # end
4278
- #
4279
- # Since filenames on the load path are shared across gems, be sure that files you load
4280
- # through a railtie have unique names.
4281
- #
4282
- # == Application and Engine
4283
- #
4284
- # An engine is nothing more than a railtie with some initializers already set. And since
4285
- # <tt>Rails::Application</tt> is an engine, the same configuration described here can be
4286
- # used in both.
4287
- #
4288
- # Be sure to look at the documentation of those specific classes for more information.
4289
- class Railtie
4290
- include Initializable
4291
-
4292
- ABSTRACT_RAILTIES: ::Array[untyped]
4293
-
4294
- def self.subclasses: () -> untyped
4295
-
4296
- def self.inherited: (untyped base) -> untyped
4297
-
4298
- def self.rake_tasks: () { () -> untyped } -> untyped
4299
-
4300
- def self.console: () { () -> untyped } -> untyped
4301
-
4302
- def self.runner: () { () -> untyped } -> untyped
4303
-
4304
- def self.generators: () { () -> untyped } -> untyped
4305
-
4306
- def self.abstract_railtie?: () -> untyped
4307
-
4308
- def self.railtie_name: (?untyped? name) -> untyped
4309
-
4310
- # Since Rails::Railtie cannot be instantiated, any methods that call
4311
- # +instance+ are intended to be called only on subclasses of a Railtie.
4312
- def self.`instance`: () -> untyped
4313
-
4314
- # Allows you to configure the railtie. This is the same method seen in
4315
- # Railtie::Configurable, but this module is no longer required for all
4316
- # subclasses of Railtie so we provide the class method here.
4317
- def self.configure: () { () -> untyped } -> untyped
4318
-
4319
- def self.generate_railtie_name: (untyped string) -> untyped
4320
-
4321
- def self.respond_to_missing?: (untyped name, untyped _) -> untyped
4322
-
4323
- # If the class method does not have a method, then send the method call
4324
- # to the Railtie instance.
4325
- def self.method_missing: (untyped name, *untyped args) { () -> untyped } -> untyped
4326
-
4327
- # receives an instance variable identifier, set the variable value if is
4328
- # blank and append given block to value, which will be used later in
4329
- # `#each_registered_block(type, &block)`
4330
- def self.register_block_for: (untyped `type`) { () -> untyped } -> untyped
4331
-
4332
- def initialize: () -> untyped
4333
-
4334
- def configure: () { () -> untyped } -> untyped
4335
-
4336
- # This is used to create the <tt>config</tt> object on Railties, an instance of
4337
- # Railtie::Configuration, that is used by Railties and Application to store
4338
- # related configuration.
4339
- def config: () -> untyped
4340
-
4341
- def railtie_namespace: () -> untyped
4342
-
4343
- def run_console_blocks: (untyped app) -> untyped
4344
-
4345
- def run_generators_blocks: (untyped app) -> untyped
4346
-
4347
- def run_runner_blocks: (untyped app) -> untyped
4348
-
4349
- def run_tasks_blocks: (untyped app) -> untyped
4350
-
4351
- # run `&block` in every registered block in `#register_block_for`
4352
- def each_registered_block: (untyped `type`) { () -> untyped } -> untyped
4353
- end
4354
- end
4355
-
4356
- module Rails
4357
- extend ActiveSupport::Autoload
4358
-
4359
- attr_writer application: untyped
4360
-
4361
- attr_accessor app_class: untyped
4362
-
4363
- attr_accessor cache: untyped
4364
-
4365
- attr_accessor logger: untyped
4366
-
4367
- def self.application: () -> untyped
4368
-
4369
- # The Configuration instance used to configure the Rails environment
4370
- def self.configuration: () -> untyped
4371
-
4372
- def self.backtrace_cleaner: () -> untyped
4373
-
4374
- # Returns a Pathname object of the current Rails project,
4375
- # otherwise it returns +nil+ if there is no project:
4376
- #
4377
- # Rails.root
4378
- # # => #<Pathname:/Users/someuser/some/path/project>
4379
- def self.root: () -> untyped
4380
-
4381
- # Returns the current Rails environment.
4382
- #
4383
- # Rails.env # => "development"
4384
- # Rails.env.development? # => true
4385
- # Rails.env.production? # => false
4386
- def self.env: () -> untyped
4387
-
4388
- # Sets the Rails environment.
4389
- #
4390
- # Rails.env = "staging" # => "staging"
4391
- def self.env=: (untyped environment) -> untyped
4392
-
4393
- # Returns all Rails groups for loading based on:
4394
- #
4395
- # * The Rails environment;
4396
- # * The environment variable RAILS_GROUPS;
4397
- # * The optional envs given as argument and the hash with group dependencies;
4398
- #
4399
- # groups assets: [:development, :test]
4400
- #
4401
- # # Returns
4402
- # # => [:default, "development", :assets] for Rails.env == "development"
4403
- # # => [:default, "production"] for Rails.env == "production"
4404
- def self.groups: (*untyped groups) -> untyped
4405
-
4406
- # Returns a Pathname object of the public folder of the current
4407
- # Rails project, otherwise it returns +nil+ if there is no project:
4408
- #
4409
- # Rails.public_path
4410
- # # => #<Pathname:/Users/someuser/some/path/project/public>
4411
- def self.public_path: () -> untyped
4412
-
4413
- def self.autoloaders: () -> untyped
4414
- end
4415
-
4416
- module Rails
4417
- class Secrets
4418
- # Greatly inspired by Ara T. Howard's magnificent sekrets gem. (trim non-ascii characters)
4419
- # :nodoc:
4420
- class MissingKeyError < RuntimeError
4421
- def initialize: () -> untyped
4422
- end
4423
-
4424
- attr_writer root: untyped
4425
-
4426
- def self.parse: (untyped paths, env: untyped env) -> untyped
4427
-
4428
- def self.key: () -> untyped
4429
-
4430
- def self.encrypt: (untyped data) -> untyped
4431
-
4432
- def self.decrypt: (untyped data) -> untyped
4433
-
4434
- def self.read: () -> untyped
4435
-
4436
- def self.write: (untyped contents) -> untyped
4437
-
4438
- def self.read_for_editing: () { () -> untyped } -> untyped
4439
-
4440
- def self.handle_missing_key: () -> untyped
4441
-
4442
- def self.read_key_file: () -> untyped
4443
-
4444
- def self.key_path: () -> untyped
4445
-
4446
- def self.path: () -> untyped
4447
-
4448
- def self.preprocess: (untyped path) -> untyped
4449
-
4450
- def self.writing: (untyped contents) { (untyped) -> untyped } -> untyped
4451
-
4452
- def self.encryptor: () -> untyped
4453
- end
4454
- end
4455
-
4456
- module Rails
4457
- # Implements the logic behind <tt>Rails::Command::NotesCommand</tt>. See <tt>rails notes --help</tt> for usage information.
4458
- #
4459
- # Annotation objects are triplets <tt>:line</tt>, <tt>:tag</tt>, <tt>:text</tt> that
4460
- # represent the line where the annotation lives, its tag, and its text. Note
4461
- # the filename is not stored.
4462
- #
4463
- # Annotations are looked for in comments and modulus whitespace they have to
4464
- # start with the tag optionally followed by a colon. Everything up to the end
4465
- # of the line (or closing ERB comment tag) is considered to be their text.
4466
- class SourceAnnotationExtractor
4467
- # Note: It inherits unnamed class, but omitted
4468
- class Annotation
4469
- def self.directories: () -> untyped
4470
-
4471
- # Registers additional directories to be included
4472
- # Rails::SourceAnnotationExtractor::Annotation.register_directories("spec", "another")
4473
- def self.register_directories: (*untyped dirs) -> untyped
4474
-
4475
- def self.tags: () -> untyped
4476
-
4477
- # Registers additional tags
4478
- # Rails::SourceAnnotationExtractor::Annotation.register_tags("TESTME", "DEPRECATEME")
4479
- def self.register_tags: (*untyped additional_tags) -> untyped
4480
-
4481
- def self.extensions: () -> untyped
4482
-
4483
- # Registers new Annotations File Extensions
4484
- # Rails::SourceAnnotationExtractor::Annotation.register_extensions("css", "scss", "sass", "less", "js") { |tag| /\/\/\s*(#{tag}):?\s*(.*)$/ }
4485
- def self.register_extensions: (*untyped exts) { () -> untyped } -> untyped
4486
-
4487
- # Returns a representation of the annotation that looks like this:
4488
- #
4489
- # [126] [TODO] This algorithm is simple and clearly correct, make it faster.
4490
- #
4491
- # If +options+ has a flag <tt>:tag</tt> the tag is shown as in the example above.
4492
- # Otherwise the string contains just line and text.
4493
- def to_s: (?::Hash[untyped, untyped] options) -> untyped
4494
-
4495
- # Used in annotations.rake
4496
- # nodoc:
4497
- def self.notes_task_deprecation_warning: () -> untyped
4498
- end
4499
-
4500
- # Prints all annotations with tag +tag+ under the root directories +app+,
4501
- # +config+, +db+, +lib+, and +test+ (recursively).
4502
- #
4503
- # If +tag+ is <tt>nil</tt>, annotations with either default or registered tags are printed.
4504
- #
4505
- # Specific directories can be explicitly set using the <tt>:dirs</tt> key in +options+.
4506
- #
4507
- # Rails::SourceAnnotationExtractor.enumerate 'TODO|FIXME', dirs: %w(app lib), tag: true
4508
- #
4509
- # If +options+ has a <tt>:tag</tt> flag, it will be passed to each annotation's +to_s+.
4510
- #
4511
- # See <tt>#find_in</tt> for a list of file extensions that will be taken into account.
4512
- #
4513
- # This class method is the single entry point for the `rails notes` command.
4514
- def self.enumerate: (?untyped? tag, ?::Hash[untyped, untyped] options) -> untyped
4515
-
4516
- attr_reader tag: untyped
4517
-
4518
- def initialize: (untyped tag) -> untyped
4519
-
4520
- # Returns a hash that maps filenames under +dirs+ (recursively) to arrays
4521
- # with their annotations.
4522
- def find: (untyped dirs) -> untyped
4523
-
4524
- # Returns a hash that maps filenames under +dir+ (recursively) to arrays
4525
- # with their annotations. Files with extensions registered in
4526
- # <tt>Rails::SourceAnnotationExtractor::Annotation.extensions</tt> are
4527
- # taken into account. Only files with annotations are included.
4528
- def find_in: (untyped dir) -> untyped
4529
-
4530
- # If +file+ is the filename of a file that contains annotations this method returns
4531
- # a hash with a single entry that maps +file+ to an array of its annotations.
4532
- # Otherwise it returns an empty hash.
4533
- def extract_annotations_from: (untyped file, untyped pattern) -> untyped
4534
-
4535
- # Prints the mapping from filenames to annotations in +results+ ordered by filename.
4536
- # The +options+ hash is passed to each annotation's +to_s+.
4537
- def display: (untyped results, ?::Hash[untyped, untyped] options) -> untyped
4538
- end
4539
- end
4540
-
4541
- # Remove this deprecated class in the next minor version
4542
- # nodoc:
4543
- SourceAnnotationExtractor: untyped
4544
-
4545
- module Rails
4546
- module LineFiltering
4547
- # :nodoc:
4548
- def run: (untyped reporter, ?::Hash[untyped, untyped] options) -> untyped
4549
- end
4550
- end
4551
-
4552
- module Rails
4553
- class TestUnitRailtie < Rails::Railtie
4554
- end
4555
- end
4556
-
4557
- module Rails
4558
- class TestUnitReporter < Minitest::StatisticsReporter
4559
- def record: (untyped result) -> untyped
4560
-
4561
- def report: () -> (nil | untyped)
4562
-
4563
- def aggregated_results: () -> untyped
4564
-
4565
- def filtered_results: () -> untyped
4566
-
4567
- def relative_path_for: (untyped file) -> untyped
4568
-
4569
- def output_inline?: () -> untyped
4570
-
4571
- def fail_fast?: () -> untyped
4572
-
4573
- def format_line: (untyped result) -> untyped
4574
-
4575
- def format_rerun_snippet: (untyped result) -> ::String
4576
-
4577
- def app_root: () -> untyped
4578
-
4579
- def colored_output?: () -> untyped
4580
-
4581
- COLOR_BY_RESULT_CODE: ::Hash[untyped, untyped]
4582
-
4583
- def color_output: (untyped string, by: untyped by) -> untyped
4584
- end
4585
- end
4586
-
4587
- module Rails
4588
- module TestUnit
4589
- class Runner
4590
- def self.attach_before_load_options: (untyped opts) -> untyped
4591
-
4592
- def self.parse_options: (untyped argv) -> untyped
4593
-
4594
- def self.rake_run: (?untyped argv) -> untyped
4595
-
4596
- def self.run: (?untyped argv) -> untyped
4597
-
4598
- def self.load_tests: (untyped argv) -> untyped
4599
-
4600
- def self.compose_filter: (untyped runnable, untyped filter) -> untyped
4601
-
4602
- def self.extract_filters: (untyped argv) -> untyped
4603
- end
4604
-
4605
- class CompositeFilter
4606
- # :nodoc:
4607
- attr_reader named_filter: untyped
4608
-
4609
- def initialize: (untyped runnable, untyped filter, untyped patterns) -> untyped
4610
-
4611
- # minitest uses === to find matching filters.
4612
- def ===: (untyped method) -> untyped
4613
-
4614
- def derive_named_filter: (untyped filter) -> untyped
4615
-
4616
- def derive_line_filters: (untyped patterns) -> untyped
4617
- end
4618
-
4619
- class Filter
4620
- # :nodoc:
4621
- def initialize: (untyped runnable, untyped file, untyped line) -> untyped
4622
-
4623
- def ===: (untyped method) -> (nil | untyped)
4624
-
4625
- def definition_for: (untyped method) -> untyped
4626
- end
4627
- end
4628
- end
4629
-
4630
- module Rails
4631
- # Returns the version of the currently loaded Rails as a string.
4632
- def self.version: () -> untyped
4633
- end
4634
-
4635
- class Rails::WelcomeController < Rails::ApplicationController
4636
- def index: () -> nil
4637
- end
4638
-
4639
- class Object
4640
- include ActiveRecord::TestDatabases
4641
-
4642
- include ActiveRecord::TestFixtures
4643
-
4644
- extend ::ActiveRecord::TestFixtures::ClassMethods
4645
-
4646
- def before_setup: () -> untyped
4647
- end