diff options
author | Matt Jones <al2o3cr@gmail.com> | 2009-02-20 14:16:07 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-02-20 14:16:07 -0600 |
commit | 01c818e99f04f70462df68e6a217dfd280c37581 (patch) | |
tree | a68d3e724dca4c09c5d517a08449ce822f23f378 | |
parent | 6bf9b69bdeaba794d6ec55a6501723d24e7f98e0 (diff) | |
download | rails-01c818e99f04f70462df68e6a217dfd280c37581.tar.gz rails-01c818e99f04f70462df68e6a217dfd280c37581.tar.bz2 rails-01c818e99f04f70462df68e6a217dfd280c37581.zip |
break out of initializer early if gems aren't loaded [#1750 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
-rw-r--r-- | railties/lib/initializer.rb | 6 | ||||
-rw-r--r-- | railties/lib/tasks/gems.rake | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index 7e1bd23a55..8221f1f2f2 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -167,6 +167,10 @@ module Rails load_gems check_gem_dependencies + # bail out if gems are missing - note that check_gem_dependencies will have + # already called abort() unless $gems_rake_task is set + return unless gems_dependencies_loaded + load_application_initializers # the framework is now fully initialized @@ -302,7 +306,7 @@ module Rails if unloaded_gems.size > 0 @gems_dependencies_loaded = false # don't print if the gems rake tasks are being run - unless $rails_rake_task + unless $gems_rake_task abort <<-end_error Missing these required gems: #{unloaded_gems.map { |gem| "#{gem.name} #{gem.requirement}" } * "\n "} diff --git a/railties/lib/tasks/gems.rake b/railties/lib/tasks/gems.rake index e6731ab78c..d538e52ca6 100644 --- a/railties/lib/tasks/gems.rake +++ b/railties/lib/tasks/gems.rake @@ -17,13 +17,13 @@ end namespace :gems do task :base do - $rails_rake_task = true + $gems_rake_task = true Rake::Task[:environment].invoke end desc "Build any native extensions for unpacked gems" task :build do - $rails_rake_task = true + $gems_rake_task = true require 'rails/gem_builder' Dir[File.join(Rails::GemDependency.unpacked_path, '*')].each do |gem_dir| spec_file = File.join(gem_dir, '.specification') |