aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/initializer.rb
diff options
context:
space:
mode:
authorDavid Dollar <ddollar@gmail.com>2009-04-29 01:22:54 -0400
committerJeremy Kemper <jeremy@bitsweat.net>2009-04-28 23:16:47 -0700
commit599f2cfb4a0e0ec4135265bf5c56b83f1450beea (patch)
tree6fc10537aff67cb2b38f431e027a5ddc02fefef2 /railties/lib/initializer.rb
parentacd5db300b755d5abae2748f239441fb865c6b62 (diff)
downloadrails-599f2cfb4a0e0ec4135265bf5c56b83f1450beea.tar.gz
rails-599f2cfb4a0e0ec4135265bf5c56b83f1450beea.tar.bz2
rails-599f2cfb4a0e0ec4135265bf5c56b83f1450beea.zip
Attempt to deal with more cases of gems with native components.
This commit adds a rudimentary check for 'unbuilt' gems, so that we can abort the application load if there are any gems that have native components that have not yet been built. The rake task gems:build has now only builds 'unbuilt' gems as a result. The rake task gems:build:force has been added to deal with cases of incomplete builds, or any case where you need to force the build of all of your gems. Changes the gems:build task to get its gem list by parsing directory entries in vendor/gems, which sidesteps the chicken/egg issues involved with having a gem unpacked into vendor/gems without before its native bits are compiled. [#2266 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'railties/lib/initializer.rb')
-rw-r--r--railties/lib/initializer.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb
index 1bd7baed62..71366a4480 100644
--- a/railties/lib/initializer.rb
+++ b/railties/lib/initializer.rb
@@ -156,6 +156,8 @@ module Rails
add_support_load_paths
+ check_for_unbuilt_gems
+
load_gems
load_plugins
@@ -308,6 +310,25 @@ module Rails
end
end
+ def check_for_unbuilt_gems
+ unbuilt_gems = @configuration.gems.select(&:frozen?).reject(&:built?)
+ if unbuilt_gems.size > 0
+ # don't print if the gems:build rake tasks are being run
+ unless $gems_build_rake_task
+ abort <<-end_error
+The following gems have native components that need to be built
+ #{unbuilt_gems.map { |gem| "#{gem.name} #{gem.requirement}" } * "\n "}
+
+You're running:
+ ruby #{Gem.ruby_version} at #{Gem.ruby}
+ rubygems #{Gem::RubyGemsVersion} at #{Gem.path * ', '}
+
+Run `rake gems:build` to build the unbuilt gems.
+ end_error
+ end
+ end
+ end
+
def check_gem_dependencies
unloaded_gems = @configuration.gems.reject { |g| g.loaded? }
if unloaded_gems.size > 0