aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators/actions.rb
Commit message (Collapse)AuthorAgeFilesLines
* add github to template actions, light DSL refactorBarry Allard2018-08-301-15/+41
|
* 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
* Remove usage of strip_heredoc in the framework in favor of <<~Rafael Mendonça França2018-02-161-0/+2
| | | | | Some places we can't remove because Ruby still don't have a method equivalent to strip_heredoc to be called in an already existent string.
* Rails::Generators::Actions#execute_command allows option `capture`bogdanvlviv2017-11-061-1/+7
|
* Support multiple versions arguments for `gem` method of GeneratorsYoshiyuki Hirano2017-08-191-5/+10
|
* Fix format of generator docs [ci skip]Yoshiyuki Hirano2017-08-151-1/+1
|
* Merge pull request #30241 from yhirano55/optimize_routes_indentationRafael Mendonça França2017-08-141-1/+1
|\ | | | | | | Optimize routes indentation
| * Optimize routes indentationYoshiyuki Hirano2017-08-141-1/+1
| |
* | Adding frozen_string_literal pragma to Railties.Pat Allan2017-08-141-0/+2
|/
* Optimize indentation for generator actionsYoshiyuki Hirano2017-08-111-13/+28
|
* [ci skip] Fix rails_command commentsYoshiyuki Hirano2017-08-011-3/+3
|
* 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
|
* Deprecate an `capify!` method in generators and templatesyuuji.yaginuma2017-06-181-0/+1
| | | | | | | | | The `capify` command has been removed by Capistrano 3 and became to `cap install`. Therefore, the `capify!` method has no meaning in Capistrano 3. I think that should deprecate. Ref: https://github.com/capistrano/capistrano/commit/492793916acf32ffe1604daec6fd4892c8935018
* `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-5/+5
|
* use `Gem.win_platform?` to check windows Ruby platformsyuuji.yaginuma2016-11-301-2/+2
| | | | | `Gem.win_platform?` check if it is Windows more accurately. Ref: https://github.com/ruby/ruby/blob/ruby_2_2/lib/rubygems.rb#L945..L952
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-10/+10
|
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-1/+1
|
* applies new string literal convention in railties/libXavier Noria2016-08-061-5/+5
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* remove unused requireMohamad Abras2016-03-291-2/+0
|
* AppGenerator: allow both 'rake' and 'rails'claudiob2016-03-091-6/+21
| | | | | | | | | This commit comes from the comments made by @matthewd at https://github.com/rails/rails/pull/23795/files#r54469637 and by @rafaelfranca at https://github.com/rails/rails/pull/23795/files#r54609364 The idea is that if you type (for example) "rake db:migrate" in an AppGenerator, then this should actually invoke `rake db:migrate` on the command line, whereas if you type "rails_command db:migrate", this should invoke `rails db:migrate`.
* Invoke 'rails' instead of 'rake' in AppGeneratorclaudiob2016-02-201-1/+1
| | | | | Follows the convention from Rails 5 of invoking tasks on the command-line with `rails …` rather than `rake …`.
* AppGenerator: Replace 'rake' with 'rails_command'claudiob2016-02-201-0/+1
| | | | | | | | | | | Since Rails 5.0 is switching the Rails command line from 'rake …' to 'rails …', it makes sense to also replace the `rake` method in the Rails templates API. Based on feedback from @matthewd and @kaspth, I chose to replace `rake` with `rails_command`, which is less confusing than the alternatives `rails` or `command` or `rails_run` and is not Thor-reserved word like `task`.
* Rails::Generators::Actions#gem should work even if frozen string is passed ↵Prathamesh Sonpatki2016-01-241-1/+1
| | | | | | as argument - Fixes #23137.
* Fixes using `add_source` with a block after using `gem` in a custom railsWill Fisher2015-12-211-1/+1
| | | | generator template.
* Route generator should be idempotent - closes #22082Thiago Pinto2015-10-311-1/+1
|
* Change wrong usage in documentation about autoload_paths [ci skip]Mehmet Emin İNAÇ2015-07-021-2/+2
| | | | We can't use this configuration outside of the application.rb
* modify add_source in application template to take a block for gem entriesHirofumi Wakasugi2015-06-251-2/+16
|
* Add a new-line to the end of route method generated code.Arthur Neves2015-03-181-1/+1
| | | | | | | | Fix regression on route method that was added by bac812a7ef2660a2fe2ab00822e5e66228379822. The regression was that when calling the `route` method, we were not appending a \n anymore. [fixes #19316]
* Force generated route to be insertedAndrew White2015-02-051-1/+1
| | | | | | | Thor isn't very discerning over whether some content is present when passed to `inject_into_file`, e.g. a commented out route is detected as being present. So to prevent people scratching their heads as to why a route hasn't appeared it's better to fall on the side of having duplicate routes.
* Don't remove all line endings from routes.rbAndrew White2015-02-031-2/+2
| | | | | | | | | | | | When there is a single scaffold in the routes.rb with no other lines then revoking/destroying it will create a routes.rb file with a syntax error. This is because the sentinel for the Thor `route` action didn't include the newline but the logged route code did. The fix is to add the newline to the sentinel and remove it from the the logged route code. Fixes #15913.
* No need of requiring `rbconfig`, it is by-default loadedKuldeep Aggarwal2015-01-101-1/+0
|
* Pass symbol as an argument instead of a blockErik Michaels-Ober2014-11-291-1/+1
|
* Merge pull request #17302 from ↵Rafael Mendonça França2014-10-181-2/+2
| | | | | | claudiob/replace-slower-block-call-with-faster-yield Replace (slower) block.call with (faster) yield
* Revert "Replace (slower) block.call with (faster) yield"Zachary Scott2014-10-181-2/+2
| | | | This reverts commit 0ab075e75f58bf403f7ebe20546c7005f35db1f6.
* Replace (slower) block.call with (faster) yieldclaudiob2014-10-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Performance optimization: `yield` with an implicit `block` is faster than `block.call`. See http://youtu.be/fGFM_UrSp70?t=10m35s and the following benchmark: ```ruby require 'benchmark/ips' def fast yield end def slow(&block) block.call end Benchmark.ips do |x| x.report('fast') { fast{} } x.report('slow') { slow{} } end # => fast 154095 i/100ms # => slow 71454 i/100ms # => # => fast 7511067.8 (±5.0%) i/s - 37445085 in 4.999660s # => slow 1227576.9 (±6.8%) i/s - 6145044 in 5.028356s ```
* fix broken `gem` method with non-String arguments. Closes #16709.Yves Senn2014-08-271-4/+6
| | | | This was caused by #15327.
* Add an after_bundle callback in Rails templatesStefan Kanev2014-08-031-0/+11
| | | | | | The template runs before the generation of binstubs – this does not allow to write one, that makes an initial commit to version control. It is solvable by adding an after_bundle callback.
* Merge pull request #15327 from alexbel/replace_double_quotes_with_single_quotesYves Senn2014-05-271-4/+13
|\ | | | | | | Replace double quotes with single quotes while adding an entry into Gemfile
| * Replace double quotes with single quotes while adding an entry into Gemfilealexbel2014-05-261-4/+14
|/
* Replace map.flatten with flat_map in railtiesErik Michaels-Ober2014-03-041-1/+1
|
* Improve font of some code in API documentation [ci skip]Chun-wei Kuo2013-12-261-8/+8
| | | | | * Add "<tt>" or "+" to improve font of some code and filenames in API documentation * Does not contain wording changes
* Revert "Used Yield instead of block.call" -- this causes all of ↵David Heinemeier Hansson2013-11-141-2/+2
| | | | | | atom_feed_helper_test.rb to fail with "SystemStackError: stack level too deep". This reverts commit d3a1ce1cdc60d593de1682c5f4e3230c8db9a0fd.
* Used Yield instead of block.callKuldeep Aggarwal2013-11-151-2/+2
|
* Removing the app constant and replacing it with Rails.applicationwangjohn2013-04-301-1/+1
| | | | | syntax. This helps removing the class level abstraction of an application.
* Change default root route helperKohei Hasegawa2013-02-261-1/+1
|
* Initialize instance variable to remove warningCarlos Antonio da Silva2013-01-071-0/+4
| | | | actions.rb:34: warning: instance variable @in_group not initialized
* Introduce ./bin for your app's executables: bin/bundle, bin/rails, bin/rake. ↵Jeremy Kemper2013-01-061-1/+1
| | | | Executable scripts are versioned code like the rest of your app. To generate a stub for a bundled gem: 'bundle binstubs unicorn' and 'git add bin/unicorn'