This project is archived and is in readonly mode.
Observed Model Dependent on App Initializer Causes rake gems:install Failure
-
20
- Tag changed from 2.1, gems, initializer, install, observer, rake to 2.1, gems, initializer, install, observer, patch, rake
- Assigned user set to Rick
Agreed, this does look like a problem. Solved by using preinitializer.rb to monkeypatch.
Rails::Boot.class_eval do def run load_initializer Rails::Initializer.class_eval do def prepare_dispatcher return unless configuration.frameworks.include?(:action_controller) && @gems_dependencies_loaded require 'dispatcher' unless defined?(::Dispatcher) Dispatcher.define_dispatcher_callbacks(configuration.cache_classes) Dispatcher.new(Rails.logger).send :run_callbacks, :prepare_dispatch end end Rails::Initializer.run(:set_load_path) end endattaching patch.
-
20
I forgot to add... test run a-ok and i believe this makes gem dependencies work more like they're expected to (at least to me). Thanks for digging it up, Bill.
-
Matt Jones
Can you try the patch in #1750 (against 2.3, unfortunately)? It breaks out of the initializer entirely if gems are missing in a gem rake task.
-
Steven Soroka
Honestly, I don't get why rails tries to load the environment at all without the initializers. It utterly and completely fails in my project and makes gem "management" with config.gem completely useless.
gem tasks should not require the environment to run successfully, imho.
-
Pratik
- Assigned user changed from Rick to Matt Jones
-
Ryan Bigg
- State changed from new to resolved
- Tag changed from 2.1, gems, initializer, install, observer, patch, rake to 2.1
- Importance changed from to
This ticket hasn't received an update in over a year and will be closed. If this is still an issue, please reply and I will re-open it.
