aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators.rb
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
| |
* | print generators on failed generateschneems2014-05-261-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let's say we just ran: ``` $ rails g migrate add_click_to_issue_assignment ``` We will get an error that looks like: ``` Could not find generator migrate. ``` This patch adds all existing migrations to the output to make it easier for a developer to find a valid migration. ``` Could not find generator "migrate". Please select a valid generator: Rails: assets controller generator helper integration_test mailer migration model resource scaffold scaffold_controller task ``` It would be nice to do some spelling detection and suggest alternatives, but for now this should help.
* | Revert "Merge pull request #15293 from ↵Yves Senn2014-05-241-16/+12
| | | | | | | | | | | | | | | | | | | | | | schneems/schneems/generator-output-in-error" This reverts commit 7466d6a9f989a1a8f90899b79b34f1152e440b7c, reversing changes made to b850c4c540e8f0c15742f67c532f521a4a123655. This was an accidental merge. A new PR will follow. /cc @schneems
* | print generators on failed generateschneems2014-05-241-12/+16
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let's say we just ran: ``` $ rails g migrate add_click_to_issue_assignment ``` We will get an error that looks like: ``` Could not find generator migrate. ``` This patch adds all existing migrations to the output to make it easier for a developer to find a valid migration. ``` Could not find generator "migrate". Please select a valid generator: Rails: assets controller generator helper integration_test mailer migration model resource scaffold scaffold_controller task ``` It would be nice to do some spelling detection and suggest alternatives, but for now this should help.
* Require the top file and autoload Base classRafael Mendonça França2013-11-091-0/+1
| | | | | | | The generators entry point file is rails/generators so we need to make sure uers will be able to use the generators when requiring that file. Fixes #12802
* Remove "circular require considered harmful" errorRobin Dupret2013-11-011-2/+2
| | | | | rails/generators should not load rails/generators/base since the latter is loading it.
* s/plugin_new/pluginschneems2013-06-301-1/+1
| | | | | There are historical reasons that the `plugin` command was `plugin_new`, now those are no longer applicable, we should remove the naming edge case from the project. This PR is based off of comments from #11176 ATP Railties
* remove performance tests from the default stackYves Senn2013-01-101-2/+0
|
* Remove observers and sweepersRafael Mendonça França2012-11-281-2/+0
| | | | | | | | They was extracted from a plugin. See https://github.com/rails/rails-observers [Rafael Mendonça França + Steve Klabnik]
* Use Ruby 1.9 Hash syntax in railtiesRobin Dupret2012-10-141-29/+29
|
* Extract ActiveRecord::SessionStore from RailsPrem Sichanugrist2012-08-241-1/+0
| | | | | This functionality will be available from gem `active_record-session_store` instead.
* Removing ==Examples and last blank lines of docs from railtiesFrancesco Rodriguez2012-05-141-4/+0
|
* Add hook for add_resource_routeSantiago Pastorino2012-04-181-0/+2
|
* Remove --http.José Valim2012-03-141-22/+1
|
* Generate special controller and functional test templates for http appsCarlos Antonio da Silva2012-03-141-0/+2
| | | | | | | | | | | | The main goal is to not generate the format.html block in scaffold controller, and to generate a different functional test as we don't rely on redirects anymore, we should test for http responses. In addition to that, the :edit action is removed from the http controller and the edit route is not generated by default, as they usually do not make sense in this scenario. [Carlos Antonio da Silva & Santiago Pastorino]
* Allow generator configs from http_only! to be overriden by appCarlos Antonio da Silva2012-03-141-1/+1
| | | | [Carlos Antonio da Silva & Santiago Pastorino]
* Disable template, helper and assets options when using http_only!Carlos Antonio da Silva2012-03-141-1/+14
| | | | [Carlos Antonio da Silva & Santiago Pastorino]
* Create generators http_only! setup and hide some common namespaces for nowCarlos Antonio da Silva2012-03-141-1/+7
| | | | [Carlos Antonio da Silva & Santiago Pastorino]
* Rails::Plugin has goneSantiago Pastorino2012-01-031-11/+0
|
* Revert the serializers API as other alternatives are now also under discussionJosé Valim2011-11-251-3/+1
|
* Add a hook for serializers in the scaffold generator (off for now).José Valim2011-11-251-1/+3
|
* fix ambiguous * and remove unused variableAaron Patterson2011-08-241-2/+2
|
* Move Coffee generators and templates to Coffee Railtie and create ↵Santiago Pastorino2011-06-291-1/+1
| | | | javascript_engine ("js") for apps that remove Coffee gem
* Removed rescue branch for Rails 2.x compatibilityAlexey Gaziev2011-06-201-3/+0
|
* Fix regexp in generators for right catching error messageAlexey Gaziev2011-06-201-1/+1
|
* Use mattr_accessor :namespaceStefan Sprenger2011-06-071-10/+2
|
* Use namespace if it's a mountable engineStefan Sprenger2011-06-071-0/+10
|
* Streamline generators initialization flow.José Valim2011-05-251-11/+1
|
* Hide css:* and the default stylesheet from rails gwycats2011-05-241-1/+6
|
* Update generator config to support hiding namespaces and pass the app into ↵wycats2011-05-241-0/+1
| | | | generator blocks
* Move SCSS generators and default templates from Rails to the Sass Railtie ↵tomhuda2011-05-241-1/+1
| | | | | | | | (d435726312601edb3ba6f97b34f562221f72c1f8). * Sass gem registers a compressor * Sass gem registers generators for assets and scaffold * Create a default stylesheet_engine ("css") for apps that remove the Sass gem
* default orm and test_framework to false; change application.rb template ↵Aditya Sanghi2011-05-061-2/+2
| | | | accordingly
* Fix assets generators.José Valim2011-04-171-0/+1
|
* Make generators more modular, add hooks and improve test suite.José Valim2011-04-171-2/+7
|
* The controller and resource generators will now automatically produce asset ↵David Heinemeier Hansson2011-04-141-0/+1
| | | | stubs (this can be turned off with --skip-assets). These stubs will use Coffee and Sass, if those libraries are available. [DHH]
* Allow generators nested in more than one levelSantiago Pastorino2011-01-121-1/+1
|
* Ensure that app generator is not loaded twice to get rid of warningsPiotr Sarnacki2010-11-221-0/+1
| | | | Signed-off-by: José Valim <jose.valim@gmail.com>
* Tidy up generators commits.José Valim2010-11-171-0/+1
|
* Perf: speed up 2 methods in railties.Emilio Tagua2010-09-221-4/+1
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Trifling typosRaphomet2010-08-211-2/+2
| | | | Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Remove the --singeleton option from scaffold generator.Prem Sichanugrist2010-06-241-2/+1
| | | | | | | | It turned out to be that scaffold for singeleton resource will always depend on another model, and it's not possible at the moment to make the application tests pass after generate the singeleton scafold. So, it would be better to remove it for now and probably provide another generator, such as singeleton_scaffold, in which also require the depended model name. [#4863 state:resolved] Signed-off-by: José Valim <jose.valim@gmail.com>
* Tidy up generators based on latest change on AM.José Valim2010-06-131-1/+1
|
* Hide remaining generators hooks [#4790 state:resolved]José Valim2010-06-081-1/+5
|