aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/base.rb
Commit message (Collapse)AuthorAgeFilesLines
* Use match? where we don't need MatchDataAkira Matsuda2019-07-271-1/+1
| | | | We're already running Performance/RegexpMatch cop, but it seems like the cop is not always =~ justice
* Add `skip-collision-check` option to generatoryuuji.yaginuma2019-07-051-2/+5
| | | | | | | | | | | | | | | | | | | Until Rails 5.2, generators can run same name multi times without destroying. But Rails 6.0(with Zeitwerk) can't this. In Rails 6.0, an error occurs due to class name collision check. The check uses `const_defined?`, which assumes that the autoload object is also defined. https://ruby-doc.org/core-2.6.3/Module.html#method-i-const_defined-3F It did not work until Rails 5.2, but Zeitwerk seems to be able to correctly check this against the application's code. However, this is a little inconvenient if want to run the generator again like mistake an attribute name(need to run `destoy` before). In order to solve this, this PR adds an option to skip the collision check. With this option, you can overwrite files just as did until Rails 5.2.
* 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.
* Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-141-0/+2
|
* Move generator namespacing to BaseLisa Ugray2017-07-191-0/+37
| | | | | | | Generators need to be aware of namespace to work properly in engines. Methods to help with this lived in Rails::Generators::NamedBase. Moving them to Rails::Generators::Base (which NamedBase inherits from) allows a follow-up in which a namespace aware unnamed generator can be created.
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
|
* Define path with __dir__bogdanvlviv2017-05-231-1/+1
| | | | | | ".. with __dir__ we can restore order in the Universe." - by @fxn Related to 5b8738c2df003a96f0e490c43559747618d10f5f
* Reduce string objects by using \ instead of + or << for concatenating stringsAkira Matsuda2017-01-121-2/+2
| | | | (I personally prefer writing one string in one line no matter how long it is, though)
* `self.` is not needed when calling its own instance methodAkira Matsuda2017-01-051-1/+1
| | | | Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
* Privatize unneededly protected methods in RailtiesAkira Matsuda2016-12-251-12/+12
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-5/+5
|
* fixes remaining RuboCop issues [Vipul A M, Xavier Noria]Xavier Noria2016-09-011-2/+2
|
* Add three new rubocop rulesRafael Mendonça França2016-08-161-1/+1
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* code gardening: removes redundant selfsXavier Noria2016-08-081-2/+2
| | | | | | | | | A few have been left for aesthetic reasons, but have made a pass and removed most of them. Note that if the method `foo` returns an array, `foo << 1` is a regular push, nothing to do with assignments, so no self required.
* applies remaining conventions across the projectXavier Noria2016-08-061-1/+0
|
* applies new string literal convention in railties/libXavier Noria2016-08-061-9/+9
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* Renamed ‘Return’ to ‘Returns’ [ci skip]Ronak Jangir2015-09-281-2/+2
|
* [skip ci] Lookup can be a noun but it is not a verbJon Atack2015-07-171-3/+3
| | | | Various grammar corrections and wrap to 80 characters.
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-1/+1
|
* Replace :base with :in [ci skip]Marcio Junior2014-05-111-2/+2
|
* Typos. return -> returns. [ci skip]Lauro Caetano2013-12-031-1/+1
|
* Require the top file and autoload Base classRafael Mendonça França2013-11-091-2/+0
| | | | | | | 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
* Merge pull request #12733 from robin850/fix-railties-buildRafael Mendonça França2013-11-011-1/+0
|\ | | | | Fix railties build
| * Remove "circular require considered harmful" errorRobin Dupret2013-11-011-1/+0
| | | | | | | | | | rails/generators should not load rails/generators/base since the latter is loading it.
* | More Warnings removed for ruby trunkArun Agrawal2013-11-011-3/+3
|/ | | | Same as 4d4ff531b8807ee88a3fc46875c7e76f613956fb
* rename AppPreparerAaron Patterson2013-10-301-0/+1
| | | | | AppPreparer doesn't actually prepare applications, it scrubs ARGV. Let's also get the class under test while we're at it
* Refactoring Generators::Base.wangjohn2013-08-281-14/+17
| | | | | | | The defaults hash isn't used unless the +class_options+ hash has a particular key, so we don't need to compute it unless this is true. Also moving some code for extracting a module into its own method.
* Use Ruby 1.9 Hash syntax in railtiesRobin Dupret2012-10-141-8/+8
|
* update Rails::Generators docs [ci skip]Francesco Rodriguez2012-10-071-1/+1
|
* Remove redundant 'the'.Uģis Ozols2012-09-131-1/+1
|
* removes usage of Object#in? from the code base (the method remains defined ↵Xavier Noria2012-08-061-2/+1
| | | | | | | | | | | | | | | | | | | by Active Support) Selecting which key extensions to include in active_support/rails made apparent the systematic usage of Object#in? in the code base. After some discussion in https://github.com/rails/rails/commit/5ea6b0df9a36d033f21b52049426257a4637028d we decided to remove it and use plain Ruby, which seems enough for this particular idiom. In this commit the refactor has been made case by case. Sometimes include? is the natural alternative, others a simple || is the way you actually spell the condition in your head, others a case statement seems more appropriate. I have chosen the one I liked the most in each case.
* Require thor 0.15.3 onwardsJosé Valim2012-06-181-0/+1
|
* Removing ==Examples and last blank lines of docs from railtiesFrancesco Rodriguez2012-05-141-3/+0
|
* added example, removed blank linesHrvoje Šimić2012-04-041-10/+0
|
* Usage file in generators shouldn't be fetched only based on source_rootPiotr Sarnacki2012-04-011-4/+17
| | | | | | | | In case `source_roout` is not set, `default_source_root` is used, which includes also `templates` directory. If there is no `templates` directory, `default_source_root` is not available and USAGE will not be displayed. USAGE should be also checked based on default directory excluding `templates`.
* Add convenience method to hide a generator from the available onesCarlos Antonio da Silva2012-02-031-0/+6
| | | | | | It is usually useful to be able to hide a generator when running rails generate command. Such generators might be used only to dry up generators code and shouldn't be available to end users.
* remove ruby 1.8 support codeSergey Nartimov2012-01-291-6/+2
|
* Fix rails/generators/base.rb documentation for hook_forPavel Gabriel2011-12-291-3/+3
|
* Doc fixes on Rails::Generators::Base.hook_for.Hendy Tanata2011-12-211-3/+3
|
* treat USAGE as an ERB templateColin MacKenzie IV2011-11-021-1/+1
|
* Fix rails/generators/base.rb documentation for generator lookupRyan Bigg2011-10-101-3/+3
|
* Removed warnings about shadowing variablesAlexey Gaziev2011-06-201-3/+3
|
* Made language consistent with the rest of the comments in the file.Aditya Sanghi2011-05-061-2/+2
|
* Remove `#among?` from Active SupportPrem Sichanugrist2011-04-131-1/+1
| | | | | | After a long list of discussion about the performance problem from using varargs and the reason that we can't find a great pair for it, it would be best to remove support for it for now. It will come back if we can find a good pair for it. For now, Bon Voyage, `#among?`.
* Change Object#either? to Object#among? -- thanks to @jamesarosen for the ↵David Heinemeier Hansson2011-04-121-1/+1
| | | | suggestion!
* Using Object#in? and Object#either? in various placesPrem Sichanugrist2011-04-111-1/+2
| | | | There're a lot of places in Rails source code which make a lot of sense to switching to Object#in? or Object#either? instead of using [].include?.
* Make sure the Thor generator LoadError does not output --dev twice [#6431 ↵Jeff Kreeftmeijer2011-02-271-1/+1
| | | | | | state:resolved] Signed-off-by: Santiago Pastorino <santiago@wyeworks.com>
* Make sure that generator's default banner is showing its namespacePrem Sichanugrist2011-01-011-1/+1
| | | | This will make `rails g rspec:install --help` shows "rails generate rspec:install [options]" and not "rails generate install [options]"
* Deletes trailing whitespaces (over text files only find * -type f -exec sed ↵Santiago Pastorino2010-08-141-1/+1
| | | | 's/[ \t]*$//' -i {} \;)