Skip to content

Commit

Permalink
break out of initializer early if gems aren't loaded [rails#1750 stat…
Browse files Browse the repository at this point in the history
…e:resolved]

Signed-off-by: Joshua Peek <josh@joshpeek.com>
  • Loading branch information
al2o3cr authored and josh committed Feb 20, 2009
1 parent 6bf9b69 commit 01c818e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 5 additions & 1 deletion railties/lib/initializer.rb
Expand Up @@ -167,6 +167,10 @@ def process
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
Expand Down Expand Up @@ -302,7 +306,7 @@ def check_gem_dependencies
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 "}
Expand Down
4 changes: 2 additions & 2 deletions railties/lib/tasks/gems.rake
Expand Up @@ -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')
Expand Down

0 comments on commit 01c818e

Please sign in to comment.