mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Don't require rails/gem_builder during rails initialization, it's only needed for the gems:build task. [rick]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9240 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
7e94cf7f4d
commit
0bea3f8391
5 changed files with 17 additions and 7 deletions
|
@ -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]
|
||||
|
|
|
@ -7,7 +7,6 @@ require 'railties_path'
|
|||
require 'rails/version'
|
||||
require 'rails/plugin/locator'
|
||||
require 'rails/plugin/loader'
|
||||
require 'rails/gem_builder'
|
||||
require 'rails/gem_dependency'
|
||||
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
require 'rubygems'
|
||||
require 'rubygems/installer'
|
||||
|
||||
module Rails
|
||||
|
|
|
@ -14,8 +14,7 @@ module Rails
|
|||
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 @@ module Rails
|
|||
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 @@ module Rails
|
|||
$!.backtrace.each { |b| puts b }
|
||||
end
|
||||
|
||||
def frozen?
|
||||
@frozen
|
||||
end
|
||||
|
||||
def loaded?
|
||||
@loaded
|
||||
end
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue