aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/gem_dependency.rb
diff options
context:
space:
mode:
authorRick Olson <technoweenie@gmail.com>2008-04-02 17:48:30 +0000
committerRick Olson <technoweenie@gmail.com>2008-04-02 17:48:30 +0000
commit7d2316604a0bb04fe8c800e12876c58bdac651b4 (patch)
treec692746bd96df3f3ae82962c77388c0446c1e207 /railties/lib/rails/gem_dependency.rb
parent2c6f1d43962796558301528e2c9ff40e53f01409 (diff)
downloadrails-7d2316604a0bb04fe8c800e12876c58bdac651b4.tar.gz
rails-7d2316604a0bb04fe8c800e12876c58bdac651b4.tar.bz2
rails-7d2316604a0bb04fe8c800e12876c58bdac651b4.zip
Flesh out rake gems:unpack to unpack all gems, and add rake gems:build for native extensions. Closes #11513 [ddollar]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@9215 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/rails/gem_dependency.rb')
-rw-r--r--railties/lib/rails/gem_dependency.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/railties/lib/rails/gem_dependency.rb b/railties/lib/rails/gem_dependency.rb
index f9c37cb70a..8d6a748e4c 100644
--- a/railties/lib/rails/gem_dependency.rb
+++ b/railties/lib/rails/gem_dependency.rb
@@ -33,6 +33,10 @@ module Rails
rescue Gem::LoadError
puts $!.to_s
end
+
+ def gem_dir(base_directory)
+ File.join(base_directory, specification.full_name)
+ end
def load
return if @loaded || @load_paths_added == false
@@ -54,12 +58,24 @@ module Rails
def install
Gem::GemRunner.new.run(install_command)
end
+
+ def specification
+ @spec ||= Gem.source_index.search(Gem::Dependency.new(@name, @requirement)).sort_by { |s| s.version }.last
+ end
def unpack_to(directory)
FileUtils.mkdir_p directory
Dir.chdir directory do
Gem::GemRunner.new.run(unpack_command)
end
+
+ # copy the gem's specification into GEMDIR/.specification so that
+ # we can access information about the gem on deployment systems
+ # without having the gem installed
+ spec_filename = File.join(gem_dir(directory), '.specification')
+ File.open(spec_filename, 'w') do |file|
+ file.puts specification.to_yaml
+ end
end
def install_command