js-routes 2.2.9 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -3
  3. data/Readme.md +16 -15
  4. data/lib/js_routes/configuration.rb +7 -5
  5. data/lib/js_routes/generators/base.rb +6 -1
  6. data/lib/js_routes/generators/middleware.rb +2 -3
  7. data/lib/js_routes/generators/webpacker.rb +2 -1
  8. data/lib/js_routes/instance.rb +21 -6
  9. data/lib/js_routes/middleware.rb +5 -4
  10. data/lib/js_routes/route.rb +7 -3
  11. data/lib/js_routes/types.rb +10 -0
  12. data/lib/js_routes/utils.rb +18 -0
  13. data/lib/js_routes/version.rb +1 -1
  14. data/lib/js_routes.rb +12 -4
  15. data/lib/routes.d.ts +7 -6
  16. data/lib/routes.js +19 -18
  17. data/lib/routes.ts +33 -27
  18. data/lib/tasks/js_routes.rake +4 -2
  19. metadata +12 -145
  20. data/.document +0 -5
  21. data/.eslintrc.js +0 -15
  22. data/.github/workflows/ci.yml +0 -36
  23. data/.gitignore +0 -65
  24. data/.nvmrc +0 -1
  25. data/.rspec +0 -1
  26. data/Appraisals +0 -17
  27. data/Gemfile +0 -9
  28. data/Rakefile +0 -37
  29. data/VERSION_2_UPGRADE.md +0 -66
  30. data/bin/tapioca +0 -27
  31. data/gemfiles/rails50_sprockets_3.gemfile +0 -8
  32. data/gemfiles/rails51_sprockets_3.gemfile +0 -8
  33. data/gemfiles/rails52_sprockets_3.gemfile +0 -8
  34. data/gemfiles/rails70_sprockets_4.gemfile +0 -8
  35. data/js-routes.gemspec +0 -42
  36. data/package.json +0 -38
  37. data/sorbet/config +0 -4
  38. data/sorbet/rbi/annotations/.gitattributes +0 -1
  39. data/sorbet/rbi/annotations/actionpack.rbi +0 -428
  40. data/sorbet/rbi/annotations/actionview.rbi +0 -75
  41. data/sorbet/rbi/annotations/activesupport.rbi +0 -421
  42. data/sorbet/rbi/annotations/railties.rbi +0 -61
  43. data/sorbet/rbi/gems/.gitattributes +0 -1
  44. data/sorbet/rbi/gems/actionpack@7.0.4.1.rbi +0 -303
  45. data/sorbet/rbi/gems/actionview@7.0.4.1.rbi +0 -8
  46. data/sorbet/rbi/gems/activesupport@7.0.4.1.rbi +0 -16424
  47. data/sorbet/rbi/gems/appraisal@2.4.1.rbi +0 -584
  48. data/sorbet/rbi/gems/builder@3.2.4.rbi +0 -8
  49. data/sorbet/rbi/gems/bump@0.10.0.rbi +0 -168
  50. data/sorbet/rbi/gems/byebug@11.1.3.rbi +0 -3606
  51. data/sorbet/rbi/gems/coderay@1.1.3.rbi +0 -3426
  52. data/sorbet/rbi/gems/concurrent-ruby@1.2.0.rbi +0 -11570
  53. data/sorbet/rbi/gems/crass@1.0.6.rbi +0 -8
  54. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +0 -1083
  55. data/sorbet/rbi/gems/erubi@1.12.0.rbi +0 -145
  56. data/sorbet/rbi/gems/i18n@1.12.0.rbi +0 -2296
  57. data/sorbet/rbi/gems/libv8-node@16.10.0.0.rbi +0 -8
  58. data/sorbet/rbi/gems/loofah@2.19.1.rbi +0 -8
  59. data/sorbet/rbi/gems/method_source@1.0.0.rbi +0 -272
  60. data/sorbet/rbi/gems/mini_racer@0.6.3.rbi +0 -224
  61. data/sorbet/rbi/gems/minitest@5.17.0.rbi +0 -1457
  62. data/sorbet/rbi/gems/netrc@0.11.0.rbi +0 -158
  63. data/sorbet/rbi/gems/nokogiri@1.14.0.rbi +0 -8
  64. data/sorbet/rbi/gems/parallel@1.24.0.rbi +0 -280
  65. data/sorbet/rbi/gems/prettier_print@1.2.1.rbi +0 -951
  66. data/sorbet/rbi/gems/prism@0.24.0.rbi +0 -29744
  67. data/sorbet/rbi/gems/pry-byebug@3.10.1.rbi +0 -1150
  68. data/sorbet/rbi/gems/pry@0.14.2.rbi +0 -10075
  69. data/sorbet/rbi/gems/racc@1.6.2.rbi +0 -150
  70. data/sorbet/rbi/gems/rack-test@2.0.2.rbi +0 -8
  71. data/sorbet/rbi/gems/rack@2.2.6.2.rbi +0 -5585
  72. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +0 -8
  73. data/sorbet/rbi/gems/rails-html-sanitizer@1.5.0.rbi +0 -8
  74. data/sorbet/rbi/gems/railties@7.0.4.1.rbi +0 -1959
  75. data/sorbet/rbi/gems/rake@13.0.6.rbi +0 -3072
  76. data/sorbet/rbi/gems/rbi@0.1.9.rbi +0 -3006
  77. data/sorbet/rbi/gems/rspec-core@3.12.0.rbi +0 -10868
  78. data/sorbet/rbi/gems/rspec-expectations@3.12.2.rbi +0 -8100
  79. data/sorbet/rbi/gems/rspec-mocks@3.12.3.rbi +0 -5299
  80. data/sorbet/rbi/gems/rspec-support@3.12.0.rbi +0 -1611
  81. data/sorbet/rbi/gems/rspec@3.12.0.rbi +0 -82
  82. data/sorbet/rbi/gems/spoom@1.2.4.rbi +0 -3777
  83. data/sorbet/rbi/gems/sprockets-rails@3.4.2.rbi +0 -14
  84. data/sorbet/rbi/gems/sprockets@4.2.0.rbi +0 -8
  85. data/sorbet/rbi/gems/syntax_tree@6.2.0.rbi +0 -23136
  86. data/sorbet/rbi/gems/tapioca@0.12.0.rbi +0 -3510
  87. data/sorbet/rbi/gems/thor@1.2.1.rbi +0 -3956
  88. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +0 -5914
  89. data/sorbet/rbi/gems/yard-sorbet@0.8.1.rbi +0 -428
  90. data/sorbet/rbi/gems/yard@0.9.34.rbi +0 -18332
  91. data/sorbet/rbi/gems/zeitwerk@2.6.8.rbi +0 -8
  92. data/sorbet/rbi/todo.rbi +0 -31
  93. data/sorbet/tapioca/config.yml +0 -13
  94. data/sorbet/tapioca/require.rb +0 -4
  95. data/spec/dummy/app/assets/config/manifest.js +0 -2
  96. data/spec/dummy/app/assets/javascripts/.gitkeep +0 -0
  97. data/spec/dummy/config/routes.rb +0 -55
  98. data/spec/js_routes/default_serializer_spec.rb +0 -31
  99. data/spec/js_routes/module_types/amd_spec.rb +0 -35
  100. data/spec/js_routes/module_types/cjs_spec.rb +0 -15
  101. data/spec/js_routes/module_types/dts/routes.spec.d.ts +0 -115
  102. data/spec/js_routes/module_types/dts/test.spec.ts +0 -56
  103. data/spec/js_routes/module_types/dts_spec.rb +0 -126
  104. data/spec/js_routes/module_types/esm_spec.rb +0 -45
  105. data/spec/js_routes/module_types/nil_spec.rb +0 -87
  106. data/spec/js_routes/module_types/umd_spec.rb +0 -85
  107. data/spec/js_routes/options_spec.rb +0 -508
  108. data/spec/js_routes/rails_routes_compatibility_spec.rb +0 -473
  109. data/spec/js_routes/route_specification_spec.rb +0 -37
  110. data/spec/js_routes/zzz_sprockets_spec.rb +0 -152
  111. data/spec/spec_helper.rb +0 -135
  112. data/spec/support/routes.rb +0 -81
  113. data/spec/tsconfig.json +0 -4
  114. data/tsconfig.json +0 -28
  115. data/yarn.lock +0 -2457
