Browse files

Don't require rails/gem_builder during rails initialization, it's onl…

…y needed for the gems:build task. [rick]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9240 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 7e94cf7 commit 0bea3f8391e985157f3aecdf50a5d61de7aa7f0c @technoweenie technoweenie committed Apr 8, 2008
View
2 railties/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Don't require rails/gem_builder during rails initialization, it's only needed for the gems:build task. [rick]
+
* script/performance/profiler compatibility with the ruby-prof >= 0.5.0. Closes #9176. [Catfish]
* Flesh out rake gems:unpack to unpack all gems, and add rake gems:build for native extensions. #11513 [ddollar]
View
1 railties/lib/initializer.rb
@@ -7,7 +7,6 @@
require 'rails/version'
require 'rails/plugin/locator'
require 'rails/plugin/loader'
-require 'rails/gem_builder'
require 'rails/gem_dependency'
View
1 railties/lib/rails/gem_builder.rb
@@ -1,3 +1,4 @@
+require 'rubygems'
require 'rubygems/installer'
module Rails
View
8 railties/lib/rails/gem_dependency.rb
@@ -14,8 +14,7 @@ def initialize(name, options = {})
end
@lib = options[:lib]
@source = options[:source]
- @loaded = false
- @load_paths_added = false
+ @loaded = @frozen = @load_paths_added = false
@unpack_directory = nil
end
@@ -28,6 +27,7 @@ def add_load_paths
gem *args
else
$LOAD_PATH << File.join(unpacked_paths.first, 'lib')
+ @frozen = true
end
@load_paths_added = true
rescue Gem::LoadError
@@ -47,6 +47,10 @@ def load
$!.backtrace.each { |b| puts b }
end
+ def frozen?
+ @frozen
+ end
+
def loaded?
@loaded
end
View
12 railties/lib/tasks/gems.rake
@@ -1,13 +1,18 @@
desc "List the gems that this rails application depends on"
task :gems => :environment do
Rails.configuration.gems.each do |gem|
- puts "[#{gem.loaded? ? '*' : ' '}] #{gem.name} #{gem.requirement.to_s}"
+ code = gem.loaded? ? (gem.frozen? ? "F" : "I") : " "
+ puts "[#{code}] #{gem.name} #{gem.requirement.to_s}"
end
+ puts
+ puts "I = Installed"
+ puts "F = Frozen"
end
namespace :gems do
desc "Build any native extensions for unpacked gems"
task :build do
+ require 'rails/gem_builder'
Dir[File.join(RAILS_ROOT, 'vendor', 'gems', '*')].each do |gem_dir|
spec_file = File.join(gem_dir, '.specification')
next unless File.exists?(spec_file)
@@ -26,12 +31,11 @@ namespace :gems do
end
desc "Unpacks the specified gem into vendor/gems."
- task :unpack do
- Rake::Task["environment"].invoke
+ task :unpack => :environment do
require 'rubygems'
require 'rubygems/gem_runner'
Rails.configuration.gems.each do |gem|
- next unless ENV['GEM'].blank? || ENV['GEM'] == gem.name
+ next unless !gem.frozen? && (ENV['GEM'].blank? || ENV['GEM'] == gem.name)
gem.unpack_to(File.join(RAILS_ROOT, 'vendor', 'gems')) if gem.loaded?
end
end

0 comments on commit 0bea3f8

Please sign in to comment.