Commit Graph

4142 Commits

Author SHA1 Message Date
John Hawthorn
a70ad604cf Add railties test of custom handlers and formats 2020-05-26 19:27:38 -07:00
John Hawthorn
096d143c8c Clear cache after setting Template::Types delegate
details_cache_key already references Template::Types.symbols and view
resolvers cache based on default_formats and other values. This
previously wasn't an issue because no views had been looked up before
this was set. Now that we are building a regex from the values of
Template::Types.symbols we need to clear cache after changing this
setting.
2020-05-21 22:43:13 -07:00
George Claghorn
e4b6c719cd Update Railties tests for 7e52d0a 2020-05-21 13:00:56 -04:00
Ryan Davis
c07bcd6573 Fixed up error output tests and added a missing failure output test.
Errors *should* output their stack. Somehow these tests were passing
before. This clarifies all states (skip/fail/error) and works against
@tenderlove's patch.
2020-05-20 15:54:28 -07:00
Kasper Timm Hansen
03e82e2f0d
Merge pull request #39245 from paul-mannino/unload-app
Don't load app environment when running encrypted commands
2020-05-16 23:55:21 +02:00
David Heinemeier Hansson
c6bdfd133f
Use explicit spring boot loader (#39225) 2020-05-16 13:57:45 -07:00
Eileen M. Uchitelle
d08f2d41a1
Merge pull request #39257 from eileencodes/revert-job-deprecation
Revert "Remove deprecated `ActionMailer::DeliveryJob` and `ActionMailer::Parameterized::DeliveryJob`
2020-05-12 19:12:42 -04:00
Eugene Kenny
96a1a2a37c Use binread instead of setting file mode manually
Followup to b31022052a54ef76f347973e23519ba86ffc94ff.
2020-05-13 00:05:32 +01:00
eileencodes
336a07b9a4
Revert "Remove deprecated ActionMailer::DeliveryJob and ActionMailer::Parameterized::DeliveryJob"
This reverts commit 0f9249c93f402d276730fcfaba1ed1b876ee7c26.

Reverted because this wasn't warning in custom jobs and therefore
applications may have not seen the deprecation. We'll need to fix the
deprecation to warn for custom jobs so that applications can migrate.
2020-05-12 15:20:07 -04:00
Paul Mannino
4e8650f8b1 Don't load app environment when running encrypted commands
This extends the fix made by a39aa99c814 to the EncryptedCommand class
which suffers from the exact same issue.
2020-05-12 12:06:05 -05:00
Jonathan Fleckenstein
dfb5a82b25
Active Storage: allow serving files by proxying 2020-05-11 16:21:58 -04:00
yuuji.yaginuma
fde100d18e Add config.generators.after_generate for processing to generated files
Register a callback that will get called right after generators has
finished.

This is useful if users want to process generated files.
For example, can execute an autocorrect of RuboCop for generated files
as like following.

```ruby
config.generators.after_generate do |files|
  system("bundle exec rubocop --auto-correct " + files.join(" "), exception: true)
end
```
2020-05-08 21:06:04 +09:00
Kasper Timm Hansen
f1c7a32e90
Merge pull request #39001 from jonathanhefner/test-runner-recognize-windows-paths
Recognize Windows-style paths in test runner
2020-05-07 22:48:23 +02:00
Kasper Timm Hansen
d143154147
Merge pull request #39036
Closes #39036
2020-05-07 01:05:58 +02:00
Jorge Manrubia
a0f18e6090
Make test file patterns configurable via Environment variables
This makes test file patterns configurable via two environment variables:
`DEFAULT_TEST`, to configure files to test, and `DEFAULT_TEST_EXCLUDE`,
to configure files to exclude from testing.

These values were hardcoded before, which made it difficult to add
new categories of tests that should not be executed by default (e.g:
smoke tests).

It uses environment variables instead of regular Rails config options
because Rails environment is not available when the Runner builds the
list of files to test (unless using Spring). A nicer solution would be
making sure that the Rails environment is always loaded when the runner
starts. This is a first simple step to make these paths configurable for
now

This way at least you could override defaults in `config/boot.rb`:

```ruby
ENV["DEFAULT_TEST_EXCLUDE"] = "test/{dummy,smoke,system}/**/*_test.rb
```

Co-authored-by: Jeremy Daer <jeremydaer@gmail.com>
2020-05-07 01:04:01 +02:00
Ryuta Kamizono
6a4395f466 Deprecate starts_with? and ends_with? for String core extensions
In the past, we sometimes hit missing `Symbol#start_with?` and
`Symbol#end_with?`.

63256bc5d7
a8e812964d

So I proposed `Symbol#start_with?` and `Symbol#end_with?` to allow duck
typing that methods for String and Symbol, then now it is available in
Ruby 2.7.

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

Using `String#starts_with?` and `String#ends_with?` could not be gained
that conveniency, so it is preferable to not use these in the future.
2020-05-05 15:51:24 +09:00
Rafael Mendonça França
bd87b37d4f
Remove unneeded test after force_ssl removal 2020-05-05 01:13:46 -04:00
Rafael Mendonça França
0f9249c93f
Remove deprecated ActionMailer::DeliveryJob and ActionMailer::Parameterized::DeliveryJob 2020-05-05 00:31:14 -04:00
Brandon Fish
b4ccdcb73a Include parallelize :threads option when fork is not available 2020-05-04 20:26:24 -05:00
Ryuta Kamizono
592358e182 Update pg gem required version to 1.1
This is required for #39063 to use `PG::TextDecoder::Numeric`.

Ref https://github.com/ged/ruby-pg/pull/25.

The pg gem 1.1.0 was released at August 24, 2018, so I think it is good
timing to bump the required version for improving and cleaning up the
code base.

https://rubygems.org/gems/pg/versions
2020-04-27 16:27:40 +09:00
Jonathan Hefner
7bf4520292 Recognize Windows-style paths in test runner
Previously, a test runner argument had to contain a forward slash to be
recognized as a path.  Now, backslashes will also be considered,
enabling the use of Windows-style paths.

Fixes #38243.
2020-04-21 00:48:16 -05:00
John Hawthorn
cf525eb7ed
Merge pull request #38893 from leequarella/parallelization
Improve ActiveSupport Parallelization error logging
2020-04-14 10:05:12 -07:00
Lee Quarella
b22c4e2a1c Add inflight checks and server shutdown 2020-04-13 09:05:52 -04:00
Ryuta Kamizono
f960948d23 Remove more code for unsupported frontbase and ibm_db adapters
FrontBase and IBM_DB adapters do not work for Rails 5.2.

https://rubygems.org/gems/ruby-frontbase
https://rubygems.org/gems/ibm_db
2020-04-12 11:45:28 +09:00
Eugene Kenny
9d8763bceb
Merge pull request #38794 from cromulus/mandrill-ingress-tokenfix
Adding a route for Mandrill's url check.
2020-04-07 20:08:07 +01:00
Bill Cromie
fce29be335 Add a route to handle Mandrill's webhook URL check
Mandrill's Inbound API checks to see if a URL exists before it creates
the webhook. It sends a HEAD request, to which we now return a 200 OK
response to indicate that the route exists.

Now we can generate inbound API calls with ease on Mandrill, without
having to shuffle around tokens in production.

Fixes #37609.
2020-04-07 13:22:36 +01:00
Jonathan Hefner
c7b7d83f70 Heed config.force_ssl when building URL
`url_for` will now use "https://" as the default protocol when
`Rails.application.config.force_ssl` is set to true.

Action Mailer already behaves this way, effectively.  This commit
extends that behavior application-wide.

Closes #23543.
2020-04-05 18:19:31 -05:00
Eugene Kenny
a6711d6e9d Restore tests for 6.0 new framework defaults
These were removed in 74201c3885ae2e33bfff046d503324fd1d7a320f when the
template for the 6.0 new framework defaults initializer was deleted.

While we no longer generate the file, upgrading applications will still
have it, so it's still important to check that these options can be set.
2020-04-04 11:02:31 +01:00
Eugene Kenny
feac3e97cc Trigger load hooks with require in configuration tests
I introduced this pattern of referencing a constant to trigger lazy load
hooks in 458a5502a17ccf58d5708a3b030ac9917a0a8476, and it arrived at its
current form via c98a641ff402d3ca5b754f4621a0764f33eab155 and
c24be369322b9e0211fcef30003375de195ef660.

I now realise autoloading doesn't need to be involved at all; we can
require the files that trigger the lazy load hooks directly.
2020-04-04 10:36:34 +01:00
Eugene Kenny
775148c837 Allow utc_to_local_returns_utc_offset_times to be set in new_framework_defaults_6_1.rb
Enabling this option in new_framework_defaults_6_1.rb didn't work
before, as railtie initializers run before application initializers.
2020-04-03 19:41:35 +01:00
David Heinemeier Hansson
d56d2e7406
Add a way to deliver inbound emails by source (#38849)
* Add a way to deliver inbound emails by source

Great for testing when you get an eml file and can just paste it in.

* Test updates

* Fix tests

* Fix spacing
2020-03-31 16:46:13 -07:00
David Heinemeier Hansson
3e0cdbeaf4
require, require_relative, load by double quotes (#38841)
* require, require_relative, load by double quotes

We're getting rid of all single quote usage, unless it serves a specific purpose, as per the general style guide.
2020-03-29 16:30:52 -07:00
Eugene Kenny
851773d54e Remove obsolete app:update generator test
This test doesn't assert anything since
e5a6f7ee9e951dbe0e4e9ea2c0743b4dfb135c57.
2020-03-29 23:29:29 +01:00
Kasper Timm Hansen
bf34c808f9
Merge branch 'tzinfo2' 2020-03-28 20:53:24 +01:00
Phil Ross
e9425abe33
Update to TZInfo v2.0.0
Co-authored-by: Jared Beck <jared@jaredbeck.com>
Co-authored-by: Jonathan Hefner <jonathan@hefner.pro>
2020-03-28 20:42:43 +01:00
Eugene Kenny
326d502714 Handle paths with trailing slashes in rails test
The `rails test` command scans its arguments for test paths to load
before handing off option parsing to Minitest. To avoid incorrectly
interpreting a `-n /regex/` pattern as an absolute path to a directory,
it skips arguments that end with a slash. However a relative path ending
in a slash is not ambiguous, so we can safely treat those as test paths.

This is especially useful in bash, where tab completing a directory
leaves a trailing slash in place.
2020-03-26 21:48:17 +00:00
eileencodes
e33075a0ef
Handle db:rollback and db:rollback:[NAME] for multi-db apps
With a multiple database application `db:rollback` becomes problematic.
We can't rollback just the primary, that doesn't match the behavior in
the other tasks. We can't rollback a migration for every database, that
is unexpected.

To solve this I handled `db:rollback` the same way I handled `:up` and
`:down`. If `db:rollback` is called for a multi-db application then it
will raise an error recommending you use `db:rollback:[NAME]` instead.
Calling `db:rollback:primary` or `db:rollback:animals` will rollback
the migration for the number of steps specified.

Closes: #38513
Follow-up to: #34078
2020-03-19 16:50:46 -04:00
Kasper Timm Hansen
54cb01610e
Merge pull request #38495 from jonathanhefner/isolate-argv-in-command-invoke
Isolate ARGV in Rails::Command.invoke
2020-03-14 02:47:22 +01:00
eileencodes
095f1bfaa0
Refactor schema migration on connection
This method was jumping through extra hoops to find the name of the
class the connection is stored on when we can get it from the connection
itself. Since we already have the connection we don't need to loop through the
pools.

In addition, this was using the wrong class name. The class name for the
schema migration should come from the connection owner class, not from
the `db_config.name`. In this case, `db_config.name` is the name of the
configuration in the database.yml. Rails uses the class name to lookup
connections, not the db config name, so we should be consistent here.

While working on this I noticed that we were generating an extra schema
migration class for `ActiveRecord::Base`. Since `ActiveRecord::Base` can
and should use the default and we don't want to create a new one for
single db applications, we should skip creating this if the spec name is
`ActiveRecord::Base`. I added an additional test that ensures the class
generation is correct.
2020-03-09 09:59:36 -04:00
eileencodes
67b102a57f
Add erb tests for multi-db
If I had had these tests previously I would have not created PR #38658
and then promptly realize I needed to revert it.

We need to load and parse the configurations twice. Once before the
environment is loaded to create the named tasks and once after the
environment is loaded to have the real configurations. The configs
loaded before the env have the ERB stripped out and aren't valid
configs.
2020-03-06 11:23:43 -05:00
eileencodes
2dcf07a53a
Fix test name
Wow this is embarrassing. I literally named this FIXME so I'd remember
to give it some name that made sense and then I totally did not.
2020-03-06 10:01:14 -05:00
eileencodes
150fcf7b37
Fix database configruation for multi-db
The key, value is `replica: true` not `readonly: true`. Fix the database
configuration to be correct.
2020-03-06 09:33:18 -05:00
Rodrigo Ramírez Norambuena
3b882deb0c Add tests for --master app_generator
These tests verify is added the entry into the Gemfile using
`branch: "master"` for Rails and web-console from Github for
:development
2020-03-05 18:39:03 -03:00
Kyle Thompson
4b81e367ef
Dump the schema or structure of a database when calling db:migrate:name 2020-02-27 13:40:00 -05:00
Kyle Thompson
0366cbd742
Reset the ActiveRecord::Base connection after rails db:migrate:name 2020-02-27 13:10:54 -05:00
eileencodes
79ce7d9af6
Deprecate spec_name and use name for configurations
I have so. many. regrets. about using `spec_name` for database
configurations and now I'm finally putting this mistake to an end.

Back when I started multi-db work I assumed that eventually
`connection_specification_name` (sometimes called `spec_name`) and
`spec_name` for configurations would one day be the same thing. After
2 years I no longer believe they will ever be the same thing.

This PR deprecates `spec_name` on database configurations in favor of
`name`. It's the same behavior, just a better name, or at least a
less confusing name.

`connection_specification_name` refers to the parent class name (ie
ActiveRecord::Base, AnimalsBase, etc) that holds the connection for it's
models. In some places like ConnectionHandler it shortens this to
`spec_name`, hence the major confusion.

Recently I've been working with some new folks on database stuff and
connection management and realize how confusing it was to explain that
`db_config.spec_name` was not `spec_name` and
`connection_specification_name`. Worse than that one is a symbole while
the other is a class name. This was made even more complicated by the
fact that `ActiveRecord::Base` used `primary` as the
`connection_specification_name` until #38190.

After spending 2 years with connection management I don't believe that
we can ever use the symbols from the database configs as a way to
connect the database without the class name being _somewhere_ because
a db_config does not know who it's owner class is until it's been
connected and a model has no idea what db_config belongs to it until
it's connected. The model is the only way to tie a primary/writer config
to a replica/reader config. This could change in the future but I don't
see value in adding a class name to the db_configs before connection or
telling a model what config belongs to it before connection. That would
probably break a lot of application assumptions. If we do ever end up in
that world, we can use name, because tbh `spec_name` and
`connection_specification_name` were always confusing to me.
2020-02-24 13:27:07 -05:00
Kyle Thompson
e8c61b6bfd
Adds additional database-specific rake tasks for multi-database users 2020-02-24 12:05:44 -05:00
Carlos Antonio da Silva
6f98614b1f Calculate mailbox and channel test files as Test LOC stats
If they are not included in this "test types" list, they're counted
towards app code lines, not test lines.
2020-02-19 10:10:12 -03:00
Jonathan Hefner
8ec7a2b7aa Isolate ARGV in Rails::Command.invoke
Follow-up to #38463.

By isolating ARGV, we guard against commands inadvertently depending on
prior ARGV contents.  Any such command will now behave consistently when
run via `Rails::Command.invoke`, whether coming from the Rails CLI or
from library code.  Likewise, any ARGV mutations done by a command will
not affect code that executes after `Rails::Command.invoke`.
2020-02-18 15:02:56 -06:00
Jonathan Hefner
9efaa669eb Delete .ruby-version in generated plugin dummy app
A .ruby-version file is not useful in a plugin dummy app because the
plugin itself dictates the required Ruby version.  Indeed, the dummy app
.ruby-version file might fall out of sync with whatever the plugin
dictates, and thus result in unexpected "Could not find gem" errors when
running commands from within the dummy app directory.
2020-02-16 15:02:37 -06:00
Rafael França
428509700b
Merge pull request #38442 from roramirez/routes-in-scaffold_controller
scaffold_controller: Include the routes when create a generator Controller
2020-02-13 14:45:19 -05:00
Rodrigo Ramírez Norambuena
55b2264746 scaffold_controller: Include the routes when create a generator Controller
When is use a scaffold_controller add the routes as resources to the
config/route.rb

Also enable to use --skip-routes if doesn't want include the resources
into the config/routes.rb file.
2020-02-13 11:07:21 -03:00
eileencodes
c1a215a06b
Add schema cache tests
The schema cache tests test the following scenarios:

1) The default case works (single db, primary spec name (dev is default
to primary in 2-tier config), standard default schema cache filename)
2) Primary always wins over other entries
3) A custom schema cache filename works when set in the configuration
4) A custom schema cache filename works when set in the ENV

