rails/railties/lib/rails
eileencodes 4e663c1e8d Refactor configs_for and friends
Moves the configs_for and DatabaseConfig struct into it's own file. I
was considering doing this in a future refactoring but our set up forced
me to move it now. You see there are `mattr_accessor`'s on the Core
module that have default settings. For example the `schema_format`
defaults to Ruby. So if I call `configs_for` or any methods in the Core
module it will reset the `schema_format` to `:ruby`. By moving it to
it's own class we can keep the logic contained and avoid this
unfortunate issue.

The second change here does a double loop over the yaml files. Bear with
me...

Our tests dictate that we need to load an environment before our rake
tasks because we could have something in an environment that the
database.yml depends on. There are side-effects to this and I think
there's a deeper bug that needs to be fixed but that's for another
issue. The gist of the problem is when I was creating the dynamic rake
tasks if the yaml that that rake task is calling evaluates code (like
erb) that calls the environment configs the code will blow up because
the environment is not loaded yet.

To avoid this issue we added a new method that simply loads the yaml and
does not evaluate the erb or anything in it. We then use that yaml to
create the task name. Inside the task name we can then call
`load_config` and load the real config to actually call the code
internal to the task. I admit, this is gross, but refactoring can't all
be pretty all the time and I'm working hard with `@tenderlove` to
refactor much more of this code to get to a better place re connection
management and rake tasks.
2018-03-21 16:54:24 -04:00
..
api [Railties] require_relative => require 2017-10-21 22:48:26 +09:00
application Refactor configs_for and friends 2018-03-21 16:54:24 -04:00
command Extract Rails::Command::Spellchecker 2018-03-04 17:50:37 +02:00
commands Merge pull request #32271 from eileencodes/fix-three-tier-default-connection 2018-03-16 15:18:26 -04:00
console Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +02:00
engine [Railties] require_relative => require 2017-10-21 22:48:26 +09:00
generators Remove path option from AzureStorage config 2018-03-13 08:20:28 +09:00
plugin [Railties] require_relative => require 2017-10-21 22:48:26 +09:00
rack Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +02:00
railtie Clarify that config.eager_load controls eager loading [ci skip] 2017-12-30 22:37:44 +00:00
tasks Move rake routes task to rails command 2018-02-27 15:22:38 +01:00
templates Fix locale_selector JS bug in ActionMailer Preview 2018-01-23 09:32:49 +09:00
test_unit Need to use klass to get the class name of the test result 2018-01-03 17:37:15 +09:00
all.rb Add --skip-active-storage and do so automatically when --skip-active-record is used 2017-11-06 21:08:51 +00:00
app_loader.rb [Railties] require_relative => require 2017-10-21 22:48:26 +09:00
app_updater.rb Add --skip-active-storage and do so automatically when --skip-active-record is used 2017-11-06 21:08:51 +00:00
application_controller.rb Always yield a CSP policy instance 2018-03-08 14:14:09 +00:00
application.rb Add support for automatic nonce generation for Rails UJS 2018-02-19 15:59:34 +00:00
backtrace_cleaner.rb Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +02:00
cli.rb [Railties] require_relative => require 2017-10-21 22:48:26 +09:00
code_statistics_calculator.rb Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +02:00
code_statistics.rb [Railties] require_relative => require 2017-10-21 22:48:26 +09:00
command.rb Extract Rails::Command::Spellchecker 2018-03-04 17:50:37 +02:00
commands.rb [Railties] require_relative => require 2017-10-21 22:48:26 +09:00
configuration.rb [Railties] require_relative => require 2017-10-21 22:48:26 +09:00
dev_caching.rb Make restart and dev:cache tasks work when customizing pid file path 2017-08-21 05:44:11 +09:00
engine.rb [Railties] require_relative => require 2017-10-21 22:48:26 +09:00
gem_version.rb Start Rails 6.0 development!!! 2018-01-30 18:51:17 -05:00
generators.rb Extract Rails::Command::Spellchecker 2018-03-04 17:50:37 +02:00
info_controller.rb [Railties] require_relative => require 2017-10-21 22:48:26 +09:00
info.rb Refactor migration to move migrations paths to connection 2018-01-18 08:55:03 -05:00
initializable.rb Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +02:00
mailers_controller.rb Add locale selector to email preview (#31596) 2018-01-18 15:22:10 -05:00
paths.rb Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +02:00
rack.rb Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +02:00
railtie.rb [Railties] require_relative => require 2017-10-21 22:48:26 +09:00
ruby_version_check.rb Rails 6 requires Ruby 2.4.1+ 2018-02-17 15:34:57 -08:00
secrets.rb Remove usage of strip_heredoc in the framework in favor of <<~ 2018-02-16 19:28:30 -05:00
source_annotation_extractor.rb Fix spaces in the comment block [ci skip] 2017-08-23 06:27:29 +09:00
tasks.rb Move rake routes task to rails command 2018-02-27 15:22:38 +01:00
test_help.rb Add test parallelization to Rails 2018-02-15 19:21:24 -05:00
version.rb Adding frozen_string_literal pragma to Railties. 2017-08-14 19:08:09 +02:00
welcome_controller.rb [Railties] require_relative => require 2017-10-21 22:48:26 +09:00