aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/generators
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Merge pull request #33229 from ↵Matthew Draper2018-07-253-5/+5
|\ \ \ | | | | | | | | | | | | | | | | albertoalmagro/albertoalmagro/prefer-rails-command-over-bin-rails Prefer rails command over bin/rails
| * | | Recommend use of rails over bin/railsAlberto Almagro2018-07-063-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As discussed in #33203 rails command already looks for, and runs, bin/rails if it is present. We were mixing recommendations within guides and USAGE guidelines, in some files we recommended using rails, in others bin/rails and in some cases we even had both options mixed together.
* | | | Rails guides are now served over httpsPaul McMahon2018-07-2412-13/+13
| |/ / |/| | | | | | | | | | | http links will be redirected to the https version, but still better to just directly link to the https version.
* | | Merge pull request #32984 from chiraggshah/min-thread-env-variableRichard Schneeman2018-07-211-2/+3
|\ \ \ | |/ / |/| | Separate min and max threads count environment variable for puma configuration
| * | Modified the changes to make it backward compatibleChirag Shah2018-07-211-1/+1
| | |
| * | Separate min and max threads count for pumaChirag Shah2018-05-251-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Same environment variable RAILS_MAX_THREADS was being used for setting the minimum and maximum thread count for puma. This change makes it obvious and easy to decide which environment variable to change for setting the min or max. Don't feel like this is a breaking change as the same default is maintained.
* | | Remove old TODO commentAlberto Almagro2018-07-041-1/+0
| | | | | | | | | | | | | | | This TODO comment has been here more than 7 years and doesn't seem to be a temporary implementation anymore.
* | | Merge pull request #32706 from ↵Kasper Timm Hansen2018-07-011-5/+9
|\ \ \ | |_|/ |/| | | | | | | | yhirano55/fix-app-update-when-hyphenated-name-is-given Fix app:update when hyphenated name is given
| * | Fix app:update when hyphenated name is givenYoshiyuki Hirano2018-04-241-5/+9
| | | | | | | | | | | | | | | | | | * Fixed app_name's difference between `rails new` and `app:update` * Changed be prefer to const name than directory name. * Kept original app name which use exception message.
* | | OS X -> macOS [Closes #30313]Xavier Noria2018-06-231-2/+2
| | | | | | | | | | | | [Jon Moss & Xavier Noria]
* | | Fix Ruby version in `.ruby-version`bogdanvlviv2018-06-181-1/+1
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since #30016 Rails generates `.ruby-version` file in order to help Ruby version manager tools like `rbenv`, `rvm` determine which Ruby version should be used for the current Rails project. Since #32649 Rails sets Ruby version to the file compatible with MRI/JRuby by default. Pull Request #31496 reports that `.ruby-version` doesn't match ruby version other than stable version and recommends to use `ENV["RBENV_VERSION"]`, and `ENV["rvm_ruby_string"]` in order to set correct Ruby version to the file that `rbenv` or `rvm` can understand. Also, there is another similar issue that reports the same case if use JRuby https://github.com/jruby/jruby/issues/5144. Closes #31496, https://github.com/jruby/jruby/issues/5144.
* | Merge pull request #30406 from eliotsykes/reduce-spring-watch-callsRafael Mendonça França2018-05-231-6/+6
|\ \ | | | | | | | | | Minimize Spring.watch calls
| * | Minimize Spring.watch callsEliot Sykes2017-08-251-6/+6
| | |
* | | Don't generate yarn's contents in `app:update` task if it's skippedTsukuru Tanimichi2018-05-161-3/+1
| | |
* | | Remove unused `remove_file` methodTsukuru Tanimichi2018-05-081-4/+0
| | | | | | | | | | | | | | | | | | In #32780, We have supported the `--skip-sprockets` option in the `app:update` task. When `options[:api]` is truthy, `option[:skip_sprockets]` is also truthy. So we can remove this `remove_file` method. https://github.com/rails/rails/blob/42b9e7e50c084e119a679cf155b70b5efc4d36ff/railties/lib/rails/generators/rails/app/app_generator.rb#L281-L283
* | | Don't generate assets' initializer in `app:update` task if sprockets is skippedTsukuru Tanimichi2018-05-051-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Execute `rails new myapp -S` and then upgrade the app by using the `app:update` task, `bin/rails c` results in `NoMethodError`. ``` $ bin/rails app:update $ bin/rails c Traceback (most recent call last): 44: from bin/rails:4:in `<main>' (snip) 1: from /Users/tanimichi.tsukuru/ghq/github.com/moneyforward/moneyplus/config/initializers/assets.rb:4:in `<top (required)>' /Users/tanimichi.tsukuru/ghq/github.com/moneyforward/moneyplus/vendor/bundle/ruby/2.5.0/gems/railties-5.2.0/lib/rails/railtie/configuration.rb:97:in `method_missing': undefined method `assets' for #<Rails::Application::Configuration:0x00007fcb8d3697e0> (NoMethodError) Did you mean? asset_host ```
* | | Merge pull request #32471 from janko-m/use-image_processing-gemGeorge Claghorn2018-04-231-1/+1
|\ \ \ | |_|/ |/| | Use ImageProcessing gem for ActiveStorage variants
| * | Use ImageProcessing gem for ActiveStorage variantsJanko Marohnić2018-04-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ImageProcessing gem is a wrapper around MiniMagick and ruby-vips, and implements an interface for common image resizing and processing. This is the canonical image processing gem recommended in [Shrine], and that's where it developed from. The initial implementation was extracted from Refile, which also implements on-the-fly transformations. Some features that ImageProcessing gem adds on top of MiniMagick: * resizing macros - #resize_to_limit - #resize_to_fit - #resize_to_fill - #resize_and_pad * automatic orientation * automatic thumbnail sharpening * avoids the complex and inefficient MiniMagick::Image class * will use "magick" instead of "convert" on ImageMagick 7 However, the biggest feature of the ImageProcessing gem is that it has an alternative implementation that uses libvips. Libvips is an alternative to ImageMagick that can process images very rapidly (we've seen up 10x faster than ImageMagick). What's great is that the ImageProcessing gem provides the same interface for both implementations. The macros are named the same, and the libvips implementation does auto orientation and thumbnail sharpening as well; only the operations/options specific to ImageMagick/libvips differ. The integration provided by this PR should work for both implementations. The plan is to introduce the ImageProcessing backend in Rails 6.0 as the default backend and deprecate the MiniMagick backend, then in Rails 6.1 remove the MiniMagick backend.
* | | Merge pull request #31554 from fatkodima/controller_generator_suffixGuillermo Iguaran2018-04-221-1/+11
|\ \ \ | | | | | | | | Gracefully handle extra "controller" when generating controller
| * | | Gracefully handle extra "controller" when generating controllerfatkodima2018-03-231-1/+11
| | | |
* | | | Strip duplicated suffixes more strictlyRyuta Kamizono2018-04-223-3/+3
| | | | | | | | | | | | | | | | In the previous code incorrectly removes intermediate words.
* | | | Fix duplicated suffix for JobGeneratorYoshiyuki Hirano2018-04-221-0/+5
| | | |
* | | | Don't include bootsnap by default in apps generated under JRubyGuillermo Iguaran2018-04-201-1/+1
| | | |
* | | | Create a .ruby-version compatible with MRI/JRuby by defaultGuillermo Iguaran2018-04-191-1/+1
| | | |
* | | | Make the master.key readable only by the ownerJose Luis Duran2018-04-191-0/+1
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change may only apply to POSIX-compliant systems. Previously: $ ls -l config/master.key -rw-r--r-- 1 owner group 32 Jan 1 00:00 master.key Now: $ ls -l config/master.key -rw------- 1 owner group 32 Jan 1 00:00 master.key
* | | Add .keep exception for storage folderPaul2018-04-131-1/+4
| | | | | | | | | Fixes https://github.com/rails/rails/issues/32546 by including the `.keep` file in the .gitignore, bringing the `storage` folder in line with the `tmp` and `log` folders.
* | | Remove upper bound on Capybaraeileencodes2018-04-101-1/+1
| | | | | | | | | | | | | | | | | | | | | There's no reason to block future versions of Capybara since we don't _know_ they are going to break. How will we know if we have a conservative option set? This change prevents us from blocking users who want to upgrade in the future.
* | | Add missing dots at the end of comments in environment file templatesbogdanvlviv2018-04-033-7/+7
| | | | | | | | | | | | Add dots in order to keep consistency between other comments in these files.
* | | Add `action_view.finalize_compiled_template_methods` config optionSimon Coffey2018-04-021-0/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ActionView::Template instances compile their source to methods on the ActionView::CompiledTemplates module. To prevent leaks in development mode, where templates can frequently change, a finalizer is added that undefines these methods[1] when the templates are garbage-collected. This is undesirable in the test environment, however, as templates don't change during the life of the test. Moreover, the cost of undefining a method is proportional to the number of descendants a class or module has, since the method cache must be cleared for all descendant classes. As ActionView::CompiledTemplates is mixed into every ActionView::TestCase (or in RSpec suites, every view spec example group), it can end up with a very large number of descendants, and undefining its methods can become very expensive. In large test suites, this results in a long delay at the end of the test suite as all template finalizers are run, only for the process to then exit. To avoid this unnecessary cost, this change adds a config option, `action_view.finalize_compiled_template_methods`, defaulting to true, and sets it to false in the test environment only. [1] https://github.com/rails/rails/blob/09b2348f7fc8d4e7191e70e06608c5909067e2aa/actionview/lib/action_view/template.rb#L118-L126
* | Support mysql2 0.4.x and 0.5.xAaron Stone2018-03-201-1/+1
| |
* | Remove path option from AzureStorage configYuji Yaginuma2018-03-131-1/+0
| | | | | | | | Follow up of 309bb6c4d068b0d480681cf4ef1b90158527dfe5
* | Allow Capybara 3.x (#32151)Thomas Walpole2018-03-051-1/+1
| |
* | Deprecate safe_level of `ERB.new` in Ruby 2.6Koichi ITO2018-03-051-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Summary In a Rails application using Ruby 2.6.0-dev, when running `bin/rails g migration` with `RUBYOPT=-w`, an ERB deprecation warnings will be displayed. ```console % ruby -v ruby 2.6.0dev (2018-03-03 trunk 62644) [x86_64-darwin17] % bin/rails -v Rails 6.0.0.alpha % RUBYOPT=-w bin/rails g migration create_foos (snip) /Users/koic/src/github.com/rails/rails/railties/lib/rails/generators/migration.rb:66: warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments. /Users/koic/src/github.com/rails/rails/railties/lib/rails/generators/migration.rb:66: warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead. /Users/koic/src/github.com/rails/rails/railties/lib/rails/generators/migration.rb:66: warning: Passing eoutvar with the 4th argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, eoutvar: ...) instead. create db/migrate/20180304002144_create_foos.rb ``` This PR suppresses the above deprecation warnings in Ruby 2.6.0-dev. This warning is due to the interface of `ERB.new` will change from Ruby 2.6. > Add :trim_mode and :eoutvar keyword arguments to ERB.new. > Now non-keyword arguments other than first one are softly deprecated > and will be removed when Ruby 2.5 becomes EOL. [Feature #14256] https://github.com/ruby/ruby/blob/2311087b685e8dc0f21f4a89875f25c22f5c39a9/NEWS#stdlib-updates-outstanding-ones-only The following addresses are related Ruby's commit. https://github.com/ruby/ruby/commit/cc777d0 Also this PR will change `ERB.new` used in `tasks/release.rb`. ### Other Information This PR uses `ERB.version` to switch `ERB.new` interface. Because Rails 6 supports multiple Ruby versions (Ruby 2.4.1 or higher), it need to use the appropriate interface. Using `ERB.version` instead of `RUBY_VERSON` is based on the following patch. https://github.com/ruby/ruby/pull/1826 This patch is built into Ruby. https://github.com/ruby/ruby/commit/40db89c0934c23d7464d47946bb682b9035411f9
* | Fix `new_framework_defaults_6_0.rb`bogdanvlviv2018-02-271-1/+1
| | | | | | | | | | | | | | | | | | `default_enforce_utf8` belongs to `config.action_view` Update info about `:skip_enforcing_utf8` since we can change default behavior via `config.action_controller.default_enforce_utf8` Related to #32125
* | Don't enforce UTF-8 by defaultAndrew White2018-02-273-31/+11
| | | | | | | | | | | | With the disabling of TLS 1.0 by most major websites, continuing to run IE8 or lower becomes increasingly difficult so default to not enforcing UTF-8 encoding as it's not relevant to other browsers.
* | [ci skip] Spell out the full variable in generated code.Kasper Timm Hansen2018-02-241-1/+1
| |
* | Correctly set `content_security_policy_nonce_generator`yuuji.yaginuma2018-02-241-1/+1
| | | | | | | | | | | | | | `content_security_policy_nonce_generator` specifies request as an argument when calling. https://github.com/rails/rails/blob/ddb7da8535b07f51b7a8f5e3062cc8ffbd4ff23b/actionpack/lib/action_dispatch/http/content_security_policy.rb#L100 So without this fix, will raise `ArgumentError` when start server.
* | Improve generated file `app/assets/javascripts/application.js` of pluginbogdanvlviv2018-02-231-0/+1
| | | | | | | | | | | | Add `//= require rails-ujs` Closes #32094
* | Improve generated file `app/views/application.html.erb` of pluginbogdanvlviv2018-02-231-1/+5
| | | | | | | | | | - Do not generate `javascript_include_tag` if `--skip-javascript` - Generate `<%= csp_meta_tag %>`. Related to #32018.
* | Comment `require "active_storage/engine"` in `bin/rails` of plugin if ↵bogdanvlviv2018-02-231-1/+1
| | | | | | | | `--skip-active-storage`
* | Merge pull request #32018 from rails/add-nonce-support-to-cspAndrew White2018-02-222-1/+5
|\ \ | | | | | | Add support for automatic nonce generation for Rails UJS
| * | Add support for automatic nonce generation for Rails UJSAndrew White2018-02-192-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Because the UJS library creates a script tag to process responses it normally requires the script-src attribute of the content security policy to include 'unsafe-inline'. To work around this we generate a per-request nonce value that is embedded in a meta tag in a similar fashion to how CSRF protection embeds its token in a meta tag. The UJS library can then read the nonce value and set it on the dynamically generated script tag to enable it to execute without needing 'unsafe-inline' enabled. Nonce generation isn't 100% safe - if your script tag is including user generated content in someway then it may be possible to exploit an XSS vulnerability which can take advantage of the nonce. It is however an improvement on a blanket permission for inline scripts. It is also possible to use the nonce within your own script tags by using `nonce: true` to set the nonce value on the tag, e.g <%= javascript_tag nonce: true do %> alert('Hello, World!'); <% end %> Fixes #31689.
* | | Do not add routes when actions are not specifiedYuji Yaginuma2018-02-221-0/+1
|/ / | | | | | | | | | | | | | | | | | | Since #30241, if namepsace is specified, routes will be generated even if there is no actions. However, it seems that this behavior is not intentionally added behavior. As with 5.1, routes should not be generated if actions are not specified. Fixes #32072.
* | Add stimulus to list of supported options for --webpackGuillermo Iguaran2018-02-181-1/+1
| |
* | Don't generate empty app/views folder when --api and --skip-action-mailer ↵Guillermo Iguaran2018-02-181-2/+6
| | | | | | | | | | | | | | are used together The purpose of keeping app/views folder in API apps is that it's used for mailer views so doesn't makes sense to keep it when Action Mailer is skipped.
* | Rails 6 requires Ruby 2.3+Jeremy Daer2018-02-172-11/+2
| |
* | Remove needless requiring 'active_support/core_ext/string/strip'Yoshiyuki Hirano2018-02-171-1/+0
| |
* | Remove usage of strip_heredoc in the framework in favor of <<~Rafael Mendonça França2018-02-1611-19/+19
| | | | | | | | | | 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.
* | Add test parallelization to Railseileencodes2018-02-151-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provides both a forked process and threaded parallelization options. To use add `parallelize` to your test suite. Takes a `workers` argument that controls how many times the process is forked. For each process a new database will be created suffixed with the worker number; test-database-0 and test-database-1 respectively. If `ENV["PARALLEL_WORKERS"]` is set the workers argument will be ignored and the environment variable will be used instead. This is useful for CI environments, or other environments where you may need more workers than you do for local testing. If the number of workers is set to `1` or fewer, the tests will not be parallelized. The default parallelization method is to fork processes. If you'd like to use threads instead you can pass `with: :threads` to the `parallelize` method. Note the threaded parallelization does not create multiple database and will not work with system tests at this time. parallelize(workers: 2, with: :threads) The threaded parallelization uses Minitest's parallel exector directly. The processes paralleliztion uses a Ruby Drb server. For parallelization via threads a setup hook and cleanup hook are provided. ``` class ActiveSupport::TestCase parallelize_setup do |worker| # setup databases end parallelize_teardown do |worker| # cleanup database end parallelize(workers: 2) end ``` [Eileen M. Uchitelle, Aaron Patterson]
* | Don't overwrite config/master.key even on --forceclaudiob2018-02-121-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | See https://github.com/rails/rails/pull/31957#issuecomment-364817423 The purpose of `--force` is not to have any prompt whether a file should be kept or overwritten. In general, all existing files should be overwritten. However, `config/master.key` is special because it is git-ignored, and overwriting it will cause the app not to run (since there won't be a way to decrypt the credentials). As a result, it's probably better to keep the existing config/master.key.