@@ -1,1959 +0,0 @@
1
- # typed: true
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `railties` gem.
5
- # Please instead update this file by running `bin/tapioca gem railties`.
6
-
7
- # source://railties//lib/rails/command.rb#9
8
- module Rails; end
9
-
10
- # source://railties//lib/rails/command.rb#10
11
- module Rails::Command
12
- include ::Rails::Command::Behavior
13
- extend ::ActiveSupport::Autoload
14
- extend ::Rails::Command::Behavior::ClassMethods
15
-
16
- class << self
17
- # source://railties//lib/rails/command.rb#25
18
- def environment; end
19
-
20
- # Rails finds namespaces similar to Thor, it only adds one rule:
21
- #
22
- # Command names must end with "_command.rb". This is required because Rails
23
- # looks in load paths and loads the command just before it's going to be used.
24
- #
25
- # find_by_namespace :webrat, :integration
26
- #
27
- # Will search for the following commands:
28
- #
29
- # "webrat", "webrat:integration", "rails:webrat", "rails:webrat:integration"
30
- #
31
- # source://railties//lib/rails/command.rb#68
32
- def find_by_namespace(namespace, command_name = T.unsafe(nil)); end
33
-
34
- # source://railties//lib/rails/command.rb#21
35
- def hidden_commands; end
36
-
37
- # Receives a namespace, arguments, and the behavior to invoke the command.
38
- #
39
- # source://railties//lib/rails/command.rb#30
40
- def invoke(full_namespace, args = T.unsafe(nil), **config); end
41
-
42
- # source://railties//lib/rails/command.rb#88
43
- def print_commands; end
44
-
45
- # Returns the root of the Rails engine or app running the command.
46
- #
47
- # source://railties//lib/rails/command.rb#80
48
- def root; end
49
-
50
- private
51
-
52
- # source://railties//lib/rails/command.rb#108
53
- def command_type; end
54
-
55
- # source://railties//lib/rails/command.rb#100
56
- def commands; end
57
-
58
- # source://railties//lib/rails/command.rb#116
59
- def file_lookup_paths; end
60
-
61
- # source://railties//lib/rails/command.rb#112
62
- def lookup_paths; end
63
-
64
- # @return [Boolean]
65
- #
66
- # source://railties//lib/rails/command.rb#96
67
- def rails_new_with_no_path?(args); end
68
- end
69
- end
70
-
71
- # source://railties//lib/rails/command/actions.rb#5
72
- module Rails::Command::Actions
73
- # source://railties//lib/rails/command/actions.rb#48
74
- def load_generators; end
75
-
76
- # source://railties//lib/rails/command/actions.rb#44
77
- def load_tasks; end
78
-
79
- # source://railties//lib/rails/command/actions.rb#18
80
- def require_application!; end
81
-
82
- # source://railties//lib/rails/command/actions.rb#13
83
- def require_application_and_environment!; end
84
-
85
- # source://railties//lib/rails/command/actions.rb#26
86
- def require_environment!; end
87
-
88
- # Change to the application's path if there is no <tt>config.ru</tt> file in current directory.
89
- # This allows us to run <tt>rails server</tt> from other directories, but still get
90
- # the main <tt>config.ru</tt> and properly set the <tt>tmp</tt> directory.
91
- #
92
- # source://railties//lib/rails/command/actions.rb#9
93
- def set_application_directory!; end
94
- end
95
-
96
- # source://railties//lib/rails/command/base.rb#13
97
- class Rails::Command::Base < ::Thor
98
- include ::Rails::Command::Actions
99
-
100
- # source://railties//lib/rails/command/base.rb#174
101
- def help; end
102
-
103
- class << self
104
- # Use Rails' default banner.
105
- #
106
- # source://railties//lib/rails/command/base.rb#99
107
- def banner(*_arg0); end
108
-
109
- # Sets the base_name taking into account the current class namespace.
110
- #
111
- # Rails::Command::TestCommand.base_name # => 'rails'
112
- #
113
- # source://railties//lib/rails/command/base.rb#106
114
- def base_name; end
115
-
116
- # Return command name without namespaces.
117
- #
118
- # Rails::Command::TestCommand.command_name # => 'test'
119
- #
120
- # source://railties//lib/rails/command/base.rb#115
121
- def command_name; end
122
-
123
- # Default file root to place extra files a command might need, placed
124
- # one folder above the command file.
125
- #
126
- # For a Rails::Command::TestCommand placed in <tt>rails/command/test_command.rb</tt>
127
- # would return <tt>rails/test</tt>.
128
- #
129
- # source://railties//lib/rails/command/base.rb#135
130
- def default_command_root; end
131
-
132
- # Tries to get the description from a USAGE file one folder above the command
133
- # root.
134
- #
135
- # source://railties//lib/rails/command/base.rb#49
136
- def desc(usage = T.unsafe(nil), description = T.unsafe(nil), options = T.unsafe(nil)); end
137
-
138
- # Returns true when the app is a Rails engine.
139
- #
140
- # @return [Boolean]
141
- #
142
- # source://railties//lib/rails/command/base.rb#43
143
- def engine?; end
144
-
145
- # source://railties//lib/rails/command/base.rb#94
146
- def executable; end
147
-
148
- # @return [Boolean]
149
- #
150
- # source://railties//lib/rails/command/base.rb#38
151
- def exit_on_failure?; end
152
-
153
- # Convenience method to hide this command from the available ones when
154
- # running rails command.
155
- #
156
- # source://railties//lib/rails/command/base.rb#70
157
- def hide_command!; end
158
-
159
- # source://railties//lib/rails/command/base.rb#74
160
- def inherited(base); end
161
-
162
- # Convenience method to get the namespace from the class name. It's the
163
- # same as Thor default except that the Command at the end of the class
164
- # is removed.
165
- #
166
- # source://railties//lib/rails/command/base.rb#60
167
- def namespace(name = T.unsafe(nil)); end
168
-
169
- # source://railties//lib/rails/command/base.rb#82
170
- def perform(command, args, config); end
171
-
172
- # source://railties//lib/rails/command/base.rb#90
173
- def printing_commands; end
174
-
175
- # Path to lookup a USAGE description in a file.
176
- #
177
- # source://railties//lib/rails/command/base.rb#123
178
- def usage_path; end
179
-
180
- private
181
-
182
- # source://railties//lib/rails/command/base.rb#155
183
- def command_root_namespace; end
184
-
185
- # Allow the command method to be called perform.
186
- #
187
- # source://railties//lib/rails/command/base.rb#142
188
- def create_command(meth); end
189
-
190
- # source://railties//lib/rails/command/base.rb#163
191
- def namespaced_commands; end
192
-
193
- # source://railties//lib/rails/command/base.rb#159
194
- def relative_command_path; end
195
- end
196
- end
197
-
198
- # source://railties//lib/rails/command/base.rb#17
199
- class Rails::Command::Base::CorrectableError < ::Rails::Command::Base::Error
200
- include ::DidYouMean::Correctable
201
-
202
- # @return [CorrectableError] a new instance of CorrectableError
203
- #
204
- # source://railties//lib/rails/command/base.rb#20
205
- def initialize(message, key, options); end
206
-
207
- # source://railties//lib/rails/command/base.rb#29
208
- def corrections; end
209
-
210
- # Returns the value of attribute key.
211
- #
212
- # source://railties//lib/rails/command/base.rb#18
213
- def key; end
214
-
215
- # Returns the value of attribute options.
216
- #
217
- # source://railties//lib/rails/command/base.rb#18
218
- def options; end
219
- end
220
-
221
- # source://railties//lib/rails/command/base.rb#14
222
- class Rails::Command::Base::Error < ::Thor::Error; end
223
-
224
- # source://railties//lib/rails/command/behavior.rb#7
225
- module Rails::Command::Behavior
226
- extend ::ActiveSupport::Concern
227
-
228
- mixes_in_class_methods ::Rails::Command::Behavior::ClassMethods
229
- end
230
-
231
- # source://railties//lib/rails/command/behavior.rb#0
232
- module Rails::Command::Behavior::ClassMethods
233
- # source://railties//lib/rails/command/behavior.rb#12
234
- def no_color!; end
235
-
236
- # source://railties//lib/rails/command/behavior.rb#17
237
- def subclasses; end
238
-
239
- private
240
-
241
- # source://railties//lib/rails/command/behavior.rb#36
242
- def lookup(namespaces); end
243
-
244
- # source://railties//lib/rails/command/behavior.rb#56
245
- def lookup!; end
246
-
247
- # source://railties//lib/rails/command/behavior.rb#70
248
- def namespaces_to_paths(namespaces); end
249
-
250
- # source://railties//lib/rails/command/behavior.rb#23
251
- def print_list(base, namespaces); end
252
- end
253
-
254
- # source://railties//lib/rails/command.rb#18
255
- Rails::Command::HELP_MAPPINGS = T.let(T.unsafe(nil), Array)
256
-
257
- # source://railties//lib/rails/generators.rb#17
258
- module Rails::Generators
259
- include ::Rails::Command::Behavior
260
- extend ::Rails::Command::Behavior::ClassMethods
261
-
262
- # source://railties//lib/rails/generators.rb#30
263
- def namespace; end
264
-
265
- # source://railties//lib/rails/generators.rb#30
266
- def namespace=(val); end
267
-
268
- class << self
269
- # source://railties//lib/rails/generators.rb#282
270
- def add_generated_file(file); end
271
-
272
- # source://railties//lib/rails/generators.rb#91
273
- def after_generate_callbacks; end
274
-
275
- # source://railties//lib/rails/generators.rb#83
276
- def aliases; end
277
-
278
- # Configure generators for API only applications. It basically hides
279
- # everything that is usually browser related, such as assets and session
280
- # migration generators, and completely disable helpers and assets
281
- # so generators such as scaffold won't create them.
282
- #
283
- # source://railties//lib/rails/generators.rb#115
284
- def api_only!; end
285
-
286
- # source://railties//lib/rails/generators.rb#67
287
- def configure!(config); end
288
-
289
- # Hold configured generators fallbacks. If a plugin developer wants a
290
- # generator group to fallback to another group in case of missing generators,
291
- # they can add a fallback.
292
- #
293
- # For example, shoulda is considered a test_framework and is an extension
294
- # of test_unit. However, most part of shoulda generators are similar to
295
- # test_unit ones.
296
- #
297
- # Shoulda then can tell generators to search for test_unit generators when
298
- # some of them are not available by adding a fallback:
299
- #
300
- # Rails::Generators.fallbacks[:shoulda] = :test_unit
301
- #
302
- # source://railties//lib/rails/generators.rb#107
303
- def fallbacks; end
304
-
305
- # Rails finds namespaces similar to Thor, it only adds one rule:
306
- #
307
- # Generators names must end with "_generator.rb". This is required because Rails
308
- # looks in load paths and loads the generator just before it's going to be used.
309
- #
310
- # find_by_namespace :webrat, :rails, :integration
311
- #
312
- # Will search for the following generators:
313
- #
314
- # "rails:webrat", "webrat:integration", "webrat"
315
- #
316
- # Notice that "rails:generators:webrat" could be loaded as well, what
317
- # Rails looks for is the first and last parts of the namespace.
318
- #
319
- # source://railties//lib/rails/generators.rb#232
320
- def find_by_namespace(name, base = T.unsafe(nil), context = T.unsafe(nil)); end
321
-
322
- # Show help message with available generators.
323
- #
324
- # source://railties//lib/rails/generators.rb#168
325
- def help(command = T.unsafe(nil)); end
326
-
327
- # Returns an array of generator namespaces that are hidden.
328
- # Generator namespaces may be hidden for a variety of reasons.
329
- # Some are aliased such as "rails:migration" and can be
330
- # invoked with the shorter "migration".
331
- #
332
- # source://railties//lib/rails/generators.rb#133
333
- def hidden_namespaces; end
334
-
335
- # source://railties//lib/rails/generators.rb#162
336
- def hide_namespace(*namespaces); end
337
-
338
- # source://railties//lib/rails/generators.rb#162
339
- def hide_namespaces(*namespaces); end
340
-
341
- # Receives a namespace, arguments, and the behavior to invoke the generator.
342
- # It's used as the default entry point for generate, destroy, and update
343
- # commands.
344
- #
345
- # source://railties//lib/rails/generators.rb#259
346
- def invoke(namespace, args = T.unsafe(nil), config = T.unsafe(nil)); end
347
-
348
- # source://railties//lib/rails/generators.rb#30
349
- def namespace; end
350
-
351
- # source://railties//lib/rails/generators.rb#30
352
- def namespace=(val); end
353
-
354
- # source://railties//lib/rails/generators.rb#87
355
- def options; end
356
-
357
- # source://railties//lib/rails/generators.rb#189
358
- def print_generators; end
359
-
360
- # source://railties//lib/rails/generators.rb#184
361
- def public_namespaces; end
362
-
363
- # source://railties//lib/rails/generators.rb#193
364
- def sorted_groups; end
365
-
366
- # source://railties//lib/rails/generators.rb#79
367
- def templates_path; end
368
-
369
- private
370
-
371
- # source://railties//lib/rails/generators.rb#309
372
- def command_type; end
373
-
374
- # source://railties//lib/rails/generators.rb#317
375
- def file_lookup_paths; end
376
-
377
- # Try fallbacks for the given base.
378
- #
379
- # source://railties//lib/rails/generators.rb#294
380
- def invoke_fallbacks_for(name, base); end
381
-
382
- # source://railties//lib/rails/generators.rb#313
383
- def lookup_paths; end
384
-
385
- # source://railties//lib/rails/generators.rb#288
386
- def print_list(base, namespaces); end
387
-
388
- # source://railties//lib/rails/generators.rb#321
389
- def run_after_generate_callback; end
390
- end
391
- end
392
-
393
- # source://railties//lib/rails/generators/actions.rb#9
394
- module Rails::Generators::Actions
395
- # source://railties//lib/rails/generators/actions.rb#10
396
- def initialize(*_arg0); end
397
-
398
- # Add the given source to +Gemfile+
399
- #
400
- # If block is given, gem entries in block are wrapped into the source group.
401
- #
402
- # add_source "http://gems.github.com/"
403
- #
404
- # add_source "http://gems.github.com/" do
405
- # gem "rspec-rails"
406
- # end
407
- #
408
- # source://railties//lib/rails/generators/actions.rb#106
409
- def add_source(source, options = T.unsafe(nil), &block); end
410
-
411
- # Adds a line inside the Application class for <tt>config/application.rb</tt>.
412
- #
413
- # If options <tt>:env</tt> is specified, the line is appended to the corresponding
414
- # file in <tt>config/environments</tt>.
415
- #
416
- # environment do
417
- # "config.asset_host = 'cdn.provider.com'"
418
- # end
419
- #
420
- # environment(nil, env: "development") do
421
- # "config.asset_host = 'localhost:3000'"
422
- # end
423
- #
424
- # source://railties//lib/rails/generators/actions.rb#132
425
- def application(data = T.unsafe(nil), options = T.unsafe(nil)); end
426
-
427
- # Adds a line inside the Application class for <tt>config/application.rb</tt>.
428
- #
429
- # If options <tt>:env</tt> is specified, the line is appended to the corresponding
430
- # file in <tt>config/environments</tt>.
431
- #
432
- # environment do
433
- # "config.asset_host = 'cdn.provider.com'"
434
- # end
435
- #
436
- # environment(nil, env: "development") do
437
- # "config.asset_host = 'localhost:3000'"
438
- # end
439
- #
440
- # source://railties//lib/rails/generators/actions.rb#132
441
- def environment(data = T.unsafe(nil), options = T.unsafe(nil)); end
442
-
443
- # Adds an entry into +Gemfile+ for the supplied gem.
444
- #
445
- # gem "rspec", group: :test
446
- # gem "technoweenie-restful-authentication", lib: "restful-authentication", source: "http://gems.github.com/"
447
- # gem "rails", "3.0", git: "https://github.com/rails/rails"
448
- # gem "RedCloth", ">= 4.1.0", "< 4.2.0"
449
- # gem "rspec", comment: "Put this comment above the gem declaration"
450
- #
451
- # source://railties//lib/rails/generators/actions.rb#22
452
- def gem(*args); end
453
-
454
- # Wraps gem entries inside a group.
455
- #
456
- # gem_group :development, :test do
457
- # gem "rspec-rails"
458
- # end
459
- #
460
- # source://railties//lib/rails/generators/actions.rb#66
461
- def gem_group(*names, &block); end
462
-
463
- # Generate something using a generator from Rails or a plugin.
464
- # The second parameter is the argument string that is passed to
465
- # the generator or an Array that is joined.
466
- #
467
- # generate(:authenticated, "user session")
468
- #
469
- # source://railties//lib/rails/generators/actions.rb#238
470
- def generate(what, *args); end
471
-
472
- # Run a command in git.
473
- #
474
- # git :init
475
- # git add: "this.file that.rb"
476
- # git add: "onefile.rb", rm: "badfile.cxx"
477
- #
478
- # source://railties//lib/rails/generators/actions.rb#154
479
- def git(commands = T.unsafe(nil)); end
480
-
481
- # source://railties//lib/rails/generators/actions.rb#80
482
- def github(repo, options = T.unsafe(nil), &block); end
483
-
484
- # Create a new initializer with the provided code (either in a block or a string).
485
- #
486
- # initializer("globals.rb") do
487
- # data = ""
488
- #
489
- # ['MY_WORK', 'ADMINS', 'BEST_COMPANY_EVAR'].each do |const|
490
- # data << "#{const} = :entp\n"
491
- # end
492
- #
493
- # data
494
- # end
495
- #
496
- # initializer("api.rb", "API_KEY = '123456'")
497
- #
498
- # source://railties//lib/rails/generators/actions.rb#227
499
- def initializer(filename, data = T.unsafe(nil)); end
500
-
501
- # Create a new file in the <tt>lib/</tt> directory. Code can be specified
502
- # in a block or a data string can be given.
503
- #
504
- # lib("crypto.rb") do
505
- # "crypted_special_value = '#{rand}--#{Time.now}--#{rand(1337)}--'"
506
- # end
507
- #
508
- # lib("foreign.rb", "# Foreign code is fun")
509
- #
510
- # source://railties//lib/rails/generators/actions.rb#187
511
- def lib(filename, data = T.unsafe(nil)); end
512
-
513
- # Runs the supplied rake task (invoked with 'rails ...')
514
- #
515
- # rails_command("db:migrate")
516
- # rails_command("db:migrate", env: "production")
517
- # rails_command("gems:install", sudo: true)
518
- # rails_command("gems:install", capture: true)
519
- #
520
- # source://railties//lib/rails/generators/actions.rb#263
521
- def rails_command(command, options = T.unsafe(nil)); end
522
-
523
- # Runs the supplied rake task (invoked with 'rake ...')
524
- #
525
- # rake("db:migrate")
526
- # rake("db:migrate", env: "production")
527
- # rake("gems:install", sudo: true)
528
- # rake("gems:install", capture: true)
529
- #
530
- # source://railties//lib/rails/generators/actions.rb#253
531
- def rake(command, options = T.unsafe(nil)); end
532
-
533
- # Create a new +Rakefile+ with the provided code (either in a block or a string).
534
- #
535
- # rakefile("bootstrap.rake") do
536
- # project = ask("What is the UNIX name of your project?")
537
- #
538
- # <<-TASK
539
- # namespace :#{project} do
540
- # task :bootstrap do
541
- # puts "I like boots!"
542
- # end
543
- # end
544
- # TASK
545
- # end
546
- #
547
- # rakefile('seed.rake', 'puts "Planting seeds"')
548
- #
549
- # source://railties//lib/rails/generators/actions.rb#208
550
- def rakefile(filename, data = T.unsafe(nil)); end
551
-
552
- # Reads the given file at the source root and prints it in the console.
553
- #
554
- # readme "README"
555
- #
556
- # source://railties//lib/rails/generators/actions.rb#314
557
- def readme(path); end
558
-
559
- # Make an entry in Rails routing file <tt>config/routes.rb</tt>
560
- #
561
- # route "root 'welcome#index'"
562
- # route "root 'admin#index'", namespace: :admin
563
- #
564
- # source://railties//lib/rails/generators/actions.rb#281
565
- def route(routing_code, namespace: T.unsafe(nil)); end
566
-
567
- # Create a new file in the <tt>vendor/</tt> directory. Code can be specified
568
- # in a block or a data string can be given.
569
- #
570
- # vendor("sekrit.rb") do
571
- # sekrit_salt = "#{Time.now}--#{3.years.ago}--#{rand}--"
572
- # "salt = '#{sekrit_salt}'"
573
- # end
574
- #
575
- # vendor("foreign.rb", "# Foreign code is fun")
576
- #
577
- # source://railties//lib/rails/generators/actions.rb#173
578
- def vendor(filename, data = T.unsafe(nil)); end
579
-
580
- private
581
-
582
- # Append string to a file with a newline if necessary
583
- #
584
- # source://railties//lib/rails/generators/actions.rb#388
585
- def append_file_with_newline(path, str, options = T.unsafe(nil)); end
586
-
587
- # Runs the supplied command using either "rake ..." or "rails ..."
588
- # based on the executor parameter provided.
589
- #
590
- # source://railties//lib/rails/generators/actions.rb#333
591
- def execute_command(executor, command, options = T.unsafe(nil)); end
592
-
593
- # Add an extension to the given name based on the platform.
594
- #
595
- # source://railties//lib/rails/generators/actions.rb#347
596
- def extify(name); end
597
-
598
- # Indent the +Gemfile+ to the depth of @indentation
599
- #
600
- # source://railties//lib/rails/generators/actions.rb#375
601
- def indentation; end
602
-
603
- # Define log for backwards compatibility. If just one argument is sent,
604
- # invoke say, otherwise invoke say_status. Differently from say and
605
- # similarly to say_status, this method respects the quiet? option given.
606
- #
607
- # source://railties//lib/rails/generators/actions.rb#322
608
- def log(*args); end
609
-
610
- # source://railties//lib/rails/generators/actions.rb#394
611
- def match_file(path, pattern); end
612
-
613
- # Returns optimized string with indentation
614
- #
615
- # source://railties//lib/rails/generators/actions.rb#368
616
- def optimize_indentation(value, amount = T.unsafe(nil)); end
617
-
618
- # Always returns value in double quotes.
619
- #
620
- # source://railties//lib/rails/generators/actions.rb#356
621
- def quote(value); end
622
-
623
- # Returns optimized string with indentation
624
- #
625
- # source://railties//lib/rails/generators/actions.rb#368
626
- def rebase_indentation(value, amount = T.unsafe(nil)); end
627
-
628
- # source://railties//lib/rails/generators/actions.rb#398
629
- def route_namespace_pattern(namespace); end
630
-
631
- # Manage +Gemfile+ indentation for a DSL action block
632
- #
633
- # source://railties//lib/rails/generators/actions.rb#380
634
- def with_indentation(&block); end
635
- end
636
-
637
- # source://railties//lib/rails/generators/actions/create_migration.rb#9
638
- class Rails::Generators::Actions::CreateMigration < ::Thor::Actions::CreateFile
639
- # source://railties//lib/rails/generators/actions/create_migration.rb#41
640
- def existing_migration; end
641
-
642
- # source://railties//lib/rails/generators/actions/create_migration.rb#41
643
- def exists?; end
644
-
645
- # @return [Boolean]
646
- #
647
- # source://railties//lib/rails/generators/actions/create_migration.rb#18
648
- def identical?; end
649
-
650
- # source://railties//lib/rails/generators/actions/create_migration.rb#22
651
- def invoke!; end
652
-
653
- # source://railties//lib/rails/generators/actions/create_migration.rb#10
654
- def migration_dir; end
655
-
656
- # source://railties//lib/rails/generators/actions/create_migration.rb#14
657
- def migration_file_name; end
658
-
659
- # source://railties//lib/rails/generators/actions/create_migration.rb#37
660
- def relative_existing_migration; end
661
-
662
- # source://railties//lib/rails/generators/actions/create_migration.rb#29
663
- def revoke!; end
664
-
665
- private
666
-
667
- # source://railties//lib/rails/generators/actions/create_migration.rb#48
668
- def on_conflict_behavior; end
669
-
670
- # source://railties//lib/rails/generators/actions/create_migration.rb#69
671
- def say_status(status, color, message = T.unsafe(nil)); end
672
- end
673
-
674
- # ActiveModel is a class to be implemented by each ORM to allow Rails to
675
- # generate customized controller code.
676
- #
677
- # The API has the same methods as ActiveRecord, but each method returns a
678
- # string that matches the ORM API.
679
- #
680
- # For example:
681
- #
682
- # ActiveRecord::Generators::ActiveModel.find(Foo, "params[:id]")
683
- # # => "Foo.find(params[:id])"
684
- #
685
- # DataMapper::Generators::ActiveModel.find(Foo, "params[:id]")
686
- # # => "Foo.get(params[:id])"
687
- #
688
- # On initialization, the ActiveModel accepts the instance name that will
689
- # receive the calls:
690
- #
691
- # builder = ActiveRecord::Generators::ActiveModel.new "@foo"
692
- # builder.save # => "@foo.save"
693
- #
694
- # The only exception in ActiveModel for ActiveRecord is the use of self.build
695
- # instead of self.new.
696
- #
697
- # source://railties//lib/rails/generators/active_model.rb#28
698
- class Rails::Generators::ActiveModel
699
- # @return [ActiveModel] a new instance of ActiveModel
700
- #
701
- # source://railties//lib/rails/generators/active_model.rb#31
702
- def initialize(name); end
703
-
704
- # DELETE destroy
705
- #
706
- # source://railties//lib/rails/generators/active_model.rb#75
707
- def destroy; end
708
-
709
- # POST create
710
- # PATCH/PUT update
711
- #
712
- # source://railties//lib/rails/generators/active_model.rb#70
713
- def errors; end
714
-
715
- # Returns the value of attribute name.
716
- #
717
- # source://railties//lib/rails/generators/active_model.rb#29
718
- def name; end
719
-
720
- # POST create
721
- #
722
- # source://railties//lib/rails/generators/active_model.rb#59
723
- def save; end
724
-
725
- # PATCH/PUT update
726
- #
727
- # source://railties//lib/rails/generators/active_model.rb#64
728
- def update(params = T.unsafe(nil)); end
729
-
730
- class << self
731
- # GET index
732
- #
733
- # source://railties//lib/rails/generators/active_model.rb#36
734
- def all(klass); end
735
-
736
- # GET new
737
- # POST create
738
- #
739
- # source://railties//lib/rails/generators/active_model.rb#50
740
- def build(klass, params = T.unsafe(nil)); end
741
-
742
- # GET show
743
- # GET edit
744
- # PATCH/PUT update
745
- # DELETE destroy
746
- #
747
- # source://railties//lib/rails/generators/active_model.rb#44
748
- def find(klass, params = T.unsafe(nil)); end
749
- end
750
- end
751
-
752
- # source://railties//lib/rails/generators/app_name.rb#5
753
- module Rails::Generators::AppName
754
- private
755
-
756
- # source://railties//lib/rails/generators/app_name.rb#33
757
- def app_const; end
758
-
759
- # source://railties//lib/rails/generators/app_name.rb#28
760
- def app_const_base; end
761
-
762
- # source://railties//lib/rails/generators/app_name.rb#9
763
- def app_name; end
764
-
765
- # source://railties//lib/rails/generators/app_name.rb#28
766
- def camelized; end
767
-
768
- # source://railties//lib/rails/generators/app_name.rb#21
769
- def defined_app_const_base; end
770
-
771
- # source://railties//lib/rails/generators/app_name.rb#21
772
- def defined_app_const_base?; end
773
-
774
- # source://railties//lib/rails/generators/app_name.rb#17
775
- def defined_app_name; end
776
-
777
- # source://railties//lib/rails/generators/app_name.rb#13
778
- def original_app_name; end
779
-
780
- # @return [Boolean]
781
- #
782
- # source://railties//lib/rails/generators/app_name.rb#37
783
- def valid_const?; end
784
- end
785
-
786
- # source://railties//lib/rails/generators/app_name.rb#6
787
- Rails::Generators::AppName::RESERVED_NAMES = T.let(T.unsafe(nil), Array)
788
-
789
- # source://railties//lib/rails/generators/base.rb#17
790
- class Rails::Generators::Base < ::Thor::Group
791
- include ::Thor::Actions
792
- include ::Rails::Generators::Actions
793
- extend ::Thor::Actions::ClassMethods
794
-
795
- private
796
-
797
- # Check whether the given class names are already taken by user
798
- # application or Ruby on Rails.
799
- #
800
- # source://railties//lib/rails/generators/base.rb#256
801
- def class_collisions(*class_names); end
802
-
803
- # Takes in an array of nested modules and extracts the last module
804
- #
805
- # source://railties//lib/rails/generators/base.rb#279
806
- def extract_last_module(nesting); end
807
-
808
- # source://railties//lib/rails/generators/base.rb#294
809
- def indent(content, multiplier = T.unsafe(nil)); end
810
-
811
- # Wrap block with namespace of current application
812
- # if namespace exists and is not skipped
813
- #
814
- # source://railties//lib/rails/generators/base.rb#288
815
- def module_namespacing(&block); end
816
-
817
- # source://railties//lib/rails/generators/base.rb#304
818
- def namespace; end
819
-
820
- # source://railties//lib/rails/generators/base.rb#312
821
- def namespace_dirs; end
822
-
823
- # @return [Boolean]
824
- #
825
- # source://railties//lib/rails/generators/base.rb#308
826
- def namespaced?; end
827
-
828
- # source://railties//lib/rails/generators/base.rb#316
829
- def namespaced_path; end
830
-
831
- # source://railties//lib/rails/generators/base.rb#299
832
- def wrap_with_namespace(content); end
833
-
834
- class << self
835
- # Small macro to add ruby as an option to the generator with proper
836
- # default value plus an instance helper method called shebang.
837
- #
838
- # source://railties//lib/rails/generators/base.rb#388
839
- def add_shebang_option!; end
840
-
841
- # Use Rails default banner.
842
- #
843
- # source://railties//lib/rails/generators/base.rb#321
844
- def banner; end
845
-
846
- # Sets the base_name taking into account the current class namespace.
847
- #
848
- # source://railties//lib/rails/generators/base.rb#326
849
- def base_name; end
850
-
851
- # Returns the base root for a common set of generators. This is used to dynamically
852
- # guess the default source root.
853
- #
854
- # source://railties//lib/rails/generators/base.rb#228
855
- def base_root; end
856
-
857
- # Make class option aware of Rails::Generators.options and Rails::Generators.aliases.
858
- #
859
- # source://railties//lib/rails/generators/base.rb#209
860
- def class_option(name, options = T.unsafe(nil)); end
861
-
862
- # Returns default aliases for the option name given doing a lookup in
863
- # Rails::Generators.aliases.
864
- #
865
- # source://railties//lib/rails/generators/base.rb#349
866
- def default_aliases_for_option(name, options); end
867
-
868
- # Returns default for the option name given doing a lookup in config.
869
- #
870
- # source://railties//lib/rails/generators/base.rb#354
871
- def default_for_option(config, name, options, default); end
872
-
873
- # source://railties//lib/rails/generators/base.rb#414
874
- def default_generator_root; end
875
-
876
- # Returns the default source root for a given generator. This is used internally
877
- # by rails to set its generators source root. If you want to customize your source
878
- # root, you should use source_root.
879
- #
880
- # source://railties//lib/rails/generators/base.rb#219
881
- def default_source_root; end
882
-
883
- # Returns the default value for the option name given doing a lookup in
884
- # Rails::Generators.options.
885
- #
886
- # source://railties//lib/rails/generators/base.rb#343
887
- def default_value_for_option(name, options); end
888
-
889
- # Tries to get the description from a USAGE file one folder above the source
890
- # root otherwise uses a default description.
891
- #
892
- # source://railties//lib/rails/generators/base.rb#41
893
- def desc(description = T.unsafe(nil)); end
894
-
895
- # @return [Boolean]
896
- #
897
- # source://railties//lib/rails/generators/base.rb#29
898
- def exit_on_failure?; end
899
-
900
- # Removes the namespaces and get the generator name. For example,
901
- # Rails::Generators::ModelGenerator will return "model" as generator name.
902
- #
903
- # source://railties//lib/rails/generators/base.rb#334
904
- def generator_name; end
905
-
906
- # Convenience method to hide this generator from the available ones when
907
- # running rails generator command.
908
- #
909
- # source://railties//lib/rails/generators/base.rb#61
910
- def hide!; end
911
-
912
- # Invoke a generator based on the value supplied by the user to the
913
- # given option named "name". A class option is created when this method
914
- # is invoked and you can set a hash to customize it.
915
- #
916
- # ==== Examples
917
- #
918
- # module Rails::Generators
919
- # class ControllerGenerator < Base
920
- # hook_for :test_framework, aliases: "-t"
921
- # end
922
- # end
923
- #
924
- # The example above will create a test framework option and will invoke
925
- # a generator based on the user supplied value.
926
- #
927
- # For example, if the user invoke the controller generator as:
928
- #
929
- # bin/rails generate controller Account --test-framework=test_unit
930
- #
931
- # The controller generator will then try to invoke the following generators:
932
- #
933
- # "rails:test_unit", "test_unit:controller", "test_unit"
934
- #
935
- # Notice that "rails:generators:test_unit" could be loaded as well, what
936
- # Rails looks for is the first and last parts of the namespace. This is what
937
- # allows any test framework to hook into Rails as long as it provides any
938
- # of the hooks above.
939
- #
940
- # ==== Options
941
- #
942
- # The first and last part used to find the generator to be invoked are
943
- # guessed based on class invokes hook_for, as noticed in the example above.
944
- # This can be customized with two options: +:in+ and +:as+.
945
- #
946
- # Let's suppose you are creating a generator that needs to invoke the
947
- # controller generator from test unit. Your first attempt is:
948
- #
949
- # class AwesomeGenerator < Rails::Generators::Base
950
- # hook_for :test_framework
951
- # end
952
- #
953
- # The lookup in this case for test_unit as input is:
954
- #
955
- # "test_unit:awesome", "test_unit"
956
- #
957
- # Which is not the desired lookup. You can change it by providing the
958
- # +:as+ option:
959
- #
960
- # class AwesomeGenerator < Rails::Generators::Base
961
- # hook_for :test_framework, as: :controller
962
- # end
963
- #
964
- # And now it will look up at:
965
- #
966
- # "test_unit:controller", "test_unit"
967
- #
968
- # Similarly, if you want it to also look up in the rails namespace, you
969
- # just need to provide the +:in+ value:
970
- #
971
- # class AwesomeGenerator < Rails::Generators::Base
972
- # hook_for :test_framework, in: :rails, as: :controller
973
- # end
974
- #
975
- # And the lookup is exactly the same as previously:
976
- #
977
- # "rails:test_unit", "test_unit:controller", "test_unit"
978
- #
979
- # ==== Switches
980
- #
981
- # All hooks come with switches for user interface. If you do not want
982
- # to use any test framework, you can do:
983
- #
984
- # bin/rails generate controller Account --skip-test-framework
985
- #
986
- # Or similarly:
987
- #
988
- # bin/rails generate controller Account --no-test-framework
989
- #
990
- # ==== Boolean hooks
991
- #
992
- # In some cases, you may want to provide a boolean hook. For example, webrat
993
- # developers might want to have webrat available on controller generator.
994
- # This can be achieved as:
995
- #
996
- # Rails::Generators::ControllerGenerator.hook_for :webrat, type: :boolean
997
- #
998
- # Then, if you want webrat to be invoked, just supply:
999
- #
1000
- # bin/rails generate controller Account --webrat
1001
- #
1002
- # The hooks lookup is similar as above:
1003
- #
1004
- # "rails:generators:webrat", "webrat:generators:controller", "webrat"
1005
- #
1006
- # ==== Custom invocations
1007
- #
1008
- # You can also supply a block to hook_for to customize how the hook is
1009
- # going to be invoked. The block receives two arguments, an instance
1010
- # of the current class and the class to be invoked.
1011
- #
1012
- # For example, in the resource generator, the controller should be invoked
1013
- # with a pluralized class name. But by default it is invoked with the same
1014
- # name as the resource generator, which is singular. To change this, we
1015
- # can give a block to customize how the controller can be invoked.
1016
- #
1017
- # hook_for :resource_controller do |instance, controller|
1018
- # instance.invoke controller, [ instance.name.pluralize ]
1019
- # end
1020
- #
1021
- # source://railties//lib/rails/generators/base.rb#174
1022
- def hook_for(*names, &block); end
1023
-
1024
- # Keep hooks configuration that are used on prepare_for_invocation.
1025
- #
1026
- # source://railties//lib/rails/generators/base.rb#367
1027
- def hooks; end
1028
-
1029
- # Cache source root and add lib/generators/base/generator/templates to
1030
- # source paths.
1031
- #
1032
- # source://railties//lib/rails/generators/base.rb#234
1033
- def inherited(base); end
1034
-
1035
- # Convenience method to get the namespace from the class name. It's the
1036
- # same as Thor default except that the Generator at the end of the class
1037
- # is removed.
1038
- #
1039
- # source://railties//lib/rails/generators/base.rb#54
1040
- def namespace(name = T.unsafe(nil)); end
1041
-
1042
- # Prepare class invocation to search on Rails namespace if a previous
1043
- # added hook is being used.
1044
- #
1045
- # source://railties//lib/rails/generators/base.rb#373
1046
- def prepare_for_invocation(name, value); end
1047
-
1048
- # Remove a previously added hook.
1049
- #
1050
- # remove_hook_for :orm
1051
- #
1052
- # source://railties//lib/rails/generators/base.rb#200
1053
- def remove_hook_for(*names); end
1054
-
1055
- # Returns the source root for this generator using default_source_root as default.
1056
- #
1057
- # source://railties//lib/rails/generators/base.rb#34
1058
- def source_root(path = T.unsafe(nil)); end
1059
-
1060
- # source://railties//lib/rails/generators/base.rb#406
1061
- def usage_path; end
1062
- end
1063
- end
1064
-
1065
- # source://railties//lib/rails/generators.rb#32
1066
- Rails::Generators::DEFAULT_ALIASES = T.let(T.unsafe(nil), Hash)
1067
-
1068
- # source://railties//lib/rails/generators.rb#49
1069
- Rails::Generators::DEFAULT_OPTIONS = T.let(T.unsafe(nil), Hash)
1070
-
1071
- # source://railties//lib/rails/generators/database.rb#5
1072
- module Rails::Generators::Database
1073
- # source://railties//lib/rails/generators/database.rb#9
1074
- def initialize(*_arg0); end
1075
-
1076
- # source://railties//lib/rails/generators/database.rb#29
1077
- def convert_database_option_for_jruby; end
1078
-
1079
- # source://railties//lib/rails/generators/database.rb#14
1080
- def gem_for_database(database = T.unsafe(nil)); end
1081
-
1082
- private
1083
-
1084
- # source://railties//lib/rails/generators/database.rb#42
1085
- def mysql_socket; end
1086
- end
1087
-
1088
- # source://railties//lib/rails/generators/database.rb#7
1089
- Rails::Generators::Database::DATABASES = T.let(T.unsafe(nil), Array)
1090
-
1091
- # source://railties//lib/rails/generators/database.rb#6
1092
- Rails::Generators::Database::JDBC_DATABASES = T.let(T.unsafe(nil), Array)
1093
-
1094
- # source://railties//lib/rails/generators/base.rb#14
1095
- class Rails::Generators::Error < ::Thor::Error; end
1096
-
1097
- # source://railties//lib/rails/generators/generated_attribute.rb#7
1098
- class Rails::Generators::GeneratedAttribute
1099
- # @return [GeneratedAttribute] a new instance of GeneratedAttribute
1100
- #
1101
- # source://railties//lib/rails/generators/generated_attribute.rb#97
1102
- def initialize(name, type = T.unsafe(nil), index_type = T.unsafe(nil), attr_options = T.unsafe(nil)); end
1103
-
1104
- # @return [Boolean]
1105
- #
1106
- # source://railties//lib/rails/generators/generated_attribute.rb#199
1107
- def attachment?; end
1108
-
1109
- # @return [Boolean]
1110
- #
1111
- # source://railties//lib/rails/generators/generated_attribute.rb#203
1112
- def attachments?; end
1113
-
1114
- # Returns the value of attribute attr_options.
1115
- #
1116
- # source://railties//lib/rails/generators/generated_attribute.rb#31
1117
- def attr_options; end
1118
-
1119
- # source://railties//lib/rails/generators/generated_attribute.rb#159
1120
- def column_name; end
1121
-
1122
- # source://railties//lib/rails/generators/generated_attribute.rb#121
1123
- def default; end
1124
-
1125
- # source://railties//lib/rails/generators/generated_attribute.rb#105
1126
- def field_type; end
1127
-
1128
- # @return [Boolean]
1129
- #
1130
- # source://railties//lib/rails/generators/generated_attribute.rb#163
1131
- def foreign_key?; end
1132
-
1133
- # @return [Boolean]
1134
- #
1135
- # source://railties//lib/rails/generators/generated_attribute.rb#179
1136
- def has_index?; end
1137
-
1138
- # @return [Boolean]
1139
- #
1140
- # source://railties//lib/rails/generators/generated_attribute.rb#183
1141
- def has_uniq_index?; end
1142
-
1143
- # source://railties//lib/rails/generators/generated_attribute.rb#147
1144
- def human_name; end
1145
-
1146
- # source://railties//lib/rails/generators/generated_attribute.rb#151
1147
- def index_name; end
1148
-
1149
- # Sets the attribute index_name
1150
- #
1151
- # @param value the value to set the attribute index_name to.
1152
- #
1153
- # source://railties//lib/rails/generators/generated_attribute.rb#32
1154
- def index_name=(_arg0); end
1155
-
1156
- # source://railties//lib/rails/generators/generated_attribute.rb#215
1157
- def inject_index_options; end
1158
-
1159
- # source://railties//lib/rails/generators/generated_attribute.rb#211
1160
- def inject_options; end
1161
-
1162
- # Returns the value of attribute name.
1163
- #
1164
- # source://railties//lib/rails/generators/generated_attribute.rb#30
1165
- def name; end
1166
-
1167
- # Sets the attribute name
1168
- #
1169
- # @param value the value to set the attribute name to.
1170
- #
1171
- # source://railties//lib/rails/generators/generated_attribute.rb#30
1172
- def name=(_arg0); end
1173
-
1174
- # source://railties//lib/rails/generators/generated_attribute.rb#219
1175
- def options_for_migration; end
1176
-
1177
- # @return [Boolean]
1178
- #
1179
- # source://railties//lib/rails/generators/generated_attribute.rb#187
1180
- def password_digest?; end
1181
-
1182
- # source://railties//lib/rails/generators/generated_attribute.rb#139
1183
- def plural_name; end
1184
-
1185
- # @return [Boolean]
1186
- #
1187
- # source://railties//lib/rails/generators/generated_attribute.rb#171
1188
- def polymorphic?; end
1189
-
1190
- # @return [Boolean]
1191
- #
1192
- # source://railties//lib/rails/generators/generated_attribute.rb#167
1193
- def reference?; end
1194
-
1195
- # @return [Boolean]
1196
- #
1197
- # source://railties//lib/rails/generators/generated_attribute.rb#175
1198
- def required?; end
1199
-
1200
- # @return [Boolean]
1201
- #
1202
- # source://railties//lib/rails/generators/generated_attribute.rb#195
1203
- def rich_text?; end
1204
-
1205
- # source://railties//lib/rails/generators/generated_attribute.rb#143
1206
- def singular_name; end
1207
-
1208
- # @return [Boolean]
1209
- #
1210
- # source://railties//lib/rails/generators/generated_attribute.rb#191
1211
- def token?; end
1212
-
1213
- # Returns the value of attribute type.
1214
- #
1215
- # source://railties//lib/rails/generators/generated_attribute.rb#30
1216
- def type; end
1217
-
1218
- # Sets the attribute type
1219
- #
1220
- # @param value the value to set the attribute type to.
1221
- #
1222
- # source://railties//lib/rails/generators/generated_attribute.rb#30
1223
- def type=(_arg0); end
1224
-
1225
- # @return [Boolean]
1226
- #
1227
- # source://railties//lib/rails/generators/generated_attribute.rb#207
1228
- def virtual?; end
1229
-
1230
- class << self
1231
- # source://railties//lib/rails/generators/generated_attribute.rb#35
1232
- def parse(column_definition); end
1233
-
1234
- # @return [Boolean]
1235
- #
1236
- # source://railties//lib/rails/generators/generated_attribute.rb#72
1237
- def reference?(type); end
1238
-
1239
- # @return [Boolean]
1240
- #
1241
- # source://railties//lib/rails/generators/generated_attribute.rb#68
1242
- def valid_index_type?(index_type); end
1243
-
1244
- # @return [Boolean]
1245
- #
1246
- # source://railties//lib/rails/generators/generated_attribute.rb#63
1247
- def valid_type?(type); end
1248
-
1249
- private
1250
-
1251
- # parse possible attribute options like :limit for string/text/binary/integer, :precision/:scale for decimals or :polymorphic for references/belongs_to
1252
- # when declaring options curly brackets should be used
1253
- #
1254
- # source://railties//lib/rails/generators/generated_attribute.rb#79
1255
- def parse_type_and_options(type); end
1256
- end
1257
- end
1258
-
1259
- # source://railties//lib/rails/generators/generated_attribute.rb#10
1260
- Rails::Generators::GeneratedAttribute::DEFAULT_TYPES = T.let(T.unsafe(nil), Array)
1261
-
1262
- # source://railties//lib/rails/generators/generated_attribute.rb#8
1263
- Rails::Generators::GeneratedAttribute::INDEX_OPTIONS = T.let(T.unsafe(nil), Array)
1264
-
1265
- # source://railties//lib/rails/generators/generated_attribute.rb#9
1266
- Rails::Generators::GeneratedAttribute::UNIQ_INDEX_OPTIONS = T.let(T.unsafe(nil), Array)
1267
-
1268
- # Holds common methods for migrations. It assumes that migrations have the
1269
- # [0-9]*_name format and can be used by other frameworks (like Sequel)
1270
- # just by implementing the next migration version method.
1271
- #
1272
- # source://railties//lib/rails/generators/migration.rb#11
1273
- module Rails::Generators::Migration
1274
- extend ::ActiveSupport::Concern
1275
-
1276
- mixes_in_class_methods ::Rails::Generators::Migration::ClassMethods
1277
-
1278
- # source://railties//lib/rails/generators/migration.rb#35
1279
- def create_migration(destination, data, config = T.unsafe(nil), &block); end
1280
-
1281
- # Returns the value of attribute migration_class_name.
1282
- #
1283
- # source://railties//lib/rails/generators/migration.rb#13
1284
- def migration_class_name; end
1285
-
1286
- # Returns the value of attribute migration_file_name.
1287
- #
1288
- # source://railties//lib/rails/generators/migration.rb#13
1289
- def migration_file_name; end
1290
-
1291
- # Returns the value of attribute migration_number.
1292
- #
1293
- # source://railties//lib/rails/generators/migration.rb#13
1294
- def migration_number; end
1295
-
1296
- # Creates a migration template at the given destination. The difference
1297
- # to the default template method is that the migration version is appended
1298
- # to the destination file name.
1299
- #
1300
- # The migration version, migration file name, migration class name are
1301
- # available as instance variables in the template to be rendered.
1302
- #
1303
- # migration_template "migration.rb", "db/migrate/add_foo_to_bar.rb"
1304
- #
1305
- # source://railties//lib/rails/generators/migration.rb#56
1306
- def migration_template(source, destination, config = T.unsafe(nil)); end
1307
-
1308
- # source://railties//lib/rails/generators/migration.rb#39
1309
- def set_migration_assigns!(destination); end
1310
- end
1311
-
1312
- # source://railties//lib/rails/generators/migration.rb#15
1313
- module Rails::Generators::Migration::ClassMethods
1314
- # source://railties//lib/rails/generators/migration.rb#24
1315
- def current_migration_number(dirname); end
1316
-
1317
- # @return [Boolean]
1318
- #
1319
- # source://railties//lib/rails/generators/migration.rb#20
1320
- def migration_exists?(dirname, file_name); end
1321
-
1322
- # source://railties//lib/rails/generators/migration.rb#16
1323
- def migration_lookup_at(dirname); end
1324
-
1325
- # @raise [NotImplementedError]
1326
- #
1327
- # source://railties//lib/rails/generators/migration.rb#30
1328
- def next_migration_number(dirname); end
1329
- end
1330
-
1331
- # source://railties//lib/rails/generators/model_helpers.rb#7
1332
- module Rails::Generators::ModelHelpers
1333
- # source://railties//lib/rails/generators/model_helpers.rb#25
1334
- def initialize(args, *_options); end
1335
-
1336
- # source://railties//lib/rails/generators/model_helpers.rb#19
1337
- def skip_warn; end
1338
-
1339
- # source://railties//lib/rails/generators/model_helpers.rb#19
1340
- def skip_warn=(val); end
1341
-
1342
- private
1343
-
1344
- # @return [Boolean]
1345
- #
1346
- # source://railties//lib/rails/generators/model_helpers.rb#55
1347
- def inflection_impossible?(name); end
1348
-
1349
- # @return [Boolean]
1350
- #
1351
- # source://railties//lib/rails/generators/model_helpers.rb#51
1352
- def irregular_model_name?(name); end
1353
-
1354
- # @return [Boolean]
1355
- #
1356
- # source://railties//lib/rails/generators/model_helpers.rb#47
1357
- def plural_model_name?(name); end
1358
-
1359
- class << self
1360
- # source://railties//lib/rails/generators/model_helpers.rb#21
1361
- def included(base); end
1362
-
1363
- # source://railties//lib/rails/generators/model_helpers.rb#19
1364
- def skip_warn; end
1365
-
1366
- # source://railties//lib/rails/generators/model_helpers.rb#19
1367
- def skip_warn=(val); end
1368
- end
1369
- end
1370
-
1371
- # source://railties//lib/rails/generators/model_helpers.rb#14
1372
- Rails::Generators::ModelHelpers::INFLECTION_IMPOSSIBLE_ERROR_MESSAGE = T.let(T.unsafe(nil), String)
1373
-
1374
- # source://railties//lib/rails/generators/model_helpers.rb#10
1375
- Rails::Generators::ModelHelpers::IRREGULAR_MODEL_NAME_WARN_MESSAGE = T.let(T.unsafe(nil), String)
1376
-
1377
- # source://railties//lib/rails/generators/model_helpers.rb#8
1378
- Rails::Generators::ModelHelpers::PLURAL_MODEL_NAME_WARN_MESSAGE = T.let(T.unsafe(nil), String)
1379
-
1380
- # source://railties//lib/rails/generators/named_base.rb#8
1381
- class Rails::Generators::NamedBase < ::Rails::Generators::Base
1382
- # @return [NamedBase] a new instance of NamedBase
1383
- #
1384
- # source://railties//lib/rails/generators/named_base.rb#11
1385
- def initialize(args, *options); end
1386
-
1387
- # Returns the value of attribute file_name.
1388
- #
1389
- # source://thor/1.2.1/lib/thor/base.rb#139
1390
- def file_name; end
1391
-
1392
- # source://railties//lib/rails/generators/named_base.rb#29
1393
- def js_template(source, destination); end
1394
-
1395
- # source://thor/1.2.1/lib/thor/base.rb#147
1396
- def name; end
1397
-
1398
- # source://thor/1.2.1/lib/thor/base.rb#147
1399
- def name=(_arg0); end
1400
-
1401
- # source://railties//lib/rails/generators/named_base.rb#23
1402
- def template(source, *args, &block); end
1403
-
1404
- private
1405
-
1406
- # Tries to retrieve the application name or simply return application.
1407
- #
1408
- # source://railties//lib/rails/generators/named_base.rb#138
1409
- def application_name; end
1410
-
1411
- # source://railties//lib/rails/generators/named_base.rb#175
1412
- def assign_names!(name); end
1413
-
1414
- # source://railties//lib/rails/generators/named_base.rb#188
1415
- def attributes_names; end
1416
-
1417
- # source://railties//lib/rails/generators/named_base.rb#70
1418
- def class_name; end
1419
-
1420
- # source://railties//lib/rails/generators/named_base.rb#58
1421
- def class_path; end
1422
-
1423
- # source://railties//lib/rails/generators/named_base.rb#105
1424
- def edit_helper(*_arg0, **_arg1, &_arg2); end
1425
-
1426
- # source://railties//lib/rails/generators/named_base.rb#54
1427
- def file_path; end
1428
-
1429
- # source://railties//lib/rails/generators/named_base.rb#125
1430
- def fixture_file_name; end
1431
-
1432
- # source://railties//lib/rails/generators/named_base.rb#74
1433
- def human_name; end
1434
-
1435
- # source://railties//lib/rails/generators/named_base.rb#82
1436
- def i18n_scope; end
1437
-
1438
- # source://railties//lib/rails/generators/named_base.rb#97
1439
- def index_helper(type: T.unsafe(nil)); end
1440
-
1441
- # source://railties//lib/rails/generators/named_base.rb#43
1442
- def inside_template; end
1443
-
1444
- # @return [Boolean]
1445
- #
1446
- # source://railties//lib/rails/generators/named_base.rb#50
1447
- def inside_template?; end
1448
-
1449
- # source://railties//lib/rails/generators/named_base.rb#150
1450
- def model_resource_name(base_name = T.unsafe(nil), prefix: T.unsafe(nil)); end
1451
-
1452
- # @return [Boolean]
1453
- #
1454
- # source://railties//lib/rails/generators/named_base.rb#200
1455
- def mountable_engine?; end
1456
-
1457
- # source://railties//lib/rails/generators/named_base.rb#66
1458
- def namespaced_class_path; end
1459
-
1460
- # source://railties//lib/rails/generators/named_base.rb#109
1461
- def new_helper(type: T.unsafe(nil)); end
1462
-
1463
- # Convert attributes array into GeneratedAttribute objects.
1464
- #
1465
- # source://railties//lib/rails/generators/named_base.rb#182
1466
- def parse_attributes!; end
1467
-
1468
- # source://railties//lib/rails/generators/named_base.rb#121
1469
- def plural_file_name; end
1470
-
1471
- # source://railties//lib/rails/generators/named_base.rb#78
1472
- def plural_name; end
1473
-
1474
- # source://railties//lib/rails/generators/named_base.rb#167
1475
- def plural_route_name; end
1476
-
1477
- # source://railties//lib/rails/generators/named_base.rb#117
1478
- def plural_table_name; end
1479
-
1480
- # @return [Boolean]
1481
- #
1482
- # source://railties//lib/rails/generators/named_base.rb#196
1483
- def pluralize_table_names?; end
1484
-
1485
- # source://railties//lib/rails/generators/named_base.rb#146
1486
- def redirect_resource_name; end
1487
-
1488
- # source://railties//lib/rails/generators/named_base.rb#62
1489
- def regular_class_path; end
1490
-
1491
- # source://railties//lib/rails/generators/named_base.rb#129
1492
- def route_url; end
1493
-
1494
- # source://railties//lib/rails/generators/named_base.rb#101
1495
- def show_helper(arg = T.unsafe(nil), type: T.unsafe(nil)); end
1496
-
1497
- # FIXME: We are avoiding to use alias because a bug on thor that make
1498
- # this method public and add it to the task list.
1499
- #
1500
- # source://railties//lib/rails/generators/named_base.rb#39
1501
- def singular_name; end
1502
-
1503
- # source://railties//lib/rails/generators/named_base.rb#159
1504
- def singular_route_name; end
1505
-
1506
- # source://railties//lib/rails/generators/named_base.rb#113
1507
- def singular_table_name; end
1508
-
1509
- # source://railties//lib/rails/generators/named_base.rb#86
1510
- def table_name; end
1511
-
1512
- # @return [Boolean]
1513
- #
1514
- # source://railties//lib/rails/generators/named_base.rb#93
1515
- def uncountable?; end
1516
-
1517
- # source://railties//lib/rails/generators/named_base.rb#133
1518
- def url_helper_prefix; end
1519
-
1520
- class << self
1521
- # Add a class collisions name to be checked on class initialization. You
1522
- # can supply a hash with a +:prefix+ or +:suffix+ to be tested.
1523
- #
1524
- # ==== Examples
1525
- #
1526
- # check_class_collision suffix: "Decorator"
1527
- #
1528
- # If the generator is invoked with class name Admin, it will check for
1529
- # the presence of "AdminDecorator".
1530
- #
1531
- # source://railties//lib/rails/generators/named_base.rb#214
1532
- def check_class_collision(options = T.unsafe(nil)); end
1533
- end
1534
- end
1535
-
1536
- # Deal with controller names on scaffold and add some helpers to deal with
1537
- # ActiveModel.
1538
- #
1539
- # source://railties//lib/rails/generators/resource_helpers.rb#10
1540
- module Rails::Generators::ResourceHelpers
1541
- include ::Rails::Generators::ModelHelpers
1542
-
1543
- # Set controller variables on initialization.
1544
- #
1545
- # source://railties//lib/rails/generators/resource_helpers.rb#17
1546
- def initialize(*args); end
1547
-
1548
- private
1549
-
1550
- # source://railties//lib/rails/generators/resource_helpers.rb#39
1551
- def assign_controller_names!(name); end
1552
-
1553
- # source://railties//lib/rails/generators/resource_helpers.rb#50
1554
- def controller_class_name; end
1555
-
1556
- # source://railties//lib/rails/generators/resource_helpers.rb#31
1557
- def controller_class_path; end
1558
-
1559
- # Returns the value of attribute controller_file_name.
1560
- #
1561
- # source://railties//lib/rails/generators/resource_helpers.rb#29
1562
- def controller_file_name; end
1563
-
1564
- # source://railties//lib/rails/generators/resource_helpers.rb#46
1565
- def controller_file_path; end
1566
-
1567
- # source://railties//lib/rails/generators/resource_helpers.rb#54
1568
- def controller_i18n_scope; end
1569
-
1570
- # Returns the value of attribute controller_name.
1571
- #
1572
- # source://railties//lib/rails/generators/resource_helpers.rb#29
1573
- def controller_name; end
1574
-
1575
- # Loads the ORM::Generators::ActiveModel class. This class is responsible
1576
- # to tell scaffold entities how to generate a specific method for the
1577
- # ORM. Check Rails::Generators::ActiveModel for more information.
1578
- #
1579
- # source://railties//lib/rails/generators/resource_helpers.rb#61
1580
- def orm_class; end
1581
-
1582
- # Initialize ORM::Generators::ActiveModel to access instance methods.
1583
- #
1584
- # source://railties//lib/rails/generators/resource_helpers.rb#77
1585
- def orm_instance(name = T.unsafe(nil)); end
1586
-
1587
- class << self
1588
- # source://railties//lib/rails/generators/resource_helpers.rb#11
1589
- def included(base); end
1590
- end
1591
- end
1592
-
1593
- # This class provides a TestCase for testing generators. To set up, you need
1594
- # just to configure the destination and set which generator is being tested:
1595
- #
1596
- # class AppGeneratorTest < Rails::Generators::TestCase
1597
- # tests AppGenerator
1598
- # destination File.expand_path("../tmp", __dir__)
1599
- # end
1600
- #
1601
- # If you want to ensure your destination root is clean before running each test,
1602
- # you can set a setup callback:
1603
- #
1604
- # class AppGeneratorTest < Rails::Generators::TestCase
1605
- # tests AppGenerator
1606
- # destination File.expand_path("../tmp", __dir__)
1607
- # setup :prepare_destination
1608
- # end
1609
- #
1610
- # source://railties//lib/rails/generators/test_case.rb#30
1611
- class Rails::Generators::TestCase < ::ActiveSupport::TestCase
1612
- include ::ActiveSupport::Testing::Stream
1613
- include ::Rails::Generators::Testing::Behaviour
1614
- include ::Rails::Generators::Testing::SetupAndTeardown
1615
- include ::Rails::Generators::Testing::Assertions
1616
- include ::FileUtils::StreamUtils_
1617
- include ::FileUtils
1618
- extend ::Rails::Generators::Testing::Behaviour::ClassMethods
1619
-
1620
- # source://railties//lib/rails/generators/testing/behaviour.rb#21
1621
- def current_path; end
1622
-
1623
- # source://railties//lib/rails/generators/testing/behaviour.rb#21
1624
- def current_path=(_arg0); end
1625
-
1626
- # source://railties//lib/rails/generators/testing/behaviour.rb#21
1627
- def current_path?; end
1628
-
1629
- # source://railties//lib/rails/generators/testing/behaviour.rb#22
1630
- def default_arguments; end
1631
-
1632
- # source://railties//lib/rails/generators/testing/behaviour.rb#22
1633
- def default_arguments=(_arg0); end
1634
-
1635
- # source://railties//lib/rails/generators/testing/behaviour.rb#22
1636
- def default_arguments?; end
1637
-
1638
- # source://railties//lib/rails/generators/testing/behaviour.rb#23
1639
- def destination_root; end
1640
-
1641
- # source://railties//lib/rails/generators/testing/behaviour.rb#23
1642
- def destination_root=(_arg0); end
1643
-
1644
- # source://railties//lib/rails/generators/testing/behaviour.rb#23
1645
- def destination_root?; end
1646
-
1647
- # source://railties//lib/rails/generators/testing/behaviour.rb#24
1648
- def generator_class; end
1649
-
1650
- # source://railties//lib/rails/generators/testing/behaviour.rb#24
1651
- def generator_class=(_arg0); end
1652
-
1653
- # source://railties//lib/rails/generators/testing/behaviour.rb#24
1654
- def generator_class?; end
1655
-
1656
- class << self
1657
- # source://railties//lib/rails/generators/testing/behaviour.rb#21
1658
- def current_path; end
1659
-
1660
- # source://railties//lib/rails/generators/testing/behaviour.rb#21
1661
- def current_path=(value); end
1662
-
1663
- # source://railties//lib/rails/generators/testing/behaviour.rb#21
1664
- def current_path?; end
1665
-
1666
- # source://railties//lib/rails/generators/testing/behaviour.rb#22
1667
- def default_arguments; end
1668
-
1669
- # source://railties//lib/rails/generators/testing/behaviour.rb#22
1670
- def default_arguments=(value); end
1671
-
1672
- # source://railties//lib/rails/generators/testing/behaviour.rb#22
1673
- def default_arguments?; end
1674
-
1675
- # source://railties//lib/rails/generators/testing/behaviour.rb#23
1676
- def destination_root; end
1677
-
1678
- # source://railties//lib/rails/generators/testing/behaviour.rb#23
1679
- def destination_root=(value); end
1680
-
1681
- # source://railties//lib/rails/generators/testing/behaviour.rb#23
1682
- def destination_root?; end
1683
-
1684
- # source://railties//lib/rails/generators/testing/behaviour.rb#24
1685
- def generator_class; end
1686
-
1687
- # source://railties//lib/rails/generators/testing/behaviour.rb#24
1688
- def generator_class=(value); end
1689
-
1690
- # source://railties//lib/rails/generators/testing/behaviour.rb#24
1691
- def generator_class?; end
1692
- end
1693
- end
1694
-
1695
- # source://railties//lib/rails/generators/testing/behaviour.rb#13
1696
- module Rails::Generators::Testing; end
1697
-
1698
- # source://railties//lib/rails/generators/testing/assertions.rb#6
1699
- module Rails::Generators::Testing::Assertions
1700
- # Asserts the given class method exists in the given content. This method does not detect
1701
- # class methods inside (class << self), only class methods which starts with "self.".
1702
- # When a block is given, it yields the content of the method.
1703
- #
1704
- # assert_migration "db/migrate/create_products.rb" do |migration|
1705
- # assert_class_method :up, migration do |up|
1706
- # assert_match(/create_table/, up)
1707
- # end
1708
- # end
1709
- #
1710
- # source://railties//lib/rails/generators/testing/assertions.rb#88
1711
- def assert_class_method(method, content, &block); end
1712
-
1713
- # Asserts a given file exists. You need to supply an absolute path or a path relative
1714
- # to the configured destination:
1715
- #
1716
- # assert_file "config/environment.rb"
1717
- #
1718
- # You can also give extra arguments. If the argument is a regexp, it will check if the
1719
- # regular expression matches the given file content. If it's a string, it compares the
1720
- # file with the given string:
1721
- #
1722
- # assert_file "config/environment.rb", /initialize/
1723
- #
1724
- # Finally, when a block is given, it yields the file content:
1725
- #
1726
- # assert_file "app/controllers/products_controller.rb" do |controller|
1727
- # assert_instance_method :index, controller do |index|
1728
- # assert_match(/Product\.all/, index)
1729
- # end
1730
- # end
1731
- #
1732
- # source://railties//lib/rails/generators/testing/assertions.rb#25
1733
- def assert_directory(relative, *contents); end
1734
-
1735
- # Asserts the given attribute type gets a proper default value:
1736
- #
1737
- # assert_field_default_value :string, "MyString"
1738
- #
1739
- # source://railties//lib/rails/generators/testing/assertions.rb#117
1740
- def assert_field_default_value(attribute_type, value); end
1741
-
1742
- # Asserts the given attribute type gets translated to a field type
1743
- # properly:
1744
- #
1745
- # assert_field_type :date, :date_select
1746
- #
1747
- # source://railties//lib/rails/generators/testing/assertions.rb#110
1748
- def assert_field_type(attribute_type, field_type); end
1749
-
1750
- # Asserts a given file exists. You need to supply an absolute path or a path relative
1751
- # to the configured destination:
1752
- #
1753
- # assert_file "config/environment.rb"
1754
- #
1755
- # You can also give extra arguments. If the argument is a regexp, it will check if the
1756
- # regular expression matches the given file content. If it's a string, it compares the
1757
- # file with the given string:
1758
- #
1759
- # assert_file "config/environment.rb", /initialize/
1760
- #
1761
- # Finally, when a block is given, it yields the file content:
1762
- #
1763
- # assert_file "app/controllers/products_controller.rb" do |controller|
1764
- # assert_instance_method :index, controller do |index|
1765
- # assert_match(/Product\.all/, index)
1766
- # end
1767
- # end
1768
- #
1769
- # source://railties//lib/rails/generators/testing/assertions.rb#25
1770
- def assert_file(relative, *contents); end
1771
-
1772
- # Asserts the given method exists in the given content. When a block is given,
1773
- # it yields the content of the method.
1774
- #
1775
- # assert_file "app/controllers/products_controller.rb" do |controller|
1776
- # assert_instance_method :index, controller do |index|
1777
- # assert_match(/Product\.all/, index)
1778
- # end
1779
- # end
1780
- #
1781
- # source://railties//lib/rails/generators/testing/assertions.rb#100
1782
- def assert_instance_method(method, content); end
1783
-
1784
- # Asserts the given method exists in the given content. When a block is given,
1785
- # it yields the content of the method.
1786
- #
1787
- # assert_file "app/controllers/products_controller.rb" do |controller|
1788
- # assert_instance_method :index, controller do |index|
1789
- # assert_match(/Product\.all/, index)
1790
- # end
1791
- # end
1792
- #
1793
- # source://railties//lib/rails/generators/testing/assertions.rb#100
1794
- def assert_method(method, content); end
1795
-
1796
- # Asserts a given migration exists. You need to supply an absolute path or a
1797
- # path relative to the configured destination:
1798
- #
1799
- # assert_migration "db/migrate/create_products.rb"
1800
- #
1801
- # This method manipulates the given path and tries to find any migration which
1802
- # matches the migration name. For example, the call above is converted to:
1803
- #
1804
- # assert_file "db/migrate/003_create_products.rb"
1805
- #
1806
- # Consequently, assert_migration accepts the same arguments has assert_file.
1807
- #
1808
- # source://railties//lib/rails/generators/testing/assertions.rb#64
1809
- def assert_migration(relative, *contents, &block); end
1810
-
1811
- # Asserts a given file does not exist. You need to supply an absolute path or a
1812
- # path relative to the configured destination:
1813
- #
1814
- # assert_no_file "config/random.rb"
1815
- #
1816
- # source://railties//lib/rails/generators/testing/assertions.rb#47
1817
- def assert_no_directory(relative); end
1818
-
1819
- # Asserts a given file does not exist. You need to supply an absolute path or a
1820
- # path relative to the configured destination:
1821
- #
1822
- # assert_no_file "config/random.rb"
1823
- #
1824
- # source://railties//lib/rails/generators/testing/assertions.rb#47
1825
- def assert_no_file(relative); end
1826
-
1827
- # Asserts a given migration does not exist. You need to supply an absolute path or a
1828
- # path relative to the configured destination:
1829
- #
1830
- # assert_no_migration "db/migrate/create_products.rb"
1831
- #
1832
- # source://railties//lib/rails/generators/testing/assertions.rb#74
1833
- def assert_no_migration(relative); end
1834
- end
1835
-
1836
- # source://railties//lib/rails/generators/testing/behaviour.rb#14
1837
- module Rails::Generators::Testing::Behaviour
1838
- include ::ActiveSupport::Testing::Stream
1839
- extend ::ActiveSupport::Concern
1840
- include GeneratedInstanceMethods
1841
-
1842
- mixes_in_class_methods GeneratedClassMethods
1843
- mixes_in_class_methods ::Rails::Generators::Testing::Behaviour::ClassMethods
1844
-
1845
- # Create a Rails::Generators::GeneratedAttribute by supplying the
1846
- # attribute type and, optionally, the attribute name:
1847
- #
1848
- # create_generated_attribute(:string, "name")
1849
- #
1850
- # source://railties//lib/rails/generators/testing/behaviour.rb#85
1851
- def create_generated_attribute(attribute_type, name = T.unsafe(nil), index = T.unsafe(nil)); end
1852
-
1853
- # Instantiate the generator.
1854
- #
1855
- # source://railties//lib/rails/generators/testing/behaviour.rb#77
1856
- def generator(args = T.unsafe(nil), options = T.unsafe(nil), config = T.unsafe(nil)); end
1857
-
1858
- # Runs the generator configured for this class. The first argument is an array like
1859
- # command line arguments:
1860
- #
1861
- # class AppGeneratorTest < Rails::Generators::TestCase
1862
- # tests AppGenerator
1863
- # destination File.expand_path("../tmp", __dir__)
1864
- # setup :prepare_destination
1865
- #
1866
- # test "database.yml is not created when skipping Active Record" do
1867
- # run_generator %w(myapp --skip-active-record)
1868
- # assert_no_file "config/database.yml"
1869
- # end
1870
- # end
1871
- #
1872
- # You can provide a configuration hash as second argument. This method returns the output
1873
- # printed by the generator.
1874
- #
1875
- # source://railties//lib/rails/generators/testing/behaviour.rb#67
1876
- def run_generator(args = T.unsafe(nil), config = T.unsafe(nil)); end
1877
-
1878
- private
1879
-
1880
- # @return [Boolean]
1881
- #
1882
- # source://railties//lib/rails/generators/testing/behaviour.rb#90
1883
- def destination_root_is_set?; end
1884
-
1885
- # source://railties//lib/rails/generators/testing/behaviour.rb#94
1886
- def ensure_current_path; end
1887
-
1888
- # source://railties//lib/rails/generators/testing/behaviour.rb#104
1889
- def migration_file_name(relative); end
1890
-
1891
- # Clears all files and directories in destination.
1892
- #
1893
- # source://railties//lib/rails/generators/testing/behaviour.rb#99
1894
- def prepare_destination; end
1895
-
1896
- module GeneratedClassMethods
1897
- def current_path; end
1898
- def current_path=(value); end
1899
- def current_path?; end
1900
- def default_arguments; end
1901
- def default_arguments=(value); end
1902
- def default_arguments?; end
1903
- def destination_root; end
1904
- def destination_root=(value); end
1905
- def destination_root?; end
1906
- def generator_class; end
1907
- def generator_class=(value); end
1908
- def generator_class?; end
1909
- end
1910
-
1911
- module GeneratedInstanceMethods
1912
- def current_path; end
1913
- def current_path=(value); end
1914
- def current_path?; end
1915
- def default_arguments; end
1916
- def default_arguments=(value); end
1917
- def default_arguments?; end
1918
- def destination_root; end
1919
- def destination_root=(value); end
1920
- def destination_root?; end
1921
- def generator_class; end
1922
- def generator_class=(value); end
1923
- def generator_class?; end
1924
- end
1925
- end
1926
-
1927
- # source://railties//lib/rails/generators/testing/behaviour.rb#27
1928
- module Rails::Generators::Testing::Behaviour::ClassMethods
1929
- # Sets default arguments on generator invocation. This can be overwritten when
1930
- # invoking it.
1931
- #
1932
- # arguments %w(app_name --skip-active-record)
1933
- #
1934
- # source://railties//lib/rails/generators/testing/behaviour.rb#39
1935
- def arguments(array); end
1936
-
1937
- # Sets the destination of generator files:
1938
- #
1939
- # destination File.expand_path("../tmp", __dir__)
1940
- #
1941
- # source://railties//lib/rails/generators/testing/behaviour.rb#46
1942
- def destination(path); end
1943
-
1944
- # Sets which generator should be tested:
1945
- #
1946
- # tests AppGenerator
1947
- #
1948
- # source://railties//lib/rails/generators/testing/behaviour.rb#31
1949
- def tests(klass); end
1950
- end
1951
-
1952
- # source://railties//lib/rails/generators/testing/setup_and_teardown.rb#6
1953
- module Rails::Generators::Testing::SetupAndTeardown
1954
- # source://railties//lib/rails/generators/testing/setup_and_teardown.rb#7
1955
- def setup; end
1956
-
1957
- # source://railties//lib/rails/generators/testing/setup_and_teardown.rb#13
1958
- def teardown; end
1959
- end