aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/gem_dependency.rb
diff options
context:
space:
mode:
authorMatt Jones <al2o3cr@gmail.com>2009-06-06 17:59:33 -0400
committerMichael Koziarski <michael@koziarski.com>2009-06-09 19:57:38 +1200
commit41a94048e55e082f373e19d9fcee311860aaba9e (patch)
tree7a144fd203dd270e0674188306397c1f8165274f /railties/lib/rails/gem_dependency.rb
parentf68cc639f57a9fc261a2e432d1fdd749146d689d (diff)
downloadrails-41a94048e55e082f373e19d9fcee311860aaba9e.tar.gz
rails-41a94048e55e082f373e19d9fcee311860aaba9e.tar.bz2
rails-41a94048e55e082f373e19d9fcee311860aaba9e.zip
Fix several issues with the 2.3.2 gem loader.
Incorporates the following: - migrates back small change to gems:build:force from bfc1609a501fc3ed442685819de5bcdb5fbada1c to finish closing #2266. - unrolls to_proc calls in gems.rake, to match the change in master. - fixes #2722 by passing the options hash to dependencies during build. (includes a test) - fixes #2721 by loading the specification directly in from_directory_name. Adds an option to opt-out of specification loading when needed (in gems:refresh_specs, for instance). Includes tests. - fixes #2679 by refreshing specs for all frozen gems rather than just gems loaded from the environment. - fixes #2678 by passing the options hash to dependencies during unpack. Signed-off-by: Michael Koziarski <michael@koziarski.com>
Diffstat (limited to 'railties/lib/rails/gem_dependency.rb')
-rw-r--r--railties/lib/rails/gem_dependency.rb20
1 files changed, 16 insertions, 4 deletions
diff --git a/railties/lib/rails/gem_dependency.rb b/railties/lib/rails/gem_dependency.rb
index ee3d0d81ba..3a82202bd0 100644
--- a/railties/lib/rails/gem_dependency.rb
+++ b/railties/lib/rails/gem_dependency.rb
@@ -29,11 +29,18 @@ module Rails
end
end
- def self.from_directory_name(directory_name)
+ def self.from_directory_name(directory_name, load_spec=true)
directory_name_parts = File.basename(directory_name).split('-')
name = directory_name_parts[0..-2].join('-')
version = directory_name_parts.last
- self.new(name, :version => version)
+ result = self.new(name, :version => version)
+ spec_filename = File.join(unpacked_path, directory_name, '.specification')
+ if load_spec
+ raise "Missing specification file in #{File.dirname(spec_filename)}. Perhaps you need to do a 'rake gems:refresh_specs'?" unless File.exists?(spec_filename)
+ spec = YAML::load_file(spec_filename)
+ result.specification = spec
+ end
+ result
rescue ArgumentError => e
raise "Unable to determine gem name and version from '#{directory_name}'"
end
@@ -104,6 +111,10 @@ module Rails
end
end
+ def specification=(s)
+ @spec = s
+ end
+
def requirement
r = version_requirements
(r == Gem::Requirement.default) ? nil : r
@@ -170,13 +181,14 @@ module Rails
def build(options={})
require 'rails/gem_builder'
+ return if specification.nil?
if options[:force] || !built?
return unless File.exists?(unpacked_specification_filename)
spec = YAML::load_file(unpacked_specification_filename)
Rails::GemBuilder.new(spec, unpacked_gem_directory).build_extensions
puts "Built gem: '#{unpacked_gem_directory}'"
end
- dependencies.each { |dep| dep.build }
+ dependencies.each { |dep| dep.build(options) }
end
def install
@@ -236,7 +248,7 @@ module Rails
real_spec = Gem::Specification.load(specification.loaded_from)
write_specification(real_spec)
end
- dependencies.each { |dep| dep.unpack } if options[:recursive]
+ dependencies.each { |dep| dep.unpack(options) } if options[:recursive]
end
def write_specification(spec)