Commit Graph

7075 Commits

Author SHA1 Message Date
Ryuta Kamizono
ad767034c9 Address all possible Performance/StartWith / Performance/EndWith violations
rubocop-performance v1.5.1 includes bug fixes for that cops.

https://github.com/rubocop-hq/rubocop-performance/releases/tag/v1.5.1
2019-11-14 03:20:29 +09:00
Kasper Timm Hansen
b2864a2069
Merge pull request #37595
Closes #37595
2019-11-10 20:13:37 +01:00
bogdanvlviv
3c58ec6db9
Improve docs of the load_defaults method [ci skip]
I changed `load_defaults` to `config.load_defaults` in the guide
to emphasize its context,
sorted headers "With 'x.x'" in descending and rephrased them
to "With 'x.x', it includes previous versions' new defaults"
and documented the method on https://api.rubyonrails.org.
2019-11-10 20:13:32 +01:00
y-yagi
aab73f1fa6
Merge pull request #37644 from ryan-robeson/fix-37543-generator-class-collision
Fix the collision check for the scaffold generator
2019-11-08 09:23:20 +09:00
Xavier Noria
43863bfc57 let environments configure load-related paths
Co-authored-by: Allen Hsu <allen.hsusp@gmail.com>
2019-11-06 20:40:39 +01:00
Tatsuya Hoshino
41f0fb8c6e Remove needless require "pp"
In Ruby 2.5 and later, `Kernel#pp` is automatically loaded.

https://bugs.ruby-lang.org/issues/14123

This changes remove the needless `require "pp"`.
2019-11-06 22:50:53 +09:00
Ryan Robeson
0d470fb0f1 Fix the collision check for the scaffold generator
Fixes #37543
2019-11-06 08:46:35 -05:00
yuuji.yaginuma
70013af6d9 Fix "warning: instance variable @db_config not initialized" 2019-11-04 20:48:31 +09:00
Brook Jordan
b62c42dd95
bin/yarn exec "yarn" rather than "yarnpkg"
### Issue
[`yarnpkg` has been deprecated](https://yarnpkg.com/en/package/yarnpkg) and not all installs alias to `yarnpkg` like homebrew does, (for example, `yvm`). This can be confusing, especially as web searches don't bring up information on this easily.

#### Additional context
The only reason I could find for still using `yarnpkg` over `yarn` is that debian used to not have `yarn` as an executable, while most other operating systems would alias `yarnpkg` to `yarn` for you. However, [the supported installation for debian appears to give a `yarn` executable now](https://yarnpkg.com/lang/en/docs/install/#debian-stable).
2019-10-25 10:44:02 +08:00
Gannon McGibbon
41bbd7cd0e
Merge pull request #37429 from gmcgibbon/opt_into_has_many_inverse
Opt into has many inverse
2019-10-15 13:15:39 -04:00
Eileen M. Uchitelle
4a699ccb66
Merge pull request #37443 from eileencodes/use-database-config-objects-in-railties-dbconsole
Use DatabaseConfig objects in dbconsole
2019-10-14 08:57:33 -04:00
Jonathan Hefner
0f782ca4fe Add .byebug_history to generated plugin .gitignore
The generated plugin Gemfile includes the Byebug gem (commented out), so
it makes sense to include the history file in the generated .gitignore.
2019-10-13 19:26:24 -04:00
Jonathan Hefner
4b1936ff4c Modernize generated plugin gemspec
This also makes the generated gemspec more closely resemble a gemspec
generated via the `bundle gem` command.
2019-10-13 19:18:41 -04:00
eileencodes
a843301a58 Use DatabaseConfig objects in dbconsole
We have these nice objects for collecting database configurations, so we
should use them everywhere instead of the hashes.

Also call `db_config.database` and `db_config.adapter` where necessary.

John Crepezzi <seejohnrun@github.com>
2019-10-11 17:15:21 -04:00
Gannon McGibbon
74201c3885 Make has_many inversing opt-in
Make has_many inversing support available through an opt-in config
variable. This behaviour is likely to break existing applications, but
it is correct behaviour.
2019-10-11 15:55:46 -04:00
Josh Brody
1dd2b73cb2 Generators skip collision check if force option is passed. 2019-10-08 19:07:38 -05:00
John Hawthorn
f54a906586
Merge pull request #37357 from jhawthorn/backtrace_relative_paths
Don't modify relative ./ paths in BacktraceCleaner
2019-10-07 11:57:17 -07:00
Rafael França
99d12b9507
Merge pull request #37313 from Shopify/block-assertions
Implicitly assert no exception is raised in block assertions
2019-10-07 13:41:37 -04:00
Eileen M. Uchitelle
921b55d300
Merge pull request #37390 from eileencodes/change-comment-in-controller-generator
Update comment in controller generators
2019-10-07 10:11:20 -04:00
eileencodes
47bfe718d7 Update comment in controller generators
In #33681 we stopped using "whitelist" in Rails in favor of
allowed/trusted. I found this because jbuilder is using old text from
2013 but noticed this still uses "white list". I think the new comment
is a bit clearer as well.
2019-10-07 09:19:05 -04:00
Jean Boussier
a707072ffa Implicitly assert no exception is raised in block assertions 2019-10-07 11:01:24 +02:00
Kasper Timm Hansen
e2d4d6b1e1
Merge pull request #37268 from jonathanhefner/dummy-app-dynamic-rails-version
Use dynamic Rails version in plugin dummy apps
2019-10-07 02:58:48 +02:00
Kasper Timm Hansen
eca6c273fe
[ci skip] switch eg. to proper e.g. 2019-10-07 02:18:36 +02:00
John Hawthorn
dd5cbf58ed Don't modify relative ./ paths in BacktraceCleaner
Previously a path starting with ./ would be replaced to start with /.
IMO this didn't particularly make sense since / reads as though it's
from the root of the filesystem.

This commit removes that filter, preserves ./, and updates the silencer
not to remove lines starting with ./
2019-10-03 14:06:58 -07:00
John Hawthorn
9a959a0c45 Avoid string allocations in BacktraceCleaner
Our backtraces tend to be fairly large so this operates over quite a few
strings.

Previously, each filter would call `String#sub`, which always returns a
new string object, and uses a new string buffer any time it modifies the
string.

String#slice allows Ruby to share the same internal string buffer, which
should be faster and use less memory. In cases where changes aren't
necessary we can also reuse the same string object.

This should not change behaviour except for the last filter which
changes from sub(/\.\//, "") to sub(/\A\.\//, ""), which I think was the
original intention.
2019-10-03 13:10:47 -07:00
Josh Goodall
d0e813fc12 Document Arel.sql 2019-09-26 19:37:42 -04:00
John Hawthorn
02ecdf61d1
Merge pull request #37216 from jhawthorn/avoid_file_watcher
Avoid setting up file watcher on cache_classes
2019-09-25 10:53:33 -07:00
Xavier Noria
63a791c097 remove spurious trailing commas from zeitwerk:check error messages
Since the original message is something like this

    expected file ... to define constant A, but didn't

the \S+ captured the comma. A constant name goes there, so [\w:]+ is
enough and won't match the comma.
2019-09-25 00:41:39 +02:00
Xavier Noria
ac193d0cc3 actual fix for #37285 2019-09-25 00:27:18 +02:00
Xavier Noria
3ac9e22c12 let zeitwerk:check report files outside the root directory with absolute paths
This may happen in engines loaded as gems, for example.

Closes #37285.
2019-09-24 10:27:18 +02:00
Jonathan Hefner
aeda78bb21 Use dynamic Rails version in plugin dummy apps
It is common to test Rails plugins with multiple versions of Rails.
When doing so, it's preferable that the dummy app be configured like an
actual Rails app would be, which includes loading version-appropriate
defaults.  Additionally, using a dynamic version number eliminates
transient warnings that occur when testing newer versions of Rails with
older configuration defaults.
2019-09-22 13:24:59 -05:00
Nobuyoshi Nakada
477e71b6b6
Reduce stat(2) calls
`File.file?` and other predicates for permissions can use same
stat(2) call result.
2019-09-22 18:23:09 +09:00
David Rodríguez
a06a734da8
Don't load environment in rake command
While generating an application with the `--skip-webpack-install` flag,
and then running `rails -h` on the generated application, I got the
crash listed below.

I was suprised that Rails would load the full application environment
just for the help command, so I located where the environment was being
loaded and stopped loading it.

It fixed the error and didn't break any tests, so it's probably not
necessary?

This is the backtrace for the error:

```
$ rails -h
The most common rails commands are:
 generate     Generate new code (short-cut alias: "g")
 console      Start the Rails console (short-cut alias: "c")
 server       Start the Rails server (short-cut alias: "s")
 test         Run tests except system tests (short-cut alias: "t")
 test:system  Run system tests
 dbconsole    Start a console for the database specified in config/database.yml
              (short-cut alias: "db")

 new          Create a new Rails application. "rails new my_app" creates a
              new application called MyApp in "./my_app"

All commands can be run with -h (or --help) for more information.
In addition to those commands, there are:

RAILS_ENV=development environment is not defined in config/webpacker.yml, falling back to production environment
Traceback (most recent call last):
	74: from bin/rails:3:in `<main>'
	73: from bin/rails:3:in `load'
	72: from /home/deivid/Code/playground/testapp/bin/spring:15:in `<top (required)>'
	71: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	70: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	69: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
	68: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
	67: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
	66: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
	65: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
	64: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
	63: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
	62: from /home/deivid/Code/playground/testapp/bin/rails:9:in `<top (required)>'
	61: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
	60: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
	59: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
	58: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	57: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
	56: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
	55: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
	54: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
	53: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/commands.rb:18:in `<main>'
	52: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/command.rb:46:in `invoke'
	51: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/command/base.rb:65:in `perform'
	50: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
	49: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
	48: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
	47: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/commands/help/help_command.rb:11:in `help'
	46: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/command.rb:86:in `print_commands'
	45: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/command.rb:96:in `commands'
	44: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/command.rb:96:in `flat_map'
	43: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/command.rb:96:in `each'
	42: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/commands/rake/rake_command.rb:12:in `printing_commands'
	41: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/commands/rake/rake_command.rb:42:in `formatted_rake_tasks'
	40: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/commands/rake/rake_command.rb:33:in `rake_tasks'
	39: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
	38: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/command/actions.rb:28:in `require_environment!'
	37: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/application.rb:339:in `require_environment!'
	36: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
	35: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
	34: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
	33: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/kernel.rb:23:in `require'
	32: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	31: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
	30: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
	29: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
	28: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
	27: from /home/deivid/Code/playground/testapp/config/environment.rb:5:in `<main>'
	26: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/application.rb:363:in `initialize!'
	25: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:60:in `run_initializers'
	24: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
	23: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
	22: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
	21: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:347:in `call'
	20: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:347:in `each'
	19: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
	18: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
	17: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	16: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
	15: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:61:in `block in run_initializers'
	14: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `run'
	13: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `instance_exec'
	12: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/railtie.rb:84:in `block in <class:Engine>'
	11: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker.rb:27:in `bootstrap'
	10: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/commands.rb:14:in `bootstrap'
	 9: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/manifest.rb:18:in `refresh'
	 8: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/manifest.rb:83:in `load'
	 7: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:47:in `public_manifest_path'
	 6: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:43:in `public_output_path'
	 5: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:39:in `public_path'
	 4: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:80:in `fetch'
	 3: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:84:in `data'
	 2: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:88:in `load'
	 1: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:88:in `read'
/home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:88:in `read': No such file or directory @ rb_sysopen - /home/deivid/Code/playground/testapp/config/webpacker.yml (Errno::ENOENT)
	73: from bin/rails:3:in `<main>'
	72: from bin/rails:3:in `load'
	71: from /home/deivid/Code/playground/testapp/bin/spring:15:in `<top (required)>'
	70: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	69: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
	68: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `<top (required)>'
	67: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/binstub.rb:11:in `load'
	66: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/spring-2.1.0/bin/spring:49:in `<top (required)>'
	65: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/client.rb:30:in `run'
	64: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/client/command.rb:7:in `call'
	63: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `call'
	62: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/spring-2.1.0/lib/spring/client/rails.rb:28:in `load'
	61: from /home/deivid/Code/playground/testapp/bin/rails:9:in `<top (required)>'
	60: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
	59: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
	58: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
	57: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	56: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
	55: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
	54: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
	53: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
	52: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/commands.rb:18:in `<main>'
	51: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/command.rb:46:in `invoke'
	50: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/command/base.rb:65:in `perform'
	49: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
	48: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
	47: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
	46: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/commands/help/help_command.rb:11:in `help'
	45: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/command.rb:86:in `print_commands'
	44: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/command.rb:96:in `commands'
	43: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/command.rb:96:in `flat_map'
	42: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/command.rb:96:in `each'
	41: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/commands/rake/rake_command.rb:12:in `printing_commands'
	40: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/commands/rake/rake_command.rb:42:in `formatted_rake_tasks'
	39: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/commands/rake/rake_command.rb:33:in `rake_tasks'
	38: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
	37: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/command/actions.rb:28:in `require_environment!'
	36: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/application.rb:339:in `require_environment!'
	35: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `require'
	34: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:291:in `load_dependency'
	33: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0/lib/active_support/dependencies.rb:325:in `block in require'
	32: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/zeitwerk-2.1.10/lib/zeitwerk/kernel.rb:23:in `require'
	31: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
	30: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
	29: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
	28: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
	27: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.5/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
	26: from /home/deivid/Code/playground/testapp/config/environment.rb:5:in `<main>'
	25: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/application.rb:363:in `initialize!'
	24: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:60:in `run_initializers'
	23: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
	22: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
	21: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
	20: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:347:in `call'
	19: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:347:in `each'
	18: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
	17: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
	16: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
	15: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
	14: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:61:in `block in run_initializers'
	13: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `run'
	12: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/railties-6.0.0/lib/rails/initializable.rb:32:in `instance_exec'
	11: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/railtie.rb:84:in `block in <class:Engine>'
	10: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker.rb:27:in `bootstrap'
	 9: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/commands.rb:14:in `bootstrap'
	 8: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/manifest.rb:18:in `refresh'
	 7: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/manifest.rb:83:in `load'
	 6: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:47:in `public_manifest_path'
	 5: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:43:in `public_output_path'
	 4: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:39:in `public_path'
	 3: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:80:in `fetch'
	 2: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:84:in `data'
	 1: from /home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:87:in `load'
/home/deivid/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/configuration.rb:91:in `rescue in load': Webpacker configuration file not found /home/deivid/Code/playground/testapp/config/webpacker.yml. Please run rails webpacker:install Error: No such file or directory @ rb_sysopen - /home/deivid/Code/playground/testapp/config/webpacker.yml (RuntimeError)
```
2019-09-20 22:37:47 +02:00
John Hawthorn
f8cbd3d5bd Avoid setting up file watcher on cache_classes
Previously, if cache_classes was true we would build a file_watcher and
add it to reloaders though it would never be used. This wasted some
memory for FileUpdateChecker to maintain an array of all watched files,
and added slightly to boot time.

Instead we should avoid building a file watcher it when cache_classes is
true.
2019-09-16 11:16:50 -07:00
Eileen M. Uchitelle
42dea6b0f6
Merge pull request #37185 from seejohnrun/config-symbols
Use symbols everywhere for database configurations
2019-09-13 13:03:11 -04:00
eileencodes
ce9b197cc9 Use symbols everywhere for database configurations
Previously in some places we used symbol keys, and in some places we used
string keys. That made it pretty confusing to figure out in a particular
place what type of configuration object you were working with.

Now internally, all configuration hashes are keyed by symbols and
converted to such on the way in.

A few exceptions:

- `DatabaseConfigurations#to_h` still returns strings for backward compatibility
- Same for `legacy_hash`
- `default_hash` previously could return strings, but the associated
  comment mentions it returns symbol-key `Hash` and now it always does

Because this is a change in behavior, a few method renames have happened:

- `DatabaseConfig#config` is now `DatabaseConfig#configuration_hash` and returns a symbol-key `Hash`
- `ConnectionSpecification#config` is now `ConnectionSpecification#underlying_configuration_hash` and returns the `Hash` of the underlying `DatabaseConfig`
- `DatabaseConfig#config` was added back, returns `String`-keys for backward compatibility, and is deprecated in favor of the new `configuration_hash`

Co-authored-by: eileencodes <eileencodes@gmail.com>
2019-09-13 08:53:22 -04:00
Ryuta Kamizono
4674d77764 Required mysql2 gem 0.5.0
This follows up #36692, `Mysql2::Error::TimeoutError` is introduced from
mysql2 gem 0.5.0. https://github.com/brianmario/mysql2/pull/911
2019-09-13 11:15:44 +09:00
yuuji.yaginuma
b5949f7f12 Fix credentials:diff option
The option name is `enroll` since f1f5024b918ecf303b9908f78d1a6136d9418730.
2019-09-12 17:00:36 +09:00
yuuji.yaginuma
161e622cf2 Bump Capybara require version
System tests depend on Capybara 3.26 or newer. Ref: #36615.
2019-09-06 10:43:48 +09:00
yuuji.yaginuma
1ccc407e9d Fix document formatting of Rails.group [ci skip] 2019-09-05 19:00:20 +09:00
Jean Boussier
86a28b1f8e Safer example in Rails::Railtie documentation 2019-09-04 12:18:24 +02:00
Takayuki Nakata
aeb59dd9d3 Fix href to replace http with https in the Yay! You’re on Rails! page 2019-09-03 09:43:29 +09:00
y-yagi
ef4bf83a1b
Merge pull request #37102 from y-yagi/fixes_37011
Correctly classify the files and directories that pass to watcher
2019-09-03 07:57:41 +09:00
Stefan Wrobel
b9689aefe5 Add title tag to mailer previews 2019-09-02 14:44:46 -07:00
yuuji.yaginuma
81befcf267 Correctly classify the files and directories that pass to watcher
Currently, autoload paths pass to the watcher as directories. If using evented
watcher, this possibly pass as it is to `Listen`.
But autoload paths include files and `Listen` raise an error when was passed
file. So, it is necessary to classify files and directories correctly.

Fixes #37011.
2019-09-02 11:22:39 +09:00
Carlos Antonio da Silva
1f325fab01
Merge pull request #37053 from yahonda/ignore_sqlite3_parallel_testing_databases
Ignore SQLite3 database files generated by parallel testing
2019-08-27 09:15:58 -03:00
Yasuo Honda
c5e3c537a4 Ignore SQLite3 database files generated by parallel testing
Rails 6.0 introduces parallel testing and the default degree of parallelism is configured based on the number of CPU.
refer https://github.com/rails/rails/pull/34735 https://github.com/rails/rails/pull/31900

When any minitest executed under the OS where 2 or more CPU available,
SQLite 3 database files are not git-ignored.

Also updated other files which ignores SQLite database files.

* Steps to reproduce

```
$ git clone https://github.com/yahonda/rep_ignore_sqlite3_databases.git
$ cd rep_ignore_sqlite3_databases/
$ bin/rails test
$ git status
```

* Expected behavior:

- No `Untracked files:`

* Actual behavior:

- SQLite 3 database files appeared

```
$ git status
On branch master
Untracked files:
  (use "git add <file>..." to include in what will be committed)

	db/test.sqlite3-0
	db/test.sqlite3-1
	db/test.sqlite3-2
	db/test.sqlite3-3
	db/test.sqlite3-4
	db/test.sqlite3-5

nothing added to commit but untracked files present (use "git add" to track)
$
```
2019-08-27 11:42:04 +00:00
Kasper Timm Hansen
f73093bcdf
Merge pull request #37032 from ttakuru88/remove-whitespace
Remove whitespace in config/environments/test.rb
2019-08-24 22:22:27 +02:00
ttakuru88
fd2853715d
Remove whitespace in environments/test.rb 2019-08-24 15:50:59 +09:00
danglduy
b2f3a8af6c
Update rails js packages to official version
Update rails js packages to official version instead of alpha version
2019-08-22 14:19:52 +07:00
Carlos Antonio da Silva
2a3f759eef Generate new apps with latest puma version 2019-08-21 08:41:41 -03:00
Rafael Mendonça França
04cfbc807f
Generate keep file in tmp/pids
Since 9c913116c634fe5fe2159a94b8f1a244801a4877, if you run `rackup`
in a machine that doesn't have that folder, the server will not start.

This doesn't happen on `rails s` because we create that folder when
starting the server on
8c8b02784a/railties/lib/rails/commands/server/server_command.rb (L70-L74).
2019-08-19 16:53:01 -04:00
Adam Renberg Tamm
af8751fcf8 Fix minor typo in rails/engine docs [ci skip] 2019-08-19 14:26:53 +02:00
utilum
271601ff65 constant Gem::RubyGemsVersion is deprecated
As of ruby/ruby@c4f7c260f9.

```
~/code/rails$ ruby -v
ruby 2.7.0dev (2019-08-17T03:32:34Z master dc020b06ff) [x86_64-linux]

/home/u/.rbenv/versions/2.7.0-dev/bin/ruby -w -Itest -Ilib
-I../activesupport/lib -I../actionpack/lib -I../actionview/lib
-I../activemodel/lib test/rails_info_controller_test.rb
/home/u/code/rails/railties/lib/rails/info.rb:71: warning: constant
Gem::RubyGemsVersion is deprecated

/home/u/.rbenv/versions/2.7.0-dev/bin/ruby -w -Itest -Ilib
-I../activesupport/lib -I../actionpack/lib -I../actionview/lib
-I../activemodel/lib test/rails_info_test.rb
/home/u/code/rails/railties/lib/rails/info.rb:71: warning: constant
Gem::RubyGemsVersion is deprecated

/home/u/.rbenv/versions/2.7.0-dev/bin/ruby -w -Itest -Ilib
-I../activesupport/lib -I../actionpack/lib -I../actionview/lib
-I../activemodel/lib test/application/routing_test.rb
Run options: --seed 26063

....../home/u/code/rails/railties/lib/rails/info.rb:71: warning:
constant Gem::RubyGemsVersion is deprecated
.................../home/u/code/rails/railties/lib/rails/info.rb:71:
warning: constant Gem::RubyGemsVersion is deprecated
.

```
2019-08-17 18:41:56 +02:00
Rafael Mendonça França
1953e0e1ac
Support Rails with sass-rails 6 2019-08-16 18:33:29 -04:00
Rafael França
4614848564
Merge pull request #36946 from eugeneius/return_only_media_type_on_content_type_new_default
Fix new default value for return_only_media_type_on_content_type
2019-08-15 20:26:19 -04:00
Ben Sheldon [he/him]
0c28bddf40
Remove lonely alignment whitespace from Puma config 2019-08-15 16:25:24 -07:00
Rafael França
9ad68a4cf1
Merge pull request #36803 from andrewkress/fix-issue-36799
read webpacker config to populate autoload paths
2019-08-15 18:53:47 -04:00
Eugene Kenny
582401ad73 Fix new default value for return_only_media_type_on_content_type
Uncommenting this line should opt applications in to the new behaviour;
in this case, `false` is the value needed to do that. This is the value
set when `config.load_defaults 6.0` is called:

5a4305f0ec/railties/lib/rails/application/configuration.rb (L133)
2019-08-15 21:09:41 +01:00
Andrew Kress
61c5a14cab rename to javascript_path, make attr_accessor 2019-08-14 12:36:27 -05:00
Andrew Kress
ffaee477bd create an attribute so that webpacker can set its default path instead of hardcoding 2019-08-13 15:20:59 -05:00
Xavier Noria
5a70f33909 defines Rails.autoloaders.log! 2019-08-13 18:14:50 +02:00
yuuji.yaginuma
6170a2a502 Remove feature policy initializer in API only apps
Because `FeaturePolicy::Middleware` is not loaded in API only apps.
Ref: 646dd8c51f/railties/lib/rails/application/default_middleware_stack.rb (L69-L72)
2019-08-08 17:47:07 +09:00
Kasper Timm Hansen
f1f5024b91
Revise flow to what was described in 03e44f9 2019-08-04 02:19:55 +02:00
Kasper Timm Hansen
03e44f9300
Revise credentials diffing flow to use a separate diff command
Didn't like the complicated stuff that happened on credentials:edit. It
would append to .gitattributes multiple times. Though I see why it was
written that way.

I'm cutting off for now, but since this new flow would require each developer
to run --enable perhaps this should really be:

1. Developer enrolls Rails app by running `credentials:diff --enable`
2. credentials:edit checks .gitattributes for `diff=rails_credentials` and
   if the current file is covered by that.
3. If so, set up the "rails_credentials" driver automatically.
2019-08-04 01:32:41 +02:00
Kasper Timm Hansen
6db2c426c0
Extract diffing to separate credentials:diff command 2019-08-04 00:00:16 +02:00
Kasper Timm Hansen
b4112f45b3
Commands already make fileutils available. 2019-08-03 23:19:14 +02:00
Kasper Timm Hansen
af2880bdda
Rename to Diffing and move module into credentials command
Helpers is more for sharing between commands. Since `Diffing` is only
for credentials we should just keep it only for credentials.

Replaces "pretty" with diffing since the former is ambiguous, while
diffing captures what it does. `opt_in` seemed clunky so it's swapped
for the one-word enable.
2019-08-03 23:06:47 +02:00
Rafael Mendonça França
1c7207a22f
1.hour needs core_ext to work
Usually the application requires the entire active support at load time
but the configuration happens before it is loaded. For that reason we
need to require the core_ext that we want to use in this file.
2019-08-02 15:02:59 -04:00
Daniel Colson
159a121044
Remove duplicate method definition
no_color! is already defined in [`Rails::Command::Behavior`][behavior],
which gets [included into `Rails:Generators`][include]. This duplication
came about in 6813edc7d9 when we introduced the Thor command structure.

We have [test coverage][] to ensure this method still behaves correctly
on `Rails:Generators`.

[behavior]: f7e91c7224/railties/lib/rails/command/behavior.rb (L12-L14)
[include]: f7e91c7224/railties/lib/rails/generators.rb (L18)
[test coverage]: f7e91c7224/railties/test/generators_test.rb (L163-L168)
2019-08-01 17:42:44 -04:00
Akira Matsuda
530f7805ed It may be better to explicitly require 'object/try' where we call try
In most cases it works now without explicit require because it's accidentally required through
active_support/core_ext/date_and_time/calculations.rb where we still call `try`,
but that would stop working if we changed the Calculations implementation and remove the require call there.
2019-08-01 18:51:51 +09:00
Ryuta Kamizono
4c8c8c87b0 Address to rubocop offences 2019-07-31 17:48:14 +09:00
meganemura
718c9e5e7f Remove redundant empty line when we don't use system test 2019-07-29 19:11:27 +09:00
Akira Matsuda
0196551e60 Use match? where we don't need MatchData 2019-07-29 14:23:10 +09:00
Akira Matsuda
0d981a2b3d Let the generated initializers/backtrace_silencers.rb code use Regexp#match? 2019-07-29 14:21:30 +09:00
Lachlan Campbell
f1cfe1ee70 Add viewport meta tag to default application template 2019-07-28 19:49:53 -04:00
Akira Matsuda
d1ffe59ab5 Use match? where we don't need MatchData
We're already running Performance/RegexpMatch cop, but it seems like the cop is not always =~ justice
2019-07-27 13:06:49 +09:00
Rafael França
ea4305109e
Merge pull request #36777 from Edouard-chin/ec-git-pretty-credentials
Prettify diff generated by git for encrypted file:
2019-07-26 14:18:14 -04:00
Edouard CHIN
5a4acf7ac4 Prettify diff generated by git for encripted file:
- @sinsoku had the idea and started implementing it few months ago
  but sadly didn't finish it.
  This PR is taking over his work.

  The credentials feature has changed a lot since @sinsoku opened hi
  PR, it was easier to just restart from scratch instead of checking
  out his branch.
  Sinsoku will get all the credit he deserves for this idea :)

  TL;DR on that that feature is to make the `git diff` or `git log`
  of encrypted files to be readable.

  The previous implementation was only setting up the git required
  configuration for the first time Rails was bootstraped, so I decided
  to instead provide the user a choice to opt-in for readable diff
  credential whenever a user types the `bin/rails credentials:edit`
  command.
  The question won't be asked in the future the user has already
  answered or if the user already opted in.

  Co-authored-by: Takumi Shotoku <insoku.listy@gmail.com>
2019-07-26 16:28:51 +02:00
y-yagi
65dcc9d159
Merge pull request #36747 from y-yagi/add_mention_about_collection_cache_versioning
Add mention about `active_record.collection_cache_versioning` to the `new_framework_defaults.rb`
2019-07-26 10:24:52 +09:00
John Hawthorn
d45507b931
Merge pull request #36731 from jhawthorn/dir_glob_base_instead_of_chdir
Use Dir.glob(base: ...) to avoid chdir
2019-07-25 16:31:08 -07:00
Andrew Kress
7f21e04e61 read configuration to determine excluded eager loaded directory (#36354)
* read config/webpacker.yml to determine which path to exclude for zeitwerk:check

* fix test errors

* more changes to fix test errors

* refactor webpacker_path

[Andrew Kress + Rafael Mendonça França]
2019-07-25 17:10:59 -04:00
Rafael França
0744e15a35
Merge pull request #34218 from eliotsykes/filter-common-sensitive-params
Add common sensitive names to generated filter parameters
2019-07-24 14:24:19 -04:00
yuuji.yaginuma
13e43a10bd Add mention about active_record.collection_cache_versioning to the new_framework_defaults.rb
All other recommended new configurations that set in `load_defaults` are
already mentioned in `new_framework_defaults.rb`.
So `active_record.collection_cache_versioning` should also be mentioned.
2019-07-24 20:00:25 +09:00
Rafael França
9c913116c6
Merge pull request #36542 from spk/add-pidfile-option-to-puma-conf
Add pidfile option to puma config template
2019-07-23 10:45:34 -04:00
John Hawthorn
13b2ca2031 Use Dir.glob(base: ...) to avoid chdir 2019-07-22 14:40:51 -07:00
Edouard CHIN
426d2f2502 Move the deprecation call after the new class has been defined:
- If we create the deprecation before the new class is defined this
  creates an issue in case you use a `TracePoint`. The
  `Tracepoint#return_value` will try to get the new class constant
  resulting in a uninitialized constant Rails::SourceAnnotationExtractor

  The problem can be reproduced like this:

  ```ruby
  @defined = Set.new

  ANONYMOUS_CLASS_DEFINITION_TRACEPOINT = TracePoint.new(:c_return) do |tp|
    next unless @defined.add?(tp.return_value)
  end

  ANONYMOUS_CLASS_DEFINITION_TRACEPOINT.enable

  require 'rails'
  require "rails/source_annotation_extractor"
  ```
2019-07-22 15:27:17 +02:00
masakazutakewaka
386c116fb4 create a newline between blocks when gem_group, github and add_source was called. 2019-07-21 21:04:01 -07:00
y-yagi
a390001bbe
Merge pull request #35285 from masakazutakewaka/fix_railtie_add_newline_to_gemfile_insertion
Add a newline at the end of a Gemfile when it doesn't end with a newline
2019-07-21 08:24:19 +09:00
George Claghorn
400b210354
Preserve existing attachment assignment behavior for upgraded apps
Assigning to a collection of attachments appends rather than replacing, as in 5.2. Existing 5.2 apps that rely on this behavior will no longer break when they're upgraded to 6.0.

For apps generated on 6.0 or newer, assigning replaces the existing attachments in the collection. #attach should be used to add new attachments to the collection without removing existing ones.

I expect that we'll deprecate the old behavior in 6.1.

Closes #36374.
2019-07-20 06:33:11 -04:00
masakazutakewaka
9147b284b6 Append a newline to the Gemfile if it doesn't end with a newline 2019-07-19 22:07:48 -07:00
Yuji Yaginuma
c5a24c8ebb
Merge pull request #36603 from y-yagi/add_skip_collision_check_option
Add `skip-collision-check` option to generator
2019-07-18 07:17:47 +09:00
Eileen M. Uchitelle
79ef8310be
Merge pull request #36663 from igor04/load_database_yaml_fix
Prevent exception of loading database yaml with blank config file
2019-07-15 09:11:36 -04:00
Jacob Bednarz
6c5acd5bc1
Use reserved domain for example configuration
Updates the generator output to use a reserved domain[1] instead of a
potentially real world domain.

[1]: https://tools.ietf.org/html/rfc2606#section-3
2019-07-15 08:16:51 +10:00
Xavier Noria
938d18d09a improves zeitwerk:check 2019-07-12 23:44:44 +02:00
igor04
0fa41f72fc Prevent exception of loading database yaml with blank config file [closes: #36661] 2019-07-12 19:23:09 +03:00
Xavier Noria
43ae74f6f6 make sure zeitwerk:check only deals with directories [closes #36461] 2019-07-12 18:11:58 +02:00
Akira Matsuda
84e21165a8 active_support/dependencies/autoload is already required via active_support.rb 2019-07-12 18:30:58 +09:00
Akira Matsuda
46ac8aceb3 These are already required via rails/command.rb 2019-07-12 18:28:53 +09:00
Jacob Bednarz
bf19b8774e Adds support for configuring HTTP Feature Policy (#33439)
A HTTP feature policy is Yet Another HTTP header for instructing the
browser about which features the application intends to make use of and
to lock down access to others. This is a new security mechanism that
ensures that should an application become compromised or a third party
attempts an unexpected action, the browser will override it and maintain
the intended UX.

WICG specification: https://wicg.github.io/feature-policy/

The end result is a HTTP header that looks like the following:

```
Feature-Policy: geolocation 'none'; autoplay https://example.com
```

This will prevent the browser from using geolocation and only allow
autoplay on `https://example.com`. Full feature list can be found over
in the WICG repository[1].

As of today Chrome and Safari have public support[2] for this
functionality with Firefox working on support[3] and Edge still pending
acceptance of the suggestion[4].

#### Examples

Using an initializer

```rb
# config/initializers/feature_policy.rb
Rails.application.config.feature_policy do |f|
  f.geolocation :none
  f.camera      :none
  f.payment     "https://secure.example.com"
  f.fullscreen  :self
end
```

In a controller

```rb
class SampleController < ApplicationController
  def index
    feature_policy do |f|
      f.geolocation "https://example.com"
    end
  end
end
```

Some of you might realise that the HTTP feature policy looks pretty
close to that of a Content Security Policy; and you're right. So much so
that I used the Content Security Policy DSL from #31162 as the starting
point for this change.

This change *doesn't* introduce support for defining a feature policy on
an iframe and this has been intentionally done to split the HTTP header
and the HTML element (`iframe`) support. If this is successful, I'll
look to add that on it's own.

Full documentation on HTTP feature policies can be found at
https://wicg.github.io/feature-policy/. Google have also published[5] a
great in-depth write up of this functionality.

[1]: https://github.com/WICG/feature-policy/blob/master/features.md
[2]: https://www.chromestatus.com/feature/5694225681219584
[3]: https://bugzilla.mozilla.org/show_bug.cgi?id=1390801
[4]: https://wpdev.uservoice.com/forums/257854-microsoft-edge-developer/suggestions/33507907-support-feature-policy
[5]: https://developers.google.com/web/updates/2018/06/feature-policy
2019-07-10 15:33:15 -07:00
yuuji.yaginuma
6fec4c3a0a Add skip-collision-check option to generator
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.
2019-07-05 18:55:47 +09:00
Yuji Yaginuma
141b30630c
Merge pull request #36534 from y-yagi/fixes_35137
Add the ability to set the CSP nonce only to the specified directives
2019-07-03 08:23:48 +09:00
Tatsuya Hoshino
1466701fab Replace the www.robotstxt.org URL with https one [ci skip]
The robots.txt site is moved permanently to https URL.
2019-06-25 23:20:19 +09:00
Laurent Arnoud
36f3dd333b
Add pidfile option to puma config template
This allow to call `pumactl` directly without extra parameters needed
2019-06-23 16:33:55 +02:00
yuuji.yaginuma
09d55b3022 Add the ability to set the CSP nonce only to the specified directives
I changed to set CSP nonce to `style-src` directive in #32932.
But this causes an issue when `unsafe-inline` is specified to `style-src`
(If a nonce is present, a nonce takes precedence over `unsafe-inline`).

So, I fixed to nonce directives configurable. By configure this, users
can make CSP as before.

Fixes #35137.
2019-06-22 12:44:37 +09:00
yuuji.yaginuma
ddb6d788d6 Make ActionDispatch::Response#content_type behavior configurable
I changed return value of `ActionDispatch::Response#content_type` in #36034.
But this change seems to an obstacle to upgrading. https://github.com/rails/rails/pull/36034#issuecomment-498795893

Therefore, I restored the behavior of `ActionDispatch::Response#content_type`
to 5.2 and deprecated old behavior. Also, made it possible to control the
behavior with the config.
2019-06-21 07:17:14 +09:00
Ben Thorner
2e5ec9a6ef Allow using env var to specify pidfile
Previously it was only possible to specify the location of the pidfile
for the 'rails server' command with the '-P' flag. This adds support for
specifying the pidfile using a PIDFILE env var, which can still be
overridden by the '-P' flag and with the default pidfile path unchanged.

The motivation for this feature comes from using Docker to run multiple
instances of the same rails app. When developing a rails app with
Docker, it's common to bind-mount the rails root directory in the
running container, so that changes to files are shared between the
container and the host. However, this doesn't work so well with the
pidfile and it's necessary to (remember to) add a '-P' flag to the
'rails server' command line; being able to specify this flag using an
env var would make developing with Rails+Docker a bit simpler.
2019-06-19 14:06:38 +01:00
Ryuta Kamizono
c81af6ae72 Enable Layout/EmptyLinesAroundAccessModifier cop
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.
2019-06-13 12:00:45 +09:00
yuuji.yaginuma
770f8f345f Remove redundant blank line at the bottom of the generated controller test 2019-06-07 15:18:44 +09:00
yuuji.yaginuma
689b371a52 Extract default log file open operation to method
This allows customize a default log file(e.g. `reopen`) by an application.

Fixes #32211.
2019-06-05 11:19:15 +09:00
yuuji.yaginuma
4cb0ce2e79 Fix rubocop violation 2019-06-05 10:37:03 +09:00
Eileen M. Uchitelle
61c3ea8c04 Merge pull request #36395 from cpruitt/6-0-stable
Do not clear deprecated initializer dependencies if using classic autoloader
2019-06-04 10:04:30 -04:00
yuuji.yaginuma
1ff98ed988 Remove spring-watcher-listen from default Gemfile
`spring-watcher-listen` watch application root by default.
c4bfe15805/lib/spring/watcher/listen.rb (L58)

This is necessary to watch the file (e.g. `.ruby-version`) in the
application root.

By this `node_modules` also be watched, and it is a possibility to be
shown a warning by `listen`.
Related to #32700, #34912, https://github.com/rails/webpacker/issues/1990.

`listen` watches directory recursive by default, and it cannot avoid it.
https://github.com/guard/listen/issues/111

So If this warning happens, the only workaround the user can do is remove
the gem.

The issue is likely to occur more frequently in Rails 6 because
`rails new` runs `webpacker:install` by default. Because of such a
state, I think that we should not recommend to use
`spring-watcher-listen`.

Spring has polling watcher, restart process works without this
`spring-watcher-listen`.
Because of polling base, CPU load may be higher than listen base. Still
I think that it is better than the warning comes out.
2019-06-02 10:32:53 +09:00
yuuji.yaginuma
784664f85b Bring after_bundle back to API document [ci skip]
At class level `:nodoc:` all elements are prevented. Instead, use
`:stopdoc:` / `:startdoc:` to make `after_bundle` appear.
2019-05-29 11:46:32 +09:00
Kasper Timm Hansen
a1c269fbdf
Skip needless spaces from generated app layout. 2019-05-26 23:02:37 +02:00
Anton Rieder
1fe26f7f8b
Bump Gemfile entry jbuilder version
jbuilder 2.6.4 is the first version that relaxes the version constraint to allow
Rails 6. I also did some more tests in #25183, although not with 2.6.4
explicitly.

To simplify the version requirement, I went for 2.7.

https://github.com/rails/jbuilder/blob/v2.6.4/jbuilder.gemspec
https://github.com/rails/rails/issues/25183#issuecomment-494342406
2019-05-23 17:21:34 +02:00
Vishal Telangre
ae9be13713
Fix: DummyCompiler embeds invalid YAML content
Fixes https://github.com/rails/rails/issues/36285.

Follow up of https://github.com/rails/rails/pull/36237.
2019-05-15 22:26:07 +05:30
Eileen M. Uchitelle
bd0618b1f3
Merge pull request #36237 from eileencodes/fix-erb-in-database-yaml-again
Fix database loading when ERB is single line ternary
2019-05-14 03:29:37 -04:00
George Claghorn
b2b6341374
Add ActionDispatch::SystemTestCase#fill_in_rich_text_area 2019-05-13 12:44:06 -04:00
Xavier Noria
4829214aa2 adds a blank line [ci skip] 2019-05-13 06:00:28 +02:00
Xavier Noria
63f39dd6eb warn about non-eager loaded dirs in zeitwerk:check 2019-05-13 05:49:00 +02:00
Vipul A M
31a3eea5ac Update the sqlite db yaml template to match others and mention proper supported version 2019-05-12 07:08:56 +05:30
eileencodes
5df84533d5 Fix database loading when ERB is single line ternary
*sigh* this seems like the never ending bug. I don't love or even like
this fix but it does _work_.

Rafael suggested using `dummy_key: dummy_value` but unfortunately
that doesn't work. So we're left with checking whethere there might be
ternary type things in the content and then assuming that we want to
replace the line with a key value pair.

Technically fixes https://github.com/rails/rails/issues/36088
2019-05-10 16:28:08 -04:00
Yuji Yaginuma
669b52d296
Merge pull request #36225 from deivid-rodriguez/workaround_sass_rails_requirement
Use a better requirement for sass-rails 6 prereleases
2019-05-09 17:33:55 +09:00
Sharang Dashputre
3d5cf0c595 Fix indentation of the config.eager_load nil warning 2019-05-09 13:17:04 +05:30
David Rodríguez
786bdc4c11
Use a better requirement for sass-rails 6 prereleases
This is the behavior I naively expect for the operator when used with a
single digit, but it's definitely an edge case for it, and it doesn't
seem to work as expected for including prereleases.

Using >= works fine and make the intention more clear anyways.
2019-05-09 09:40:30 +02:00
Dan
2c071e0246
minor grammar fix
"setup" is a noun, "set up" is the verb phrase
2019-05-08 14:10:47 -07:00
Abhay Nikam
dd643f4893 Fix indentation for config.eager_load nil warning message 2019-05-08 20:57:16 +05:30
yuuji.yaginuma
85a8bc644b Make generated test work even when using virtual attributes
The virtual attributes(`attachment` and `rich_text`) can't set value
with `fill_in`. So avoid using it. Once #35885 is merged, will be
modified to use it.

Also, add checking attachment attached or not for avoiding
`DelegationError` when attachment didn't attach.
2019-05-05 09:55:37 +09:00
Ryuta Kamizono
c1ff1392db Fix rubocop offences 2019-04-30 18:32:41 +09:00
Xavier Noria
b6e17b6a4b new config to opt-out from adding app directories to $LOAD_PATH 2019-04-28 13:48:26 +02:00
Prathamesh Sonpatki
fa0ce5c790
Bump bootsnap to a version with disables iseq_cache for Ruby 2.5
- Refs https://github.com/Shopify/bootsnap/pull/257
2019-04-26 12:55:28 +05:30
Rafael Mendonça França
9834be6565
Start Rails 6.1 development 2019-04-24 15:57:14 -04:00
Rafael França
5566b4a636
Merge pull request #36067 from st0012/update-generator-for-api-app
Remove action_controller.perform_caching from api app's configs
2019-04-23 14:37:46 -04:00
Rafael França
d33f5e55f1
Merge pull request #35852 from larouxn/resurrection
Resurrect external JS/CS generation
2019-04-23 14:21:30 -04:00
st0012
d63f9383a6 Remove action_controller.perform_caching from api app's configs
As suggested in https://github.com/rails/rails/issues/35602#issuecomment-485833483, because we don't provide view caching and doesn't include `ActionController::Caching` for api apps, we should also avoid generating

```ruby
config.action_controller.perform_caching = true
```

for those api apps. So it won't confuse people.

**But because `perform_caching` will be `true` if not set, the behavior of the app would still be the same without these configs.**
2019-04-24 02:08:13 +08:00
Xavier Noria
afc17e5ea2 Implements the task zeitwerk:check
[Matilda Smeds & Xavier Noria]
2019-04-23 03:17:34 +02:00
Guillermo Iguaran
2e4c65e3af Allow sass-rails greater than 5.x in new apps 2019-04-22 14:35:04 -05:00
Jeremy Weathers
b08daf48da [#35782] Allow loading seeds without ActiveJob (~> 5.2.3) 2019-04-19 10:57:42 -05:00
Prathamesh Sonpatki
8b4d344815
Add null: false constraint by default for belongs_to associations
- Also deprecate passing {required} to the model generator.
- Also made sure the global config `belongs_to_required_by_default` is
  applied correctly to the model generator for `null: false` option.
2019-04-19 20:08:29 +05:30
Kasper Timm Hansen
10da0a2751
Merge pull request #34788 from gsamokovarov/actionable-errors
Introduce Actionable Errors
2019-04-19 15:38:57 +02:00
akinomaeni
1cd88288d5 Help command for visible commands should be hidden
```
$ rails --help > tmp/before
$ bundle update rails
...
$ rails --help > tmp/after
$ diff -u tmp/before tmp/after
--- tmp/before	2019-04-19 00:12:08.000000000 -0700
+++ tmp/after	2019-04-19 00:14:55.000000000 -0700
@@ -52,7 +52,6 @@
   db:version
   destroy
   dev:cache
-  dev:help
   encrypted:edit
   encrypted:show
   initializers
```
2019-04-19 00:33:12 -07:00
Genadi Samokovarov
54df392bc5 Manage ActionDispatch::ActionableExceptions from the default middleware stack 2019-04-19 14:15:22 +09:00
David Stosik
6f73a31c0c
Factorize bin/update in bin/setup, and make bin/setup idempotent
`bin/setup` and `bin/update` are currently almost the same file. The
only thing that keeps them apart is that one is running `bin/rails
db:setup` and the other `bin/rails db:migrate`.

I'm suggesting here that they should be a unique script, which needs to
be idempotent.

- New to a project, need to get started? `bin/setup`
- Need to install new dependencies that were added recently? `bin/setup`.

Before deprecating `bin/update`, I'm suggesting we just have it call
`bin/setup`.
2019-04-17 00:45:17 +02:00
Lachlan Sylvester
4f2ac80d4c
Add collection cache versioning
Cache versioning enables the same cache key to be reused when the object
being cached changes by moving the volatile part of the cache key out of
the cache key and into a version that is embedded in the cache entry.

This is already occurring when the object being cached is an
`ActiveRecord::Base`, but when caching an `ActiveRecord::Relation`
we are currently still putting the volatile information (max updated at
and count) as part of the cache key.

This PR moves the volatile part of the relations `cache_key` into the
`cache_version` to support recycling cache keys for
`ActiveRecord::Relation`s.
2019-04-16 22:54:15 +02:00
Thierry Joyal
963d11a000 [Rails::MailersController] Do not leak I18n global setting changes 2019-04-16 18:54:51 +00:00
Rafael França
81c8f18d84
Merge pull request #35906 from yoones/notes-tags-registration
Notes tags registration
2019-04-15 17:46:07 -04:00
Xavier Noria
65344f254c generate config.cache_classes = false if Spring 2019-04-14 23:09:02 +02:00
Xavier Noria
3e66ba91d5 deprecates autoloading constants during initialization [closes #35745]
See rationale in the warning message included in the patch.
2019-04-14 12:09:09 +02:00
yuuji.yaginuma
319c295bba Do not treat environment_desc as commands
For avoid to show `environment_desc` in help.
2019-04-13 08:41:37 +09:00
Younes SERRAJ
6463cc0573 Adds register_tags 2019-04-12 08:55:42 +02:00
Ryuta Kamizono
43288a053f
Merge pull request #35916 from soartec-lab/delete_not_use_method
Delete not user method for plugin_generator
2019-04-11 02:55:20 +09:00
soartec-lab
831fa3dacb Delete not user method for plugin_generator 2019-04-09 22:36:25 +09:00
BatedUrGonnaDie
75811c37a9 Only override async adapter when seeding 2019-04-09 00:35:16 -07:00
Xavier Noria
57c7cbb162 depend on Zeitwerk 2 2019-04-07 13:05:26 +02:00
Nicholas La Roux
cf5049f88b
Burn unnecessary files 🔥 2019-04-05 16:09:23 +09:00
Nicholas La Roux
b46700da60
Style fixes 2019-04-05 16:09:23 +09:00
Nicholas La Roux
5d944d679b
Resurrect generator templates 2019-04-05 16:09:23 +09:00
Nicholas La Roux
d442d97bfa
Resurrect js/js engine options and generators 2019-04-05 16:09:22 +09:00
Ryuta Kamizono
0908184e4c Use execute_batch2 rather than execute_batch to fix performance regression for fixture loading
d8d6bd5 makes fixture loading to bulk statements by using
`execute_batch` for sqlite3 adapter. But `execute_batch` is slower and
it caused the performance regression for fixture loading.

In sqlite3 1.4.0, it have new batch method `execute_batch2`. I've
confirmed `execute_batch2` is extremely faster than `execute_batch`.
So I think it is worth to upgrade sqlite3 to 1.4.0 to use that method.

Before:

```
% ARCONN=sqlite3 bundle exec ruby -w -Itest test/cases/associations/eager_test.rb -n test_eager_loading_too_may_ids
Using sqlite3
Run options: -n test_eager_loading_too_may_ids --seed 35790

# Running:

.

Finished in 202.437406s, 0.0049 runs/s, 0.0049 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
ARCONN=sqlite3 bundle exec ruby -w -Itest  -n test_eager_loading_too_may_ids  142.57s user 60.83s system 98% cpu 3:27.08 total
```

After:

```
% ARCONN=sqlite3 bundle exec ruby -w -Itest test/cases/associations/eager_test.rb -n test_eager_loading_too_may_ids
Using sqlite3
Run options: -n test_eager_loading_too_may_ids --seed 16649

# Running:

.

Finished in 8.471032s, 0.1180 runs/s, 0.1180 assertions/s.
1 runs, 1 assertions, 0 failures, 0 errors, 0 skips
ARCONN=sqlite3 bundle exec ruby -w -Itest  -n test_eager_loading_too_may_ids  10.71s user 1.36s system 95% cpu 12.672 total
```
2019-04-04 03:27:46 +09:00
Ryuta Kamizono
fe006083ea Don't normalize original_app_name
`original_app_name` is used to show error message if giving app name is
invalid, it should be shown raw app name.
2019-04-03 17:56:04 +09:00
Rafael França
6c6c579a9b
Merge pull request #35805 from excid3/attachments-field-generators
Add attachment and attachments field generators
2019-04-02 19:13:25 -04:00
yuuji.yaginuma
29b16d3ff8 Rename connection option to database in dbconsole command
We introduced `connection` option for specifying spec with 1acd9a6464668d4d54ab30d016829f60b70dbbeb.
But now we are using the `database` to specify the same value in other commands.

* 0a0f115031/activerecord/lib/rails/generators/active_record/migration/migration_generator.rb (L11)
* 0a0f115031/activerecord/lib/rails/generators/active_record/model/model_generator.rb (L17)

The options provided to the users should be uniform. Since the term
"database" is used in rake task etc, So I want to be able to use it in
`dbconsole` command.

Also I deprecated the `connection` option because I think that it
would be confusing if there are multiple options to specify a same value.
2019-04-02 13:15:55 +09:00
Ryuta Kamizono
e4e1218583
Merge pull request #35820 from sharang-d/url-to-URL-except-actionpack
url -> URL where apt except inside actionpack/
2019-04-02 03:26:31 +09:00
Sharang Dashputre
771973c13d url -> URL where apt except inside actionpack/ 2019-04-01 22:56:35 +05:30
Orhan Toy
db4c6f5ecb Include final newline in generated .ruby-version 2019-04-01 18:39:15 +02:00
Chris Oliver
ecdcf06cb2 Add attachment and attachments field generators 2019-03-30 12:15:17 -05:00
Xavier Noria
a3e061def1 optimizes eager loading in :zeitwerk mode
During initialization, the eager load paths of engines are unshifted
into AS::Dependencies.autoload_paths. After that, the collection is
frozen. (See the initializers in railties/lib/rails/engine.rb.)

Hence, there is no eager load path that is not an autoload path too, and
so the array difference in the deleted code is always an empty array.

Just do nothing.
2019-03-30 13:01:42 +01:00
Xavier Noria
278f0dfeac fixes eager loading edge case in :zeitwerk mode 2019-03-30 09:33:48 +01:00
Chris Oliver
19a29c6556 Add rich_text field to model generators 2019-03-28 23:58:33 -05:00
Xavier Noria
379d7e8bfa bumps Zeitwerk and Bootsnap 2019-03-26 20:30:18 +01:00
Guillermo Iguaran
df51b75f12
Merge pull request #35732 from rails/webdrivers
Replace chromedriver-helper with webdrivers
2019-03-24 16:33:24 -05:00
Guillermo Iguaran
b4ca05ea43
Merge pull request #35723 from sikachu/disable-sandbox-flag
Add config.disable_sandbox option to Rails console
2019-03-24 16:22:21 -05:00
Guillermo Iguaran
895edbcf40 Use webdrivers instead of chromedriver-helper in new apps 2019-03-24 16:08:09 -05:00
Yuji Yaginuma
122853dc54
Merge pull request #35718 from y-yagi/add_secret_key_base_when_creating_new_credentials
Add `secret_key_base` when creating new credential file
2019-03-24 09:44:13 +09:00
Prem Sichanugrist
b27105252b Add config.disable_sandbox option to Rails console
A long-running `rails console --sandbox` could cause a database server
to become out-of-memory as it's holding on to changes that happen on the
database.

Given that it's common for Ruby on Rails application with huge
traffic to have separate write database and read database, we should
allow the developers to disable this sandbox option to prevent someone
from accidentally causing the Denial-of-Service on their server.
2019-03-23 19:31:03 +09:00
John Hawthorn
d0334b8f01 Update comment for how secret key is calculated
This updates the comment to reflect how the secret key is generated
since 4c743587ad6a31908503ab317e37d70361d49e66

Fixes #35717
2019-03-22 17:59:41 -07:00
yuuji.yaginuma
0e9e59953f Add secret_key_base when creating new credential file
Since `secret_key_base` is expected to be included in credential file,
`secret_key_base` should be included even if re-create the file. This is
the same behavior as creating a new app.
When env is specified, it may be unnecessary, so I added it only when not
specifying env.
2019-03-23 09:07:57 +09:00
John Hawthorn
663548845b Use symbol for mail preview format, not string 2019-03-18 16:06:31 -07:00
yuuji.yaginuma
6f94260ac6 Add -e/--environment option to rails initializers
This allows specifying the environment as would any other rails commands.
2019-03-16 10:02:06 +09:00
yuuji.yaginuma
c801b232bc Properly expand the environment's name in all commands
Since 3777701f1380f3814bd5313b225586dec64d4104, the environment's name is
automatically expanded in console and dbconsole commands.
In order to match the behavior between the commands, fixes it to have the
same behavior of all the commands.

This behavior is defined in `EnvironmentArgument`. Since
`EnvironmentArgument` also defines the environment option, it is reused.

However, since desc was not content that can be used in all comments,
fixed desc to be defined for each command.
2019-03-15 07:43:10 +09:00
yuuji.yaginuma
0187053109 Make application work without tmp directory
The tmp directory is added to version control in the newly created
application. This was added in Rails 5.0.0(f06ce4c12a).

However, applications created before that are not guaranteed to have the
tmp directory. If the tmp directory does not exist, writing to the key file
raise error.

This is a bit incompatible. So I fixed that create the directory before
writing a key.
2019-03-14 16:14:15 +09:00
eileencodes
a2bd669ed2 v6.0.0.beta3 release
-----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCAAdFiEEEvJkGf0BARV+D0L2ulxXUSC76N8FAlyJN4cACgkQulxXUSC7
 6N9ZXAf/Wx7edIct8kZzcC6irlROx4DzpNbrrH792sO1OAcnoFDE7DPkokllTEP/
 4kzC42lca/XG27MCl7E0dtVD8hIyAl89nxid6cwKFVZVTPIRVc1wjXkoiWy/cvd7
 6+9IjxhlgrzxGnw3aWZJG7H3iqz69yr55aoSDU/TbMqq5kQrqNF95vr2nc8LEUco
 SLQj0pO/tfJdHquSeX0JiXn3VSEHT+5TdLGQ3J/w0wFU6mkecH4MJMJvMwLFx/v4
 llnvF6HyfSLASWbrpdD3h6MQHpImDoee5vILXAHzPdSaEVcVa1cDFtMcPMYiu8Dw
 AGdCAaHQhZFFGoYK472+o6pur0dxEA==
 =5dET
 -----END PGP SIGNATURE-----

Merge tag 'v6.0.0.beta3'

v6.0.0.beta3 release
2019-03-13 13:11:10 -04:00
Akira Matsuda
9f02a8f89b Indentation >> 2019-03-13 19:34:50 +09:00
yuuji.yaginuma
12ddee0ce8 Fix rubocop violations 2019-03-13 17:51:46 +09:00
Sharang Dashputre
ad5ca97acc overriden -> overridden [ci skip] 2019-03-12 04:08:51 +05:30
Rafael Mendonça França
cfa22f1a4b
Do not generate dummy string when the tag used is not the <%= 2019-03-11 17:49:27 -04:00
Kasper Timm Hansen
3a42c2305e
Merge pull request #34955 from bogdanvlviv/follow-up-33962
Add `config.credentials.content_path` and `config.credentials.key_path` to the guide
2019-03-11 21:08:20 +01:00
Kasper Timm Hansen
f55306f098
[ci skip] Improve encrypted commands USAGE
This streamlines the lovely foundation Bogdan added. Mainly to add
guidance around encryption keys and remove some backticks.

Finally it adds some mention of how to access these files from Ruby
in apps.

[ Kasper Timm Hansen & bogdanvlviv ]
2019-03-11 21:00:00 +01:00
Kasper Timm Hansen
7874257afd
Merge pull request #34965 from bogdanvlviv/improve-rails-encrypted--help
Improve output of `rails encrypted(:edit/:show) --help`
2019-03-11 20:42:36 +01:00
eileencodes
7c87fd5635 Prep release
* Update RAILS_VERSION
* Bundle
* rake update_versions
* rake changelog:header
2019-03-11 11:58:15 -04:00
Ryuta Kamizono
c41269ebc8
Merge pull request #35568 from prathamesh-sonpatki/server_squish
Squish the deprecation messages across the codebase
2019-03-11 23:16:47 +09:00
Prathamesh Sonpatki
538a459a3b
Squish the deprecation messages across the codebase
Sample example ->

Before:

prathamesh@Prathameshs-MacBook-Pro-2 blog *$ rails server thin
DEPRECATION WARNING: Passing the Rack server name as a regular argument is deprecated
and will be removed in the next Rails version. Please, use the -u
option instead.

After:

prathamesh@Prathameshs-MacBook-Pro-2 squish_app *$ rails server thin
DEPRECATION WARNING: Passing the Rack server name as a regular argument is deprecated and will be removed in the next Rails version. Please, use the -u option instead.
2019-03-11 19:22:37 +05:30
Kasper Timm Hansen
2259b486f1
Merge pull request #35569 from prathamesh-sonpatki/env-vars
Mention `environment variable` instead of just `environment`
2019-03-11 14:42:15 +01:00
Prathamesh Sonpatki
4cdc93a1e4
Mention environment variable instead of just environment 2019-03-11 18:54:13 +05:30
Prathamesh Sonpatki
bcc1207a8e
Use the -u switch for the rails server banner
- Because just passing the server argument to this command is
  deprecated in https://github.com/rails/rails/pull/32058
2019-03-11 18:26:49 +05:30
Aaron Patterson
4c743587ad Fix possible dev mode RCE
If the secret_key_base is nil in dev or test generate a key from random
bytes and store it in a tmp file. This prevents the app developers from
having to share / checkin the secret key for dev / test but also
maintains a key between app restarts in dev/test.

[CVE-2019-5420]

Co-Authored-By: eileencodes <eileencodes@gmail.com>
Co-Authored-By: John Hawthorn <john@hawthorn.email>
2019-03-10 21:30:03 -07:00
Kasper Timm Hansen
c87f6841b7
Merge pull request #35121 from utilum/warning_tried_to_create_proc_without_block
Ruby 2.7 warning: creating a Proc without a block
2019-03-10 16:31:15 +01:00
Abhay Nikam
027e492b6f Fix links in gemspec and docs from http to https. 2019-03-09 19:42:35 +05:30
Sharang Dashputre
c2de1f79ab Don't lock the webpacker gem by its patch version 2019-03-09 05:29:36 +05:30