From 4364c361b599f99bc2345ce4eb2d145b07ed8a0f Mon Sep 17 00:00:00 2001 From: David Dollar Date: Fri, 11 Apr 2008 18:25:11 -0400 Subject: Now that we have gems:unpack and gems:build allowing for integration of 100% of your gems into vendor/ it would be nice to have the ability to automatically unpack the full dependency tree of your specified gems. This patch adds the rake task gems:unpack:dependencies to do this. Usage: gems:unpack:dependencies # unpack all dependencies gems:unpack:dependencies GEM=foo # unpack all dependencies for gem foo --- railties/lib/tasks/gems.rake | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'railties/lib/tasks') diff --git a/railties/lib/tasks/gems.rake b/railties/lib/tasks/gems.rake index c8d5167be6..c18fea2d60 100644 --- a/railties/lib/tasks/gems.rake +++ b/railties/lib/tasks/gems.rake @@ -39,4 +39,20 @@ namespace :gems do gem.unpack_to(File.join(RAILS_ROOT, 'vendor', 'gems')) if gem.loaded? end end + + namespace :unpack do + desc "Unpacks the specified gems and its dependencies into vendor/gems" + task :dependencies => :unpack do + require 'rubygems' + require 'rubygems/gem_runner' + Rails.configuration.gems.each do |gem| + next unless ENV['GEM'].blank? || ENV['GEM'] == gem.name + gem.dependencies.each do |dependency| + dependency.add_load_paths # double check that we have not already unpacked + next if dependency.frozen? + dependency.unpack_to(File.join(RAILS_ROOT, 'vendor', 'gems')) + end + end + end + end end \ No newline at end of file -- cgit v1.2.3