Cases that don't work:

1) A non-primary database entry picks up a namespaced schema cache file

This can't work currently because there's no way of knowing which cache
we actually want. In this railtie we can only load ActiveRecord::Base's
schema cache. If we grab the first config we risk loading a cache for
another connection because order is not guaranteed.

2) Multi-db schema caches

The reasons are similar to above. In addition we can't loop through the
configs, establish a connection, and load the cache because we don't
know what parent class to establish a connection to. In that case AR
Base will always get the cache and it would cause the last one to win
and therefore be loaded on the wrong connection.

The real fix for these issues is to get rid of the railtie entirely, but
for now we needed to set this back to what the behavior was before
recent changes but with the ability to pass a custom key.

Co-authored-by: Katrina Owen <kytrinyx@github.com>
2020-02-13 09:06:18 -05:00
Kasper Timm Hansen
e8070990ef Merge pull request #37516 from jonathanhefner/generator-generate-avoid-shell-out
Avoid shelling out for generator `generate` action
2020-02-09 23:29:23 +01:00
Kasper Timm Hansen
b7027099b1
Update git init when generating plugins
* Extract separate test, test with `--skip-git`
* Move `version_control` beneath `gitignore` to match `AppBuilder` from 8989a505
* Add changelog entry
2020-02-09 23:04:29 +01:00
Kasper Timm Hansen
71b6d721f7
Merge pull request #38396 from okuramasafumi/plugin-generator-git-init
Initialize Git when generating plugins
2020-02-09 22:51:34 +01:00
OKURA Masafumi
8541ad319a Initialize Git when generating plugins
When generating applications, it initializes Git repository since
8989a5057b
However, it doesn't initialize Git when creating plugins.
Plugins are mostly libraries and are likely hosted on GitHub,
so initializing Git for plugins makes sense.
2020-02-06 20:17:32 +09:00
Ryuta Kamizono
fa986ae0ca Simplify lookup_store
I think allowing nested array parameters is almost useless.
2020-02-05 14:07:56 +09:00
Narendra Rajput
f8059d2383 Fix the environment.rb file path in the benchmark generator template 2020-02-03 17:36:56 +05:30
Katrina Owen
e95b3fd21f
Use correct filename for schema cache on load
The initializer that loads the default schema cache on the default
connection doesn't account for the case where an app overrides the
default filename either via ENV["SCHEMA_PATH"], or via the
:schema_cache_path defined in the db config.

Note that as discussed in #34449 this initializer doesn't work for
applications using multiple databases, and this change doesn't fix that.
2020-01-29 21:43:19 +00:00
Kevin Jalbert
cc8eac90cd
Add benchmark generator
Introduce benchmark generator to add benchmarks to Rails applications.

The generator makes use of `benchmark-ips`, and will automatically add
the gem to the Gemfile as needed.

Co-authored-by: Gannon McGibbon <gannon.mcgibbon@gmail.com>
2020-01-24 12:44:33 -05:00
Eileen M. Uchitelle
a6bd34a708
Merge pull request #38250 from vikasvr/skip_keep_fix
Skip keeps option shouldn't restrict from creating empty directories
2020-01-23 11:07:00 -05:00
Jorge Manrubia
de46effc9a Cache compiled view templates when running tests by default
When generating a new app without `--skip-spring`, caching classes was
disabled in `environments/test.rb`. This was implicitly disabling caching
view templates too. This change will enable view template caching by adding
this to the generated `environments/test.rb`:

    config.action_view.cache_template_loading = true

See 65344f254cde87950c7f176cb7aa09c002a6f882
2020-01-21 11:21:47 +01:00
eileencodes
2a53fe638d
Deprecate and replace #default_hash and #[]
Database configurations are now objects almost everywhere, so we don't
need to fake access to a hash with `#default_hash` or it's alias `#[]`.
Applications should `configs_for` and pass `env_name` and `spec_name` to
get the database config object. If you're looking for the default for
the test environment you can pass `configs_for(env_name: "test", spec_name:
"primary")`. Change test to developement to get the dev config, etc.

`#default_hash` and `#[]` will be removed in 6.2.

Co-authored-by: John Crepezzi <john.crepezzi@gmail.com>
2020-01-17 16:08:12 -05:00
Vikas Verma
603278626d generate empty directory for image only 2020-01-17 16:07:08 +05:30
Vikas Verma
44b819616a Add failing test cases 2020-01-17 02:57:47 +05:30
Jonathan Hefner
dcc3c85c2f WIP inline option 2020-01-09 15:49:58 -06:00
Jonathan Hefner
8ac5a44133 Avoid shelling out for generator generate action
This change addresses a few issues:

First, shelling out to the `rails` command requires the destination
directory to contain certain files that the command uses to initialize
itself.  While this is not an issue when running generators normally, it
is troublesome when testing generator-invoking generators which output
to ephemeral destination directories.

Second, shelling out to the `rails` command is very slow.  This also is
not a particular concern when running generators normally, but it makes
test suites for generator-invoking generators painfully slow.

Third, shelling out to the `rails` command fails silently by default.
Such silent failures can be surprising, and can lead to confusing
downstream failures.
2020-01-09 15:40:06 -06:00
Jonathan Hefner
5fbf14b92f Put dev dependencies in generated plugin Gemfile
The Gemfile offers more flexibility than the gemspec in terms of gem
groups and platforms.  Putting the default development dependencies in
the Gemfile encourages users to add their own development dependencies
to the Gemfile.  This is similar to the current behavior of the
`bundle gem` command (see bundler/bundler#7222).

This change also fixes a corner case where using the "--skip-gemspec"
and "--skip-active-record" options together would incorrectly generate a
"sqlite3" dependency in the Gemfile.
2020-01-09 15:17:04 -06:00
Rafael França
031763ab5c
Merge pull request #38169 from gsamokovarov/rails-middleware-move-before-after
Delayed middleware delete does not allow move operations
2020-01-08 12:17:26 -03:00
Genadi Samokovarov
40fc1651ad Delayed middleware delete does not allow move operations
While trying to fix #16433, we made the middleware deletions always
happen at the end. While this works for the case of deleting the
Rack::Runtime middleware, it makes operations like the following
misbehave.

```ruby
gem "bundler", "< 1.16"

begin
  require "bundler/inline"
rescue LoadError => e
  $stderr.puts "Bundler version 1.10 or later is required. Please update your Bundler"
  raise e
end

gemfile(true) do
  source "https://rubygems.org"

  git_source(:github) { |repo| "https://github.com/#{repo}.git" }

  gem "rails", github: "rails/rails"
end

require "action_controller/railtie"

class TestApp < Rails::Application
  config.root = __dir__
  secrets.secret_key_base = "secret_key_base"

  config.logger = Logger.new($stdout)
  Rails.logger  = config.logger

  middleware.insert_after ActionDispatch::Session::CookieStore, ::Rails::Rack::Logger, config.log_tags
  middleware.delete ::Rails::Rack::Logger
end

require "minitest/autorun"
require "rack/test"

class BugTest < Minitest::Test
  include Rack::Test::Methods

  def test_returns_success
    get "/"
    assert last_response.ok?
  end

  private
    def app
      Rails.application
    end
end
```

In the case ☝️  the ::Rails::Rack::Logger would be deleted instead of
moved, because the order of middleware stack building execution will be:

```ruby
[:insert, ActionDispatch::Session::CookieStore, [::Rails::Rack::Logger]]
[:delete, ::Rails::Rack::Logger, [config.log_tags]]
```

This is pretty surprising and hard to reason about behaviour, unless you
go spelunking into the Rails configuration code.

I have a few solutions in mind and all of them have their drawbacks.

1. Introduce a `Rails::Configuration::MiddlewareStackProxy#delete!` that
delays the deleted operations. This will make `#delete` to be executed
in order. The drawback here is backwards incompatible behavior and a new
public method.

2. Just revert to the old operations. This won't allow people to delete
the `Rack::Runtime` middleware.

3. Legitimize the middleware moving with the new `#move_after` and
`#move_before` methods. This does not breaks any backwards
compatibility, but includes 2 new methods to the middleware stack.

I have implemented `3.` in this pull request.

Happy holidays! 🎄
2020-01-08 11:30:02 +02:00
Xavier Noria
ad04bc0d62 addresses RuboCop feedback 2020-01-07 21:41:33 +01:00
Xavier Noria
c0d91a4f9d restores the ability to manually eager load applications
The main interface to eager loading is config.eager_load. The logic that
implies happens during the boot process.

With the introduction of Zeitwerk, application code is loaded in the
finisher as everything else, but in previous versions of Rails users
could eager load the application code regardless of config.eager_load.

Use cases:

   * Some gems like indexers need to have everything in memory and would
   be a bad user experience to ask users to conditionally set the eager
   load flag.

   * Some tests may need to have everything in memory and would be a bad
   experience to have the flag enabled globally in the test environment.

I personally feel that the contract between this method and the entire
eager loading process is ill-defined. I believe this method is
essentially internal. The purpose of this patch is simply to restore this
functionality emulating what it did before because rethinking the design
of this interface may need time.
2020-01-07 21:34:28 +01:00
Rafael Mendonça França
667b150c20
Merge pull request #37404 from joshmn/respect_the_force
Fix collision check when using a generator and using the force option
2020-01-06 21:32:43 -03:00
Rafael Mendonça França
f718ab6c72
Fix rubocop violations 2019-12-27 18:05:21 -03:00
Rafael Mendonça França
a29ac90738
Deal with Ruby 2.5 and Ruby 2.6 in a different way 2019-12-27 17:54:59 -03:00
Rafael Mendonça França
69d98f9a63
Split keyword argument in the geenrators action tests 2019-12-27 17:23:30 -03:00
Haroon Ahmed
db1ae8cbb4 remove reference to global rails command and replace with bin/rails 2019-12-27 19:32:37 +00:00
Ryuta Kamizono
5324f2cb09 Revert "Merge pull request #37215 from utilum/avoid_test_flunking_on_warning"
This reverts commit ed78e96408f3f83e779a71c65b86aeb1cfc5616e, reversing
changes made to eca6c273fe2729b9634907562c2717cf86443b6b.
2019-12-25 17:13:09 +09:00
yuuji.yaginuma
c8b88dd4df Use the single line editor in console test
It's a bit difficult to deal properly with IRB's multi line and color,
and I think we don't need to check it out in `rails console` tests.
2019-12-24 20:47:21 +09:00
Brian Buchalter
53e9438ef2 Ignore test env in DatabaseTasks when DATABASE_URL is present
Fixes https://github.com/rails/rails/issues/28827.

The steps to reproduce are as follows:

git clone git@github.com:bbuchalter/rails-issue-28827.git
cd rails-issue-28827
bundle install
bin/rails db:create

Observe that we create two databases when invoking db:create: development and test. Now observe what happens when we invoke our drop command while using DATABASE_URL.

DATABASE_URL=sqlite3://$(pwd)/db/database_url.sqlite3 bin/rails db:create

As expected, the development environment now uses the DATABASE_URL. What is unexpected is that the test environment does not.

It's unclear what the expected behavior should be in this case, but the cause of it is this: 9f2c74eda0/activerecord/lib/active_record/tasks/database_tasks.rb (L494)

Because of each_local_configuration, there seems to be no way invoke these database rake on only the development environment to ensure DATABASE_URL is respected.

The smallest scope of change I can think to make would be to conditionalize this behavior so it does not get applied when DATABASE_URL is present.
2019-12-20 14:22:31 -08:00
Kouhei Sutou
4334299b65 Make Rails::Configuration::Generators accessor consistent
Rails::Configuration::Generators provides method_missing based accessor.

The following code sets `orm` value:

    Rails.application.config.generators.orm :data_mapper

The following code does NOT return `orm` value:

    Rails.application.config.generators.orm # => {}

It's better that the reader returns the value set by writter in terms of
consistency:

    Rails.application.config.generators.orm # => :data_mapper
2019-12-20 06:21:09 +09:00
Rafael França
e36d4a0381
Merge pull request #38026 from Edouard-chin/ec-av-base-loadorder
Don't require "action_view/base" in action pack:
2019-12-19 13:40:56 -03:00
Edouard CHIN
88ee52f9d9 Don't require "action_view/base" in action pack:
- ### Problem

  ActionPack requires "action_view/base" at boot time, this
  causes a variety of issue that I described in detail in #38024.

  There is no real reason to require av/base in the
  ActionDispatch::Debugexceptions class.

  ### Solution

  Like any other components (such as ActiveRecord, ActiveJob...),
  ActionView::Base shouldn't be loaded at boot time.

  Here are the two main changes needed for this:

  1) Actionview has a special initializer that needs to run
     before the app is fully booted (adding a executor needs to be done
     before application is done booting)
  63ec70e700/actionview/lib/action_view/railtie.rb (L81-L84)

     That initializer used a lazy load hooks but we can't do that anymore
     because Action::Base view won't be triggered during booting process.
     When it will get triggered, (presumably on the first request),
     it's too late to add an executor.

  ------------------------------------------------

  2) Compare to other components, ActionView doesn't use `Base` for
     configuration flag. A lot of flags ares instead set on modules
     (FormHelper, FormTagHelper).
     The problem is that those module depends on AV::Base to be
     loaded, as otherwise configuration set by the user aren't applied.
     (Since the lazy load hooks hasn't been triggered)
     63ec70e700/actionview/lib/action_view/railtie.rb (L66-L69)

     We shouldn't wait for AB::Base to be loaded in order to set these
     configuration. However, we need to do it inside an
     `after_initialize` block in order to let application
     set it to the value they want.

  Closes #28538

  Co-authored-by: betesh <iybetesh@gmail.com>"
2019-12-19 17:28:24 +01:00
eileencodes
3dffacd16e Fix remaining connection_config calls
We missed these in rails/rails#38005 because deprecation warnings are
silently swallowed by these tests.

Co-authored-by: John Crepezzi <john.crepezzi@gmail.com>
2019-12-18 09:12:27 -05:00
Rafael França
6da2152d60
Merge pull request #28704 from unfunco/remove-superfluous-keep
Remove superfluous keep file
2019-12-18 11:02:26 -03:00
yuuji.yaginuma
1555fcf32c Load an application before use
Without this, `Rails.application` returns `nil`.
Ref: https://buildkite.com/rails/rails/builds/65683#e86ec58e-53a5-41be-8aeb-11c5705ee580/1042-1053
2019-12-18 18:01:02 +09:00
Ryuta Kamizono
72af0bbc3d Fix typos 2019-12-18 16:47:18 +09:00
Rafael Mendonça França
ed5f2c6192
Merge pull request #28209 from tjoyal/railties/add-config-rake_eager_load
[Railties] Add config rake_eager_load
2019-12-17 22:10:14 -03:00
Rafael França
399b7be1fc
Merge pull request #36377 from y-yagi/remove-spring-watcher-listen
Remove `spring-watcher-listen` from default Gemfile
2019-12-17 20:42:40 -03:00
Louis-Michel Couture
85cab2a319
Ensure migration generator respects primary key config in references
When rails is configured to use a specific primary key type:
```
config.generators do |g|
  g.orm :active_record, primary_key_type: :uuid
end
```

Previously:

    $ bin/rails g migration add_location_to_users location:references

The references line in the migration would not have `type: :uuid`.
This change causes the type to be applied appropriately.

Co-authored-by: Dermot Haughey <hderms@gmail.com>
2019-12-17 11:17:41 -05:00
Kasper Timm Hansen
6cde5fd30a
Merge pull request #37850
Closes #37850
2019-12-17 02:03:24 +01:00
Kasper Timm Hansen
5c3b6c73c4
Add helper method to slim down config_for test set up 2019-12-17 02:02:27 +01:00
Jean Boussier
21c7199c0f
Allow non-hash values in config files
Fix: https://github.com/rails/rails/issues/37800
2019-12-17 01:46:15 +01:00
Eileen M. Uchitelle
3578f6929b
Merge pull request #37963 from eileencodes/deprecate-config-in-dbconsole
Deprecate config in dbconsole
2019-12-16 09:27:24 -05:00
Kasper Timm Hansen
f2b69d80ab
Merge pull request #37979 from jonathanhefner/use-thor-run-env-option
Leverage new :env option for Thor::Actions#run
2019-12-15 22:08:11 +01:00
Jonathan Hefner
fe9abe4436 Leverage new :env option for Thor::Actions#run
Follow-up to #34980.

Also, refactor tests to be less brittle.
2019-12-15 13:18:06 -06:00
Kasper Timm Hansen
2da5439b85
Fix test name and test 6.1 default 2019-12-15 02:43:35 +01:00
Cédric Fabianski
7ccaa125ba
Add SameSite protection to every written cookie
Enabling `SameSite` cookie protection is an addition to CSRF protection,
where cookies won't be sent by browsers in cross-site POST requests when set to `:lax`.

`:strict` disables cookies being sent in cross-site GET or POST requests.

Passing `:none` disables this protection and is the same as previous versions albeit a `; SameSite=None` is appended to the cookie.

See upgrade instructions in config/initializers/new_framework_defaults_6_1.rb.

More info [here](https://tools.ietf.org/html/draft-west-first-party-cookies-07)

_NB: Technically already possible as Rack supports SameSite protection, this is to ensure it's applied to all cookies_
2019-12-15 01:37:24 +01:00
eileencodes
0983daa4aa Deprecate config in dbconsole
This change deprecates config in dbconsole and updates usage in the
dbconsole tests so that we can remove an accessor on the
`configuration_hash`.

Eventually we want to pass objects around everywhere instead of
hashes. Callers can use `db_config` to access the hash if necessary.

Co-authored-by: John Crepezzi <john.crepezzi@gmail.com>
2019-12-14 09:57:07 -05:00
Kasper Timm Hansen
5ded839cfb
Strip default_ prefix from retry_jitter config to match conventions 2019-12-13 01:42:58 +01:00
Cliff Pruitt
e2cdffce3d Add config option for ActiveJob::Base.default_retry_jitter 2019-12-10 12:11:46 -05:00
Edouard CHIN
bbfab0b33a Don't run AJ after_enqueue / after_perform when chain is halted:
- ### Problem

  ```ruby
    MyJob < ApplicationJob
      before_enqueue { throw(:abort) }
      after_enqueue { # enters here }
    end
  ```
  I find AJ behaviour on after_enqueue and after_perform callbacks
  weird as they get run even when the callback chain is halted.
  It's counter intuitive to run the after_enqueue callbacks even
  though the job wasn't event enqueued.

  ### Solution

  In Rails 6.2, I propose to make the new behaviour the default
  and stop running after callbacks when the chain is halted.
  For application that wants this behaviour now or in 6.1
  they can do so by adding the `config.active_job.skip_after_callbacks_if_terminated = true`
  in their configuration file.
2019-12-09 17:17:23 +01:00
kirikiriyamama
4d858b3f2a Merge shared configuration deeply 2019-12-08 22:18:08 +09:00
Peter Zhu
fbb83d78c3 Use DiskController for both public and private files 2019-12-06 16:02:16 -05:00
Edouard CHIN
33bf253282 Bring back feature that allows loading external route iles:
= This feature existed back in 2012 5e7d6bba79
  but got reverted with the incentive that there was a better approach.
  After discussions, we agreed that it's a useful feature for apps
  that have a really large set of routes.

  Co-authored-by: Yehuda Katz <wycats@gmail.com>
2019-12-06 14:20:12 +01:00
Alan Tan
767cec041d Revert "Use app.config.file_watcher for watcher in RoutesReloader"
This reverts commit 28e44f472d1cd6853726f85eeb7623e5901c4d37.

A limitation of Listen is that it currently only supports watching directories.
Therefore, watching `config/routes.rb` will end up watching the entire `config` directory
if we use the evented file watcher. This causes problems especially if symlinks are present
in the `config` directory.
2019-12-06 14:58:07 +08:00
Ryuta Kamizono
3b0c3124b1
Merge pull request #37853 from tgxworld/use_proper_file_watcher
Use `app.config.file_watcher` for watcher in `RoutesReloader`
2019-12-06 09:59:14 +09:00
Étienne Barrié
e5e9c558a3 Remove deprecated non-symbol access to nested config_for hashes 2019-12-04 09:55:56 -05:00
Alan Tan
28e44f472d Use app.config.file_watcher for watcher in RoutesReloader 2019-12-03 10:25:36 +08:00
Eileen M. Uchitelle
04fb1a651d
Merge pull request #37778 from jonathanhefner/prevent-tests-with-non-existent-routes
Prevent generating tests with non-existent routes
2019-11-25 08:56:29 -07:00
Ryuta Kamizono
d558febe32 Auto-correct rubocop offences 2019-11-24 09:54:47 +09:00
Jonathan Hefner
91adecaa9c Add :namespace option to generator route action (#37746)
* Refactor generator `route` action tests

Add `assert_routes` helper, which verifies that routes are always added
to the `Rails.application.routes.draw` block, are always indented, and
are always terminated with a newline.  This "fixes" one test that was
not testing something it claimed to, and obsoletes another test.

Also, add a test case for indentation of multi-line routing code.

* Add :namespace option to generator `route` action
2019-11-23 11:16:41 +09:00
Jonathan Hefner
ed67b71e5b Prevent generating tests with non-existent routes
This ensures generated tests are not broken by default when invoking the
controller generator with one or more actions and "--skip-routes".
2019-11-22 16:32:50 -06:00
John Hawthorn
844870038e Run yarn install in template dir
We want to yarn install in the template dir so that templates get a
yarn.lock copied over.
2019-11-14 16:47:08 -08:00
John Hawthorn
50a402b741 Fix relative file paths building app template
The app template is in a higher-level directory than
test/isolation/assets, so these paths wern't accurate.
2019-11-14 16:40:34 -08:00
John Hawthorn
75afb43a25 Use rails() instead of system() 2019-11-14 12:31:56 -08:00
John Hawthorn
60cf674af1 Fail with output if shell commands fail 2019-11-14 12:11:40 -08: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
Ryan Robeson
0d470fb0f1 Fix the collision check for the scaffold generator
Fixes #37543
2019-11-06 08:46:35 -05:00
eileencodes
042b6fec87 Appease rubocop
Rubocop wants double quoted strings, not single. I missed this when I
merged #37601
2019-11-01 15:43:43 -04:00
Edouard CHIN
c9e44d1a06 Reestablish connection to previous database after migrating:
- The migrate task iterates and establish a connection over each db
  resulting in the last one to be used by subsequent rake tasks.
  We should reestablish a connection to the connection that was
  established before the migrate tasks was run
- Fix #37578
2019-10-30 19:31:22 +01: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
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
Peter Zhu
feab7031b5 Permanent URLs for public storage blobs
Services can be configured in `config/storage.yml` with a new key
`public: true | false` to indicate whether a service holds public
blobs or private blobs. Public services will always return a
permanent URL.

Deprecates `Blob#service_url` in favor of `Blob#url`.
2019-10-11 15:14:43 -04:00
John Hawthorn
72b1ae6a5a Sprockets uses debug. not self. now 2019-10-10 14:43:03 -07:00
John Hawthorn
441917629e Link .js from manifest.js in assets_test
We no longer link JS by default, we need to modify manifest.js for that
now.
2019-10-10 14:43:03 -07:00
John Hawthorn
8d037fd3dd Remove a javascript from test 2019-10-10 14:43:03 -07:00
John Hawthorn
e63695535e Use a stylesheet instead of a javascript in test
We no longer link all js by default, so we should do this test with a
css instead (we don't care about that specifics of the dir just that its
in the manifest and in this dir).
2019-10-10 14:43:03 -07:00
John Hawthorn
5a4d4c7492 Maybe we understand index.js better now? 2019-10-10 14:43:03 -07:00
John Hawthorn
added06d3f Add a few more assertions 2019-10-10 14:43:03 -07:00
John Hawthorn
4cb93a39e2 Fix Sprockets::DoubleLinkError in test 2019-10-09 21:48:37 -07: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
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
ed78e96408
Merge pull request #37215 from utilum/avoid_test_flunking_on_warning
Avoid flunking tests on warnings in output
2019-10-07 02:22:09 +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
Masaki Hara
89f5789aad Delay ActionDispatch::Response configuration to load-time
It fixes the problem in propagating return_only_media_type_on_content_type
and fixes the corresponding test being ineffective.

The mentioned test addes the following line:
...config.action_dispatch.return_only_media_type_on_content_type = true
to the config and checks if it takes effect. However, in this scenario,
the value is already true before this line.
Moreover, the users are supposed to flip this from true to false in real
situations.

This commit flips the config in the test, making it to fail as
expected. The next commit will fix the failure.

In order for return_only_media_type_on_content_type to appropriately
take effect on ActionDispatch::Response, we want to know when
ActionDispatch::Response is loaded.
As load hooks for ActionDispatch would be too broad, the appropriate
registry is for ActionDispatch::Response itself.

Looking into other examples, a hook name is a full class name in
snake case with `_base` suffix omitted, if any. Therefore, in this case,
:action_dispatch_response seems appropriate.
2019-10-01 17:42:05 +09:00
yuuji.yaginuma
53a1e44a55 Explicitly require active_record/migration
This test class uses `ActiveRecord::IllegalMigrationNameError`.
So without this require, tests fail randomly.
https://buildkite.com/rails/rails/builds/63965#15e634e0-49a7-4658-9076-e6663458bee5/1119-1129
2019-09-29 08:07:14 +09:00
utilum
e0b8c918a0 Avoid flunking tests on warning in output 2019-09-28 12:52:31 +02:00
John Crepezzi
4e66e2dffc Update test to avoid Puma output format change
We are seeing some test failures for this test in #37291. It looks like
what's going on is that Puma has changed the output for this command
between 4.1 and 4.2

Previously:

```
...
* Environment: development
* Listening on tcp://localhost:3000
...

```

Now:

```
...
* Environment: development
* Listening on tcp://127.0.0.1:3000
* Listening on tcp://[::1]:3000
...

```

So to get around this, instead of checking the binding address, just
check for the presence of 'Listening' generally like we do on server
start.

Co-authored-by: eileencodes <eileencodes@gmail.com>
2019-09-25 13:11:58 -04:00
Jean Boussier
48c716bbfa Instantiate ConnectionPool with a DatabaseConfig rather than a ConnectionSpecification 2019-09-24 15:12:22 +02:00
John Crepezzi
b8b2d40659 Make all reads on configuration_hash use methods
Convert all uses of `db_config.configuration_hash[*]` to use methods
defined on an implementation of `DatabaseConfigurations::DatabaseConfig`.

Since we want to get away from accessing properties directly on the
underlying configuration hash, we'll move here to accessing those values
via the implementations on `DatabaseConfig` (or more specifically,
`HashConfig`).

There are still codepaths that are passing around `configuration_hash`,
and follow-on PRs will address those with the goal of using
configuration objects everywhere up until the point we pass a resolved
hash over to the underlying client.

Co-authored-by: eileencodes <eileencodes@gmail.com>
2019-09-23 16:46:05 -04: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
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
Eileen M. Uchitelle
9b6433bb82
Merge pull request #37199 from seejohnrun/reduce-surface-area-of-connection-specification
Reduce surface area of ConnectionSpecification
2019-09-16 09:35:22 -04:00
Akira Matsuda
9bce8c3c02 form_authenticity_token takes keyword arguments 2019-09-15 03:05:52 +09:00
eileencodes
b8fc0150d6 Reduce surface area of ConnectionSpecification
Eventually we'd like to get rid of this class altogether but for now
this PR reduces the surface area by removing methods from the class and
moving classes out into their own files.

* `adapter_method` was moved into database configurations
* `initialize_dup` was removed because it was only used in tests
* Resolver is now it's own class under connection adapters
* ConnectionUrlResolver, only used by the configurations, is in a class
under DatabaseConfigurations

Co-authored-by: John Crepezzi <john.crepezzi@gmail.com>
2019-09-13 22:05:02 -04: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
Akira Matsuda
352560308b Fix keyword arguments warnings 2019-09-09 22:49:09 +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
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
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
Rafael Mendonça França
b5a52ad55b Fix the test to check for the right config 2019-08-15 18:39:46 -04:00
John Hawthorn
79953c476c Allow tests to run without a TTY
We had two tests which assigned IO.console.winsize (to ensure output was
consistent), however it's possible for IO.console to be nil.

This commit makes these tests stub IO.console_size directly (the method
we actually call, we shouldn't have been relying on that calling
IO.console.winsize anyways) or passes the width when initializing the
class.

This allows tests to run without a TTY. This can be tested with ex.

    ssh localhost "cd src/rails/actionpack && bundle exec rake"

or

    (setsid bundle exec rake) </dev/null |& cat
2019-08-14 10:52:21 -07:00
Andrew Kress
36beec7b55 add test to check we read new path correctly 2019-08-14 12:36:59 -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
John Hawthorn
ba093a5ada Sync test DB from schema using its SHA1
Previously, we used the migration status to determine whether the test
database(s) needed to be reloaded from the schema. This worked in most
cases, but if a schema.rb was modified outside of migrations or if a
migration was rolled back, it would require a manual db:test:prepare.

This commit updates load_schema to record the SHA1 of the loaded schema
file inside of the ar_internal_metadata table. We can then use this SHA
to determine whether we should reload the schema.

This ensures that the test DB stays exactly in sync with the schema
file, including rollbacks which fixes a test marked TODO.
2019-08-06 12:44:22 -07: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
Rafael Mendonça França
967beb7229
Revert "MethodCallAssertions is a regular player of the team ActiveSupport::TestCase now"
This reverts commit 98d0f7ebd34b858f12a12dcf37ae54fdbb5cab64.
2019-08-02 00:24:21 -04:00
Rafael Mendonça França
6384933994
Revert "You give jruby_skip & rubinius_skip a good name"
This reverts commit 8d2866bb80fbe81acb04f5b0c44f152f571fb29f.
2019-08-02 00:24:11 -04:00
Akira Matsuda
8d2866bb80 You give jruby_skip & rubinius_skip a good name
This hack prevails everywhere in the codebase by being copy & pasted, and it's actually not a negative thing but a necessary thing for framework implementors,
so it should better have a name and be a thing.

And with this commit, activesupport/test/abstract_unit.rb now doesn't silently autoload AS::TestCase,
so we're ready to establish clearner environment for running AS tests (probably in later commits)
2019-08-02 05:36:38 +09:00
Akira Matsuda
98d0f7ebd3 MethodCallAssertions is a regular player of the team ActiveSupport::TestCase now
It's used everywhere, clean and mature enough
2019-08-02 05:36:15 +09:00
Akira Matsuda
af2129b4c7 Use try only when we're unsure if the receiver would respond_to the method 2019-08-01 17:58:00 +09:00
eileencodes
cd148be072 Fix db:seed
The `rake db:seed` command was broken for the primary environment if the
application is using multiple databases. We never implemented `rake
db:seed` for other databases (coming soon), but that shouldn't break the
default case.

The reason this was broken was because `abort_if_pending_migrations`
would loop through the configs for all databases and check for
migrations but would leave the last established connection. So `db:seed`
was looking in the wrong database for the table to seed.

This PR doesn't fix the fact that `db:seed` doesn't work for multiple
databases but does fix the default case.

Fixes #36817

Co-authored-by: John Crepezzi <john.crepezzi@gmail.com>
2019-07-31 12:22:01 -04:00
Ryuta Kamizono
4c8c8c87b0 Address to rubocop offences 2019-07-31 17:48:14 +09:00
Akira Matsuda
0196551e60 Use match? where we don't need MatchData 2019-07-29 14:23:10 +09:00
Xavier Noria
bfc9065d58 Improves compatibility of require_dependency in zeitwerk mode [Closes #36774]
Applications are not supposed to use require_dependency in their own
code if running in zeitwerk mode, and require_dependency was initially
aliased to require with that use case in mind.

However, there are situations in which you cannot control the mode and
need to be compatible with both. There, you might need require_dependency
in case you are being executed in classic mode. Think about engines that
want to support both modes in their parent applications, for example.

Furthermore, Rails itself loads helpers using require_dependency.

Therefore, we need better compatibility.
2019-07-28 14:09:01 +02:00
yuuji.yaginuma
6f35244def Do not use the same temp file in different tests
It causes unexpected results when running tests in parallel.
Ref: https://buildkite.com/rails/rails/builds/62610#0165f6d9-b9c8-4948-9319-07b58bfbfd4f/989-998
2019-07-27 12:37:09 +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
Abhay Nikam
8fdf6d934e Removed webpacker:compile step from scaffold test as it is not required and assets are already precompiled in build_app step 2019-07-26 20:20:07 +05:30
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
Xavier Noria
59c6d29ffa let autoloaded? support modules with overridden names [closes #36757] 2019-07-25 23:14:29 +02: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
Eileen M. Uchitelle
bee689dad9
Merge pull request #36741 from Edouard-chin/ec-system-test-url-options
Define the `url_options` needed for SytemTest inside the route proxy:
2019-07-24 08:16:23 -04:00
Wojciech Wnętrzak
5c1f6d1ff6
Fixed db:prepare task to not touch schema when dump_schema_after_migration is false. 2019-07-24 09:19:13 +02:00
Edouard CHIN
e6cf57df8a Define the url_options needed for SytemTest inside the route proxy:
- I made a change in https://github.com/rails/rails/pull/36691 to
  delegate route helper to a proxy class.
  This didn't take into account that the `url_options` we redefine
  in SystemTest would be ignored.

  This PR fixes that by definin the url_options inside the proxy
2019-07-24 01:18:00 +02:00
Gannon McGibbon
3cf65bcb8e Make Active Storage routes optional
Add configuration option to turn off drawing of Active Storage routes.
2019-07-22 12:35:04 -04: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
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
igor04
0fa41f72fc Prevent exception of loading database yaml with blank config file [closes: #36661] 2019-07-12 19:23:09 +03: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
yuuji.yaginuma
4b621df384 Make bin/setup test pass even if the database does not exist 2019-06-30 10:15:26 +09:00
eileencodes
df6b0de7d9 Load initial database.yml once, and warn if we can't create tasks
For multiple databases we attempt to generate the tasks by reading the
database.yml before the Rails application is booted. This means that we
need to strip out ERB since it could be reading Rails configs.

In some cases like https://github.com/rails/rails/issues/36540 the ERB
is too complex and we can't overwrite with the DummyCompilier we used in
https://github.com/rails/rails/pull/35497. For the complex causes we
simply issue a warning that says we couldn't infer the database tasks
from the database.yml.

While working on this I decided to update the code to only load the
database.yml once initially so that we avoid having to issue the same
warning multiple times. Note that this had no performance impact in my
testing and is merely for not having to save the error off somewhere.
Also this feels cleaner.

Note that this will not break running tasks that exist, it will just
mean that tasks for multi-db like `db:create:other_db` will not be
generated. If the database.yml is actually unreadable it will blow up
during normal rake task calls.

Fixes #36540
2019-06-27 09:54:25 -04: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
Yuji Yaginuma
bf625f7fec
Merge pull request #36486 from benthorner/master
Allow using env var to specify pidfile
2019-06-20 11:52:21 +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
eileencodes
7cc27d749c Move SchemaMigration to migration_context
This PR moves the `schema_migration` to `migration_context` so that we
can access the `schema_migration` per connection.

This does not change behavior of the SchemaMigration if you are using
one database. This also does not change behavior of any public APIs.
`Migrator` is private as is `MigrationContext` so we can change these as
needed.

We now need to pass a `schema_migration` to `Migrator` so that we can
run migrations on the right connection outside the context of a rake
task.

The bugs this fixes were discovered while debugging the issues around
the SchemaCache on initialization with multiple database. It was clear
that `get_all_versions` wouldn't work without these changes outside the
context of a rake task (because in the rake task we establish a
connection and change AR::Base.connection to the db we're running on).

Because the `SchemaCache` relies on the `SchemaMigration` information we
need to make sure we store it per-connection rather than on
ActiveRecord::Base.

[Eileen M. Uchitelle & Aaron Patterson]
2019-06-14 11:15:08 -04:00
Ryuta Kamizono
98a57aa5f6
Merge pull request #36472 from kamipo/empty_line_only_before_access_modifier
Enable `Layout/EmptyLinesAroundAccessModifier` cop
2019-06-13 18:36:23 +09:00
Ryuta Kamizono
75eb3d0cec Don't drop_table before schema cache tests
Since 5cab34449, `drop_table` clears schema cache.
2019-06-13 13:43:26 +09: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
Mark Lee
cb8b57d07e Convert the db:abort_if_pending_migrations task to be multi-DB aware 2019-06-10 18:01:32 -07:00
Eileen M. Uchitelle
ccb30615a3
Merge pull request #36416 from freeletics/fix-db-prepare
Fixed db:prepare task for multiple databases.
2019-06-05 10:31:52 -04:00
Eileen M. Uchitelle
71a019efe8
Merge pull request #36394 from eileencodes/treat-application-record-as-primary
Treat ActiveRecord::Base and ApplicationRecord as "primary"
2019-06-05 10:01:18 -04:00
eileencodes
2f8b397258 Treat ActiveRecord::Base and ApplicationRecord as "primary"
When someone has a multi-db application their `ApplicationRecord` will
look like:

```ruby
class ApplicationRecord < ActiveRecord::Base
  self.abstract_class = true

  connects_to database: { writing: :primary, reading: :replica }
end
```

This will cause us to open 2 connections to ActiveRecord::Base's
database when we actually only want 1. This is because Rails sees
`ApplicationRecord` and thinks it's a new connection, not the existing
`ActiveRecord::Base` connection because the
`connection_specification_name` is different.

This PR changes `ApplicationRecord` classes to consider themselves the
same as the "primary" connection.

Fixes #36382
2019-06-05 09:29:29 -04:00
Wojciech Wnętrzak
87796b3c81
Fixed db:prepare task for multiple databases.
When one database existed already, but not the other,
during setup of missing one, existing database was wiped out.
2019-06-05 12:17:02 +02: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
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
John Hawthorn
9fd02d181a Fail parallel tests if workers exit early
Previously, if a test worker exited early, the in-flight test it was
supposed to run wasn't reported as a failure.

If all workers exited immediately, this would be reported as ex.

    Finished in 1.708349s, 39.2192 runs/s, 79.0237 assertions/s.
    67 runs, 135 assertions, 0 failures, 0 errors, 2 skips

This commit validates that all workers finish running tests by ensuring
that the queue is empty after they exit. This works because we signal
the workers to exit by pushing nil onto the queue, so that there should
be a number of items left in the queue matching potentially missed
tests.
2019-05-30 21:34:47 -07: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
Gannon McGibbon
e84ee74854 Merge branch 'migration-timestamp-fix'
Closes #28707.
2019-05-10 16:45:46 -04:00
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
Eileen M. Uchitelle
d155f61b64 Merge pull request #36196 from st0012/fix-29947
Hide malformed parameters from error page

Accidentally merged this to 6-0-stable so forward porting it to master
here instead.
2019-05-07 15:14:14 -04:00
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
Xavier Noria
b6e17b6a4b new config to opt-out from adding app directories to $LOAD_PATH 2019-04-28 13:48:26 +02: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
1b2efe5a11 upgrades Zeitwerk to 2.1.4
This commit more or less undoes 9b5401f, restores autoloaded? not to
touch the descendants tracker, and autoloaded_constants because it is
documented in the guide.
2019-04-23 01:18:21 +02:00
Rafael França
b62b038d9a
Revert "Include Caching module for ActionController::API" 2019-04-22 17:20:48 -04:00
Guillermo Iguaran
216ef01d14
Merge pull request #36038 from st0012/fix-35602
Include Caching module for ActionController::API
2019-04-22 16:05:51 -05:00
Richard Macklin
ef12ccfd8b Make system tests take failed screenshots in before_teardown hook
Previously we were calling the `take_failed_screenshot` method in an
`after_teardown` hook. However, this means that other teardown hooks
have to be executed before we take the screenshot. Since there can be
dynamic updates to the page after the assertion fails and before we
take a screenshot, it seems desirable to minimize that gap as much as
possible. Taking the screenshot in a `before_teardown` rather than an
`after_teardown` helps with that, and has a side benefit of allowing
us to remove the nested `ensure` commented on here:
https://github.com/rails/rails/pull/34411#discussion_r232819478
2019-04-20 19:32:30 -07:00
Gannon McGibbon
d3dc651a81
Merge pull request #35896 from jlw/bug/active-jobless-seeds
[#35782] Allow loading seeds without ActiveJob (~> 5.2.3)
2019-04-20 12:39:03 +09:00
yuuji.yaginuma
21747560be Remove duplicated test
With 8b4d344815655027d9f7584c0a59271dce8f1d5a, `test_required_polymorphic_belongs_to_generates_correct_model`
and `test_required_and_polymorphic_are_order_independent` are completely
same. Also, remove `required` from test name because that not passed to
generator.
2019-04-20 09:30:22 +09:00
eileencodes
f9244c6585 Handle up/down for multiple databases
This change adds the ability to run up/down for a database in a multi-db
environment.

If you have an app with a primary and animals database the following
tasks will be generated:

```
VERSION=123 rake db:migrate:up:primary
VERSION=123 rake db:migrate:up:primary

VERSION=123 rake db:migrate:down:primary
VERSION=123 rake db:migrate:up:animals
```

I didn't generate descriptions with them since we don't generate a
description for a single database application.

In addition to this change I've made it so if your application has
multiple databases Rails will raise if you try to run `up` or `down`
without a namespace. This is because we don't know which DB you want to
run `up` or `down` against unless the app tells us, so it's safer to
just block it and recommend using namespaced versions of up/down
respectively.

The output for the raise looks like:

```
You're using a multiple database application. To use `db:migrate:down`
you must run the namespaced task with a VERSION. Available tasks are
db:migrate:down:primary and db:migrate:down:animals.
```
2019-04-19 13:14:24 -04: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
st0012
7814d1c0ae Make sure api controllers can perform caching as well
Currently ActionController::API doesn't include Caching module, so it
can't perform caching. And even if users include it later manually, it
won't inherit application's default cache store for action_controllers.
So the only way to solve this issue is to include Caching module in
ActionController::API, too.

This closes #35602
2019-04-19 22:50:42 +09:00
Genadi Samokovarov
54df392bc5 Manage ActionDispatch::ActionableExceptions from the default middleware stack 2019-04-19 14:15:22 +09:00
Abhay Nikam
cc75e58759 Fix typo in test description from generages -> generates 2019-04-17 22:42:16 +05:30
Kasper Timm Hansen
99c520ac4a
Only retry tests on CI 2019-04-17 01:10:45 +02:00
Kasper Timm Hansen
f0b2a60536
Fix bin/update references after 8927eba83c 2019-04-17 01:05:05 +02: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
Rafael França
19df75dc3d
Merge pull request #35997 from tjoyal/Rails/MailersController/do-not-leak-I18n-global-setting-changes
[Rails::MailersController] Do not leak I18n global setting changes
2019-04-16 15:45:20 -04:00
Thierry Joyal
963d11a000 [Rails::MailersController] Do not leak I18n global setting changes 2019-04-16 18:54:51 +00:00
utilum
742d2b2c66 Squash warning: possibly useless use of a constant
in void context
2019-04-16 18:45:25 +02:00
John Hawthorn
0bab6310d6 Find query_source_location using lazy Enumerator
This way, we only need to filter the backtrace up to the first non-noise
stack frame.

This also updates noise to be able to deal with being passed a lazy
enum. We don't need this anywhere, but it seemed better for this to be
consistent.
2019-04-15 16:13:06 -07:00
Rafael França
fbb8b68403
Merge pull request #35977 from prathamesh-sonpatki/rm-required-in-generators
Remove `required: true` from the model generator template
2019-04-15 18:11:55 -04: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
Prathamesh Sonpatki
76c1528c5f
Remove required: true from the model generator template
`belongs_to` association have `required: true` by default
https://github.com/rails/rails/pull/18937 onwards so we don't need it
in the generator template.
We still need the code for required in the command line generator as
it adds `null: false` in the migration.
2019-04-15 20:27:55 +05:30
yuuji.yaginuma
4ff2c934b5 Correctly set application path in test_app_update_does_not_change_config_target_version
This is the follow up of 10fa3b3792153c2a213f837bcf51bbf6844c1661.
2019-04-15 11:10:51 +09:00
yuuji.yaginuma
10fa3b3792 Make test application the same state as app:update
In `app:update`, it is decided whether to skip depending on whether
`Spring` is defined or not.
However, `spring` is not currently specified in Gemfile. As a result,
`app:update` determines that `Spring` is not used, and diff appears in
the result file.
If there is a difference, the console for processing the difference is
output and the test stops. To avoid this, do not include `Spring` in app.

This is a bit strange approach, so I will revisit this later.
2019-04-15 10:44:21 +09:00
Yuji Yaginuma
3a67d9b6c1
Merge pull request #35967 from ryohashimoto/do_not_app_update_in_app_generator_test
Do not execute `rails app:update` in railties/test/generators/app_generator_test.rb
2019-04-15 09:54:23 +09:00
yuuji.yaginuma
f1a354466d Fix broken AppGeneratorTest#test_spring_no_fork
The mock is called three times because the `spring_install?` call has
been added in 65344f254cde87950c7f176cb7aa09c002a6f882.
2019-04-15 08:03:45 +09:00