diff options
author | Rick Olson <technoweenie@gmail.com> | 2008-04-02 17:48:30 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2008-04-02 17:48:30 +0000 |
commit | 7d2316604a0bb04fe8c800e12876c58bdac651b4 (patch) | |
tree | c692746bd96df3f3ae82962c77388c0446c1e207 /railties/lib/tasks/gems.rake | |
parent | 2c6f1d43962796558301528e2c9ff40e53f01409 (diff) | |
download | rails-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/tasks/gems.rake')
-rw-r--r-- | railties/lib/tasks/gems.rake | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/railties/lib/tasks/gems.rake b/railties/lib/tasks/gems.rake index 198f6050c3..8f3fc51635 100644 --- a/railties/lib/tasks/gems.rake +++ b/railties/lib/tasks/gems.rake @@ -6,6 +6,18 @@ task :gems => :environment do end namespace :gems do + desc "Build any native extensions for unpacked gems" + task :build do + Dir[File.join(RAILS_ROOT, 'vendor', 'gems', '*')].each do |gem_dir| + spec_file = File.join(gem_dir, '.specification') + next unless File.exists?(spec_file) + specification = YAML::load_file(spec_file) + next unless ENV['GEM'].blank? || ENV['GEM'] == specification.name + Rails::GemBuilder.new(specification, gem_dir).build_extensions + puts "Built gem: '#{gem_dir}'" + end + end + desc "Installs all required gems for this application." task :install => :environment do require 'rubygems' @@ -15,17 +27,12 @@ namespace :gems do desc "Unpacks the specified gem into vendor/gems." task :unpack do - raise "Specify name of gem in the config.gems array with GEM=" if ENV['GEM'].blank? Rake::Task["environment"].invoke require 'rubygems' require 'rubygems/gem_runner' - unless Rails.configuration.gems.select do |gem| - if gem.loaded? && gem.name == ENV['GEM'] - gem.unpack_to(File.join(RAILS_ROOT, 'vendor', 'gems')) - true - end - end.any? - puts "No gem named #{ENV['GEM'].inspect} found." + Rails.configuration.gems.each do |gem| + next unless ENV['GEM'].blank? || ENV['GEM'] == gem.name + gem.unpack_to(File.join(RAILS_ROOT, 'vendor', 'gems')) if gem.loaded? end end end
\ No newline at end of file |