aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove duplicate method definitionDaniel Colson2019-08-011-5/+0
| | | | | | | | | | | | | no_color! is already defined in [`Rails::Command::Behavior`][behavior], which gets [included into `Rails:Generators`][include]. This duplication came about in 6813edc7d9 when we introduced the Thor command structure. We have [test coverage][] to ensure this method still behaves correctly on `Rails:Generators`. [behavior]: https://github.com/rails/rails/blob/f7e91c7224560fbd3e95c238a0e8bb362799bcb7/railties/lib/rails/command/behavior.rb#L12-L14 [include]: https://github.com/rails/rails/blob/f7e91c7224560fbd3e95c238a0e8bb362799bcb7/railties/lib/rails/generators.rb#L18 [test coverage]: https://github.com/rails/rails/blob/f7e91c7224560fbd3e95c238a0e8bb362799bcb7/railties/test/generators_test.rb#L163-L168
* These are already required via rails/command.rbAkira Matsuda2019-07-121-2/+0
|
* Enable `Layout/EmptyLinesAroundAccessModifier` copRyuta Kamizono2019-06-131-1/+0
| | | | | | | | | | | We sometimes say "✂️ newline after `private`" in a code review (e.g. https://github.com/rails/rails/pull/18546#discussion_r23188776, https://github.com/rails/rails/pull/34832#discussion_r244847195). Now `Layout/EmptyLinesAroundAccessModifier` cop have new enforced style `EnforcedStyle: only_before` (https://github.com/rubocop-hq/rubocop/pull/7059). That cop and enforced style will reduce the our code review cost.
* Resurrect js/js engine options and generatorsNicholas La Roux2019-04-051-0/+2
|
* Revert "Revert "Remove `javascripts` and `javascript_engine` options for ↵Nicholas La Roux2019-03-201-2/+0
| | | | generators""
* Revert "Remove `javascripts` and `javascript_engine` options for generators"Nicholas La Roux2019-03-191-0/+2
|
* Add rails db:system:change commandGannon McGibbon2019-01-091-0/+1
| | | | | | | | | | | | | | Add `rails db:system:change` command for changing databases. ``` bin/rails db:system:change --to=postgresql force config/database.yml gsub Gemfile ``` The change command copies a template `config/database.yml` with the target database adapter into your app, and replaces your database gem with the target database gem.
* Move application generator naming and database code to concernsGannon McGibbon2019-01-091-0/+2
|
* Do not show suggestion message when not exist suggestionyuuji.yaginuma2018-12-291-1/+3
| | | | | | | | | | | | | | | | | | **before** ``` $ ./bin/rails g g Could not find generator 'g'. Maybe you meant nil? Run `rails generate --help` for more options. ``` **after** ``` $ ./bin/rails g g Could not find generator 'g'. Run `rails generate --help` for more options. ```
* Remove `javascripts` and `javascript_engine` options for generatorsbogdanvlviv2018-10-221-2/+0
| | | | It is unused since #33079
* Make Webpacker the default JavaScript compiler for Rails 6 (#33079)David Heinemeier Hansson2018-09-301-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use Webpacker by default on new apps * Stop including coffee-rails by default * Drop using a js_compressor by default * Drop extra test for coffeescript inclusion by default * Stick with skip_javascript to signify skipping webpack * Don't install a JS runtime by default any more * app/javascript will be the new default directory for JS * Make it clear that this is just for configuring the default Webpack framework setup now * Start using the Webpack tag in the default layout * Irrelevant test * jQuery is long gone * Stop having asset pipeline compile default application.js * Add rails-ujs by default to the Webpack setup * Add Active Storage JavaScript to application.js pack by default * Consistent quoting * Add Turbolinks to default pack * Add Action Cable to default pack Need some work on how to set the global consumer that channels will work with. @javan? * Require all channels by default and use a separate consumer stub * Channel generator now targets Webpack style * Update task docs to match new generator style * Use uniform import style * Drop the JS assets generator It was barely helpful as it was. It’s no longer helpful in a Webpacked world. Sayonara! * Add app/javascript to the stats directories * Simpler import style Which match the other imports. * Address test failures from dropping JS compilation (and compression) * webpacker-default: Modify `AssetsGeneratorTest` Before: ``` $ bin/test test/generators/assets_generator_test.rb Run options: --seed 46201 F Failure: AssetsGeneratorTest#test_assets [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/assets_generator_test.rb:12]: Expected file "app/assets/javascripts/posts.js" to exist, but does not bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/assets_generator_test.rb:10 . Finished in 0.031343s, 63.8101 runs/s, 95.7152 assertions/s. 2 runs, 3 assertions, 1 failures, 0 errors, 0 skips ``` After: ``` $ bin/test test/generators/assets_generator_test.rb Run options: --seed 43571 .. Finished in 0.030370s, 65.8545 runs/s, 65.8545 assertions/s. 2 runs, 2 assertions, 0 failures, 0 errors, 0 skips ``` * webpacker-default: Modify `ChannelGeneratorTest` Before: ``` $ bin/test test/generators/channel_generator_test.rb Run options: --seed 8986 .F Failure: ChannelGeneratorTest#test_channel_with_multiple_actions_is_created [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:43]: Expected file "app/assets/javascripts/channels/chat.js" to exist, but does not bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:34 .F Failure: ChannelGeneratorTest#test_channel_is_created [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:29]: Expected file "app/assets/javascripts/channels/chat.js" to exist, but does not bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:22 E Error: ChannelGeneratorTest#test_cable_js_is_created_if_not_present_already: Errno::ENOENT: No such file or directory @ apply2files - /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/fixtures/tmp/app/assets/javascripts/cable.js bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:60 F Failure: ChannelGeneratorTest#test_channel_suffix_is_not_duplicated [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:87]: Expected file "app/assets/javascripts/channels/chat.js" to exist, but does not bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:80 F Failure: ChannelGeneratorTest#test_channel_on_revoke [/Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:77]: Expected file "app/assets/javascripts/cable.js" to exist, but does not bin/test /Users/ttanimichi/ghq/github.com/ttanimichi/rails/railties/test/generators/channel_generator_test.rb:68 Finished in 0.064384s, 108.7227 runs/s, 481.4861 assertions/s. 7 runs, 31 assertions, 4 failures, 1 errors, 0 skips ``` After: ``` $ bin/test test/generators/channel_generator_test.rb Run options: --seed 44857 ....... Finished in 0.060243s, 116.1961 runs/s, 697.1764 assertions/s. 7 runs, 42 assertions, 0 failures, 0 errors, 0 skips ``` * Fix shared generator tests. * webpacker-default: Modify `ControllerGeneratorTest` The JS assets generator was dropped. ref. https://github.com/rails/rails/commit/46215b179483d3e4d264555f5a4952f43eb8142a * Revert "Simpler import style". It's currently failing with an error of "TypeError: undefined is not an object (evaluating '__WEBPACK_IMPORTED_MODULE_2_activestorage___default.a.start')". Waiting for @javan to have a look. This reverts commit 5d3ebb71059f635d3756cbda4ab9752027e09256. * require webpacker in test app * Add webpacker without making the build hang/timeout. (#33640) * use yarn workspaces to allow for installing unreleased packages and only generate js/bootsnap when required * no longer need to have webpacker in env templates as webpacker moved this config to yml file * Fix rubocop violation * Got the test passing for the running scaffold * update expected lines of code * update middleware tests to account for webpacker * disable js in plugins be default to get the tests passing (#34009) * clear codeclimate report issues * Anything newer than currently released is good * Use Webpacker development version during development of Rails * Edge should get development webpacker as well * Add changelog entry for Webpacker change
* Turn on performance based copsDillon Welch2018-07-231-1/+1
| | | | | | | | | | | | | | | | Use attr_reader/attr_writer instead of methods method is 12% slower Use flat_map over map.flatten(1) flatten is 66% slower Use hash[]= instead of hash.merge! with single arguments merge! is 166% slower See https://github.com/rails/rails/pull/32337 for more conversation
* Enable `Layout/EmptyLinesAroundBlockBody` to reduce review cost in the futureRyuta Kamizono2018-07-121-1/+0
| | | | | | | We sometimes ask "✂️ extra blank lines" to a contributor in reviews like https://github.com/rails/rails/pull/33337#discussion_r201509738. It is preferable to deal automatically without depending on manpower.
* Remove unnecessary line break and quotesyuuji.yaginuma2018-03-301-2/+2
|
* Use `did_you_mean` spell checker for option suggestionsGenadi Samokovarov2018-03-231-6/+5
| | | | | | | | | | | Now that we require Ruby over `2.3`, we can replace the current suggestion methods we have with tooling from the `did_you_mean` gem. There is a small user visible change and this is that we now offer a single suggestion for misspelled options. We are suggesting fixes during generator invocation and during a mistyped rails server rack handler. In both cases, if we don't make a proper prediction on the first match, we won't do so in the second or third one, so in my mind, this is okay.
* Extract Rails::Command::SpellcheckerGenadi Samokovarov2018-03-041-1/+1
|
* Removed "private" generators from command list.Wojciech Wnętrzak2018-02-021-0/+3
| | | | | | | | | | | | | | | | | | | | Appropriate way to handle encrypted command is by `bin/rails credentials` and `bin/rails encrypted` It was displayed on `bin/rails generate` command: ``` Please choose a generator below. Rails: application_record assets channel controller encrypted_file encryption_key_file generator ... ```
* Fix generator suggestion raise error when I18n.available_locales don’t ↵willnet2017-11-221-1/+2
| | | | include :en
* Do not show credentials in generators helpyuuji.yaginuma2017-11-091-0/+1
| | | | | | Since credentials generator is executed via the credentials command and does not need to be executed directly, so it is not necessary to show it in help.
* [Railties] require_relative => requireAkira Matsuda2017-10-211-1/+1
| | | | This basically reverts 618268b4b9382f4bcf004a945fe2d85c0bd03e32
* Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-141-0/+2
|
* Railties updates for frozen string literals.Pat Allan2017-08-141-1/+1
|
* Optimize indentation for generator actionsYoshiyuki Hirano2017-08-111-0/+1
|
* [Railties] require => require_relativeAkira Matsuda2017-07-011-1/+1
|
* Define path with __dir__bogdanvlviv2017-05-231-1/+1
| | | | | | ".. with __dir__ we can restore order in the Universe." - by @fxn Related to 5b8738c2df003a96f0e490c43559747618d10f5f
* Use appropriate type for `test_framework` optionyuuji.yaginuma2017-03-011-1/+1
| | | | | | | | This fixes the following warning. ``` Expected string default value for '--test-framework'; got false (boolean) ```
* Revert "Revert "Add encrypted secrets""Kasper Timm Hansen2017-02-231-0/+1
|
* Revert "Add encrypted secrets" (#28127)David Heinemeier Hansson2017-02-231-1/+0
|
* Add encrypted secrets (#28038)Kasper Timm Hansen2017-02-231-0/+1
|
* Refactor config settings to use generated fileeileencodes2017-02-201-1/+1
| | | | | | | | | | | | | | | | | | | Originally I had set up system testing to have one configuration option to be set in the test environment. After thinking it over I think a generated class on app creation would be best. The reason for this is Capybara has a ton of configuration options that I'm sure some folks want to use. Thinking about how we handle screenshots, database transactions, and a whole bunch of other settings it would be better for users to be able to turn all of that on and off. When an app or scaffold is generated a `test/system_test_helper.rb` test helper will be generated as well. This will contain the class for tests to inherit from `ActionSystemTestCase` which will inherit from `ActionSystemTest::Base`. Here is where users can change the test driver, remove the screenshot helper, and add their additional Capybara configuration.
* Add generators and ability to run system testseileencodes2017-02-201-0/+2
| | | | | | | * Generates system test requirements with new Rails app * Includes required default gems in Gemfile for Rails app * Generates a single system test case * Generates a system test case with scaffold
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2017-01-111-1/+1
|\ | | | | | | | | Conflicts: railties/lib/rails/generators.rb
| * Capitalize Thor gem nameJon Moss2016-12-191-1/+1
| | | | | | | | [ci skip]
* | Privatize some methods that were originally protectedAkira Matsuda2016-12-251-25/+27
| |
* | Prefer class << self; def over def self.Akira Matsuda2016-12-251-200/+200
| |
* | `protected` here doesn't protect anythingAkira Matsuda2016-12-251-26/+25
|/ | | | there aren't any instance method defined in this class
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-2/+2
|
* Initial command structure.Kasper Timm Hansen2016-09-251-153/+65
|
* [ci skip] Update Levenshtein code with better attribution.Kasper Timm Hansen2016-09-121-1/+3
| | | | Lacks some proper creds to the homies who went the... distance ;)
* Add three new rubocop rulesRafael Mendonça França2016-08-161-2/+2
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in railties/libXavier Noria2016-08-061-34/+34
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* generate mailer views in Rails APIyuuji.yaginuma2016-02-151-1/+5
| | | | | View files is necessary to send mail, it should be generated even Rails API. Fixes #23617
* do not show Active Job test generatoryuuji.yaginuma2015-11-141-0/+1
| | | | | Like the other generator, for also Active Job, I think that there is no need to display for test generator.
* Fix strange messages for `rails g foo`FUJI Goro (gfx)2015-09-071-1/+1
|
* Document Generators.api_only! methodSantiago Pastorino2015-06-111-0/+4
|
* Api apps scaffold does not generate assetsSantiago Pastorino2015-06-111-0/+1
|
* Api apps scaffold does not generate helpersSantiago Pastorino2015-06-111-0/+1
|
* Api apps scaffold does not generate viewsSantiago Pastorino2015-06-111-1/+2
|
* config.generators.api_only = true set rails api option on generatorsSantiago Pastorino2015-06-111-0/+4
|