2008-05-18 06:22:34 +02:00
|
|
|
desc "List the gems that this rails application depends on"
|
2008-06-02 08:35:38 +02:00
|
|
|
task :gems => 'gems:base' do
|
2008-05-18 06:22:34 +02:00
|
|
|
Rails.configuration.gems.each do |gem|
|
2008-10-27 07:47:01 +01:00
|
|
|
print_gem_status(gem)
|
2008-05-18 06:22:34 +02:00
|
|
|
end
|
|
|
|
puts
|
|
|
|
puts "I = Installed"
|
|
|
|
puts "F = Frozen"
|
2008-11-24 22:53:39 +01:00
|
|
|
puts "R = Framework (loaded before rails starts)"
|
2008-05-18 06:22:34 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
namespace :gems do
|
2008-06-02 08:35:38 +02:00
|
|
|
task :base do
|
2009-02-28 02:23:00 +01:00
|
|
|
$gems_rake_task = true
|
2009-03-16 15:55:30 +01:00
|
|
|
require 'rubygems'
|
|
|
|
require 'rubygems/gem_runner'
|
2008-06-02 08:35:38 +02:00
|
|
|
Rake::Task[:environment].invoke
|
|
|
|
end
|
|
|
|
|
2008-05-18 06:22:34 +02:00
|
|
|
desc "Build any native extensions for unpacked gems"
|
|
|
|
task :build do
|
2009-03-16 15:55:30 +01:00
|
|
|
$gems_build_rake_task = true
|
|
|
|
Rake::Task['gems:unpack'].invoke
|
|
|
|
current_gems.each &:build
|
2008-05-18 06:22:34 +02:00
|
|
|
end
|
2008-10-27 07:47:01 +01:00
|
|
|
|
2009-03-16 15:55:30 +01:00
|
|
|
desc "Installs all required gems."
|
2008-06-02 08:35:38 +02:00
|
|
|
task :install => :base do
|
2009-03-16 15:55:30 +01:00
|
|
|
current_gems.each &:install
|
2008-05-18 06:22:34 +02:00
|
|
|
end
|
|
|
|
|
2009-03-16 15:55:30 +01:00
|
|
|
desc "Unpacks all required gems into vendor/gems."
|
|
|
|
task :unpack => :install do
|
|
|
|
current_gems.each &:unpack
|
2008-05-18 06:22:34 +02:00
|
|
|
end
|
2008-10-27 07:47:01 +01:00
|
|
|
|
2008-05-18 06:22:34 +02:00
|
|
|
namespace :unpack do
|
2009-03-16 15:55:30 +01:00
|
|
|
desc "Unpacks all required gems and their dependencies into vendor/gems."
|
|
|
|
task :dependencies => :install do
|
|
|
|
current_gems.each { |gem| gem.unpack(:recursive => true) }
|
2008-05-18 06:22:34 +02:00
|
|
|
end
|
|
|
|
end
|
2008-10-27 07:47:01 +01:00
|
|
|
|
|
|
|
desc "Regenerate gem specifications in correct format."
|
|
|
|
task :refresh_specs => :base do
|
2009-03-16 15:55:30 +01:00
|
|
|
current_gems.each &:refresh
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def current_gems
|
|
|
|
gems = Rails.configuration.gems
|
|
|
|
gems = gems.select { |gem| gem.name == ENV['GEM'] } unless ENV['GEM'].blank?
|
|
|
|
gems
|
|
|
|
end
|
|
|
|
|
|
|
|
def print_gem_status(gem, indent=1)
|
|
|
|
code = case
|
|
|
|
when gem.framework_gem? then 'R'
|
|
|
|
when gem.frozen? then 'F'
|
|
|
|
when gem.installed? then 'I'
|
|
|
|
else ' '
|
2008-10-27 07:47:01 +01:00
|
|
|
end
|
2009-03-16 15:55:30 +01:00
|
|
|
puts " "*(indent-1)+" - [#{code}] #{gem.name} #{gem.requirement.to_s}"
|
|
|
|
gem.dependencies.each { |g| print_gem_status(g, indent+1) }
|
|
|
|
end
|