rbs_rails 0.4.1 → 0.5.0

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