aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators.rb
Commit message (Collapse)AuthorAgeFilesLines
* 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
|
* Hide assets, helper, css and js namespaces for api only appsSantiago Pastorino2015-06-111-0/+5
|
* rails new --api generates an api app skeletonSantiago Pastorino2015-06-111-0/+1
|
* add option to avoid generating scaffold.cssmasarakki2015-06-091-0/+2
|
* Speed up Levenshtein by 50% and reduce 97% of memory usageYuki Nishijima2015-04-111-2/+5
| | | | | | | | | | | | | | | | Calculating ------------------------------------- each_char 924.000 i/100ms each_codepoint 1.381k i/100ms ------------------------------------------------- each_char 9.320k (¡Þ 5.1%) i/s - 47.124k each_codepoint 13.857k (¡Þ 3.6%) i/s - 70.431k Comparison: each_codepoint: 13857.4 i/s each_char: 9319.5 i/s - 1.49x slower The full report can be found here: https://gist.github.com/yuki24/a80988f35aceac76f1d5
* Merge pull request #18395 from shunsukeaida/improve_generator_name_suggestionsRichard Schneeman2015-02-231-3/+1
|\ | | | | Improve generator name suggestions a bit.
| * Improve generator name suggestions a bit.ShunsukeAida2015-02-221-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the Levenshtein distances to most commands were wrongly calculated due to a big shortcut. This might be included in the original code for the performance sake, but I'm not sure that's something we should take over accuracy in Rails. Before 'foo' to 'assets' #=> 3 'foo' to 'controller' #=> 3 'foo' to 'generator' #=> 3 'foo' to 'helper' #=> 3 'foo' to 'integration_test' #=> 3 'foo' to 'jbuilder' #=> 3 'foo' to 'job' #=> 2 'foo' to 'mailer' #=> 3 'foo' to 'migration' #=> 3 'foo' to 'model' #=> 3 'foo' to 'resource' #=> 3 'foo' to 'resource_route' #=> 3 'foo' to 'scaffold' #=> 3 'foo' to 'scaffold_controller' #=> 3 'foo' to 'task' #=> 4 'foo' to 'active_record:migration' #=> 3 'foo' to 'active_record:model' #=> 3 'foo' to 'coffee:assets' #=> 3 'foo' to 'css:assets' #=> 3 'foo' to 'css:scaffold' #=> 3 'foo' to 'erb:controller' #=> 3 'foo' to 'erb:mailer' #=> 3 'foo' to 'erb:scaffold' #=> 3 'foo' to 'js:assets' #=> 3 'foo' to 'scss:assets' #=> 3 'foo' to 'scss:scaffold' #=> 3 'foo' to 'test_unit:controller' #=> 3 'foo' to 'test_unit:generator' #=> 3 'foo' to 'test_unit:helper' #=> 3 'foo' to 'test_unit:integration' #=> 3 'foo' to 'test_unit:job' #=> 3 'foo' to 'test_unit:mailer' #=> 3 'foo' to 'test_unit:model' #=> 3 'foo' to 'test_unit:plugin' #=> 3 'foo' to 'test_unit:scaffold' #=> 3 After 'foo' to 'assets' #=> 6 'foo' to 'controller' #=> 8 'foo' to 'generator' #=> 8 'foo' to 'helper' #=> 6 'foo' to 'integration_test' #=> 15 'foo' to 'jbuilder' #=> 8 'foo' to 'job' #=> 2 'foo' to 'mailer' #=> 6 'foo' to 'migration' #=> 8 'foo' to 'model' #=> 4 'foo' to 'resource' #=> 7 'foo' to 'resource_route' #=> 12 'foo' to 'scaffold' #=> 6 'foo' to 'scaffold_controller' #=> 16 'foo' to 'task' #=> 4 'foo' to 'active_record:migration' #=> 21 'foo' to 'active_record:model' #=> 17 'foo' to 'coffee:assets' #=> 12 'foo' to 'css:assets' #=> 10 'foo' to 'css:scaffold' #=> 10 'foo' to 'erb:controller' #=> 12 'foo' to 'erb:mailer' #=> 10 'foo' to 'erb:scaffold' #=> 10 'foo' to 'js:assets' #=> 9 'foo' to 'scss:assets' #=> 11 'foo' to 'scss:scaffold' #=> 11 'foo' to 'test_unit:controller' #=> 18 'foo' to 'test_unit:generator' #=> 18 'foo' to 'test_unit:helper' #=> 16 'foo' to 'test_unit:integration' #=> 20 'foo' to 'test_unit:job' #=> 12 'foo' to 'test_unit:mailer' #=> 16 'foo' to 'test_unit:model' #=> 14 'foo' to 'test_unit:plugin' #=> 16 'foo' to 'test_unit:scaffold' #=> 16 Besides that, the conjunction "or" of the message now appears only between the last two suggestions.
* | Small enhancement for generatorsHolger Frohloff2015-02-031-2/+2
|/ | | | | Changes a call to #map and a subsequent call to #flatten to the more idiomatic version of #flat_map. This commit also removes an unnessecary return statement.
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-2/+2
|
* Emit suggested generator names when not foundschneems2014-06-041-8/+52
| | | | | | | | | | | | | | | When someone types in a generator command it currently outputs all generators. Instead we can attempt to find a subtle mis-spelling by running all generator names through a levenshtein_distance algorithm provided by rubygems. So now a failure looks like this: ```ruby $ rails generate migratioooons Could not find generator 'migratioooons'. Maybe you meant 'migration' or 'integration_test' or 'generator' Run `rails generate --help` for more options. ``` If the suggestions are bad we leave the user with the hint to run `rails generate --help` to see all commands.
* Merge branch 'master' of github.com:rails/docrailsVijay Dev2014-06-011-0/+5
|\
| * document generators hidden_namespacesschneems2014-05-291-0/+5
| |