Changeset 9215
- Timestamp:
- 04/02/08 17:48:30 (3 months ago)
- Files:
-
- trunk/railties/CHANGELOG (modified) (1 diff)
- trunk/railties/lib/initializer.rb (modified) (1 diff)
- trunk/railties/lib/rails/gem_dependency.rb (modified) (3 diffs)
- trunk/railties/lib/tasks/gems.rake (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/railties/CHANGELOG
r9204 r9215 1 1 *SVN* 2 3 * Flesh out rake gems:unpack to unpack all gems, and add rake gems:build for native extensions. [ddollar] 4 5 rake gems:unpack # unpacks all gems 6 rake gems:unpack GEM=mygem # unpacks only the gem 'mygem' 7 8 rake gems:build # builds all unpacked gems 9 rake gems:build GEM=mygem # builds only the gem 'mygem' 2 10 3 11 * Add config.active_support for future configuration options. Also, add more new Rails 3 config settings to new_rails_defaults.rb [rick] trunk/railties/lib/initializer.rb
r9211 r9215 8 8 require 'rails/plugin/locator' 9 9 require 'rails/plugin/loader' 10 require 'rails/gem_builder' 10 11 require 'rails/gem_dependency' 11 12 trunk/railties/lib/rails/gem_dependency.rb
r9197 r9215 34 34 puts $!.to_s 35 35 end 36 37 def gem_dir(base_directory) 38 File.join(base_directory, specification.full_name) 39 end 36 40 37 41 def load … … 55 59 Gem::GemRunner.new.run(install_command) 56 60 end 61 62 def specification 63 @spec ||= Gem.source_index.search(Gem::Dependency.new(@name, @requirement)).sort_by { |s| s.version }.last 64 end 57 65 58 66 def unpack_to(directory) … … 60 68 Dir.chdir directory do 61 69 Gem::GemRunner.new.run(unpack_command) 70 end 71 72 # copy the gem's specification into GEMDIR/.specification so that 73 # we can access information about the gem on deployment systems 74 # without having the gem installed 75 spec_filename = File.join(gem_dir(directory), '.specification') 76 File.open(spec_filename, 'w') do |file| 77 file.puts specification.to_yaml 62 78 end 63 79 end trunk/railties/lib/tasks/gems.rake
r9140 r9215 7 7 8 8 namespace :gems do 9 desc "Build any native extensions for unpacked gems" 10 task :build do 11 Dir[File.join(RAILS_ROOT, 'vendor', 'gems', '*')].each do |gem_dir| 12 spec_file = File.join(gem_dir, '.specification') 13 next unless File.exists?(spec_file) 14 specification = YAML::load_file(spec_file) 15 next unless ENV['GEM'].blank? || ENV['GEM'] == specification.name 16 Rails::GemBuilder.new(specification, gem_dir).build_extensions 17 puts "Built gem: '#{gem_dir}'" 18 end 19 end 20 9 21 desc "Installs all required gems for this application." 10 22 task :install => :environment do … … 16 28 desc "Unpacks the specified gem into vendor/gems." 17 29 task :unpack do 18 raise "Specify name of gem in the config.gems array with GEM=" if ENV['GEM'].blank?19 30 Rake::Task["environment"].invoke 20 31 require 'rubygems' 21 32 require 'rubygems/gem_runner' 22 unless Rails.configuration.gems.select do |gem| 23 if gem.loaded? && gem.name == ENV['GEM'] 24 gem.unpack_to(File.join(RAILS_ROOT, 'vendor', 'gems')) 25 true 26 end 27 end.any? 28 puts "No gem named #{ENV['GEM'].inspect} found." 33 Rails.configuration.gems.each do |gem| 34 next unless ENV['GEM'].blank? || ENV['GEM'] == gem.name 35 gem.unpack_to(File.join(RAILS_ROOT, 'vendor', 'gems')) if gem.loaded? 29 36 end 30 37 end