2008-03-29 22:17:28 -04:00
|
|
|
desc "List the gems that this rails application depends on"
|
2008-05-31 19:36:34 -04:00
|
|
|
task :gems => 'gems:base' do
|
2008-03-29 22:17:28 -04:00
|
|
|
Rails.configuration.gems.each do |gem|
|
Fix a number of errors in the config.gem mechanism.
* Rails::GemDependency was missing definitions for hash and eql?, causing Array#uniq to not work.
* If several versions of a gem are unpacked in vendor, now chooses the highest if no version is specified.
* streamlined add_load_path. Now sets up Rubygems correctly to allow 'gem' to find frozen gems, with
gems frozen to vendor/gems and specifications in vendor/gems/<gem-name>/.specification
* Rails::GemDependency#specification would return a spec for the highest installed version, even for
frozen gems and/or previously loaded lower versions. See in part ticket #1123.
* removed vendor from default_load_paths - it was causing autoloading to append Gems::Gems::<gem-dir> to
constant names
* added additional tests for loading frozen gems.
* incorporates the fix from #1107 for vendor rails
* defers to freeze:gems for handling the Rails framework. gems:unpack WILL NOT place a copy of Rails
in vendor/gems. Should close #1123 completely.
* incorporates, via using the gem loader for frozen gems, fixes corresponding to #227, #324, #362, #527, and #742.
* gem plugins now work the same whether frozen or not. Correctness of the behavior is a matter for another ticket...
Signed-off-by: rick <technoweenie@gmail.com>
2008-10-04 13:51:23 -04:00
|
|
|
print_gem_status(gem)
|
2008-03-29 22:17:28 -04:00
|
|
|
end
|
2008-04-08 00:21:32 -04:00
|
|
|
puts
|
|
|
|
puts "I = Installed"
|
|
|
|
puts "F = Frozen"
|
2008-10-26 02:25:52 -04:00
|
|
|
puts "R = Framework (loaded before rails starts)"
|
2008-03-29 22:17:28 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
namespace :gems do
|
2008-05-31 19:36:34 -04:00
|
|
|
task :base do
|
2009-02-20 15:16:07 -05:00
|
|
|
$gems_rake_task = true
|
2009-03-13 06:20:23 -04:00
|
|
|
require 'rubygems'
|
|
|
|
require 'rubygems/gem_runner'
|
2008-05-31 19:36:34 -04:00
|
|
|
Rake::Task[:environment].invoke
|
|
|
|
end
|
|
|
|
|
2008-04-02 13:48:30 -04:00
|
|
|
desc "Build any native extensions for unpacked gems"
|
|
|
|
task :build do
|
2009-03-13 06:20:23 -04:00
|
|
|
$gems_build_rake_task = true
|
2009-06-06 17:59:33 -04:00
|
|
|
frozen_gems.each { |gem| gem.build }
|
2009-04-29 01:22:54 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
namespace :build do
|
|
|
|
desc "Force the build of all gems"
|
|
|
|
task :force do
|
|
|
|
$gems_build_rake_task = true
|
2009-05-06 20:35:54 -04:00
|
|
|
frozen_gems.each { |gem| gem.build(:force => true) }
|
2009-04-29 01:22:54 -04:00
|
|
|
end
|
2008-04-02 13:48:30 -04:00
|
|
|
end
|
Fix a number of errors in the config.gem mechanism.
* Rails::GemDependency was missing definitions for hash and eql?, causing Array#uniq to not work.
* If several versions of a gem are unpacked in vendor, now chooses the highest if no version is specified.
* streamlined add_load_path. Now sets up Rubygems correctly to allow 'gem' to find frozen gems, with
gems frozen to vendor/gems and specifications in vendor/gems/<gem-name>/.specification
* Rails::GemDependency#specification would return a spec for the highest installed version, even for
frozen gems and/or previously loaded lower versions. See in part ticket #1123.
* removed vendor from default_load_paths - it was causing autoloading to append Gems::Gems::<gem-dir> to
constant names
* added additional tests for loading frozen gems.
* incorporates the fix from #1107 for vendor rails
* defers to freeze:gems for handling the Rails framework. gems:unpack WILL NOT place a copy of Rails
in vendor/gems. Should close #1123 completely.
* incorporates, via using the gem loader for frozen gems, fixes corresponding to #227, #324, #362, #527, and #742.
* gem plugins now work the same whether frozen or not. Correctness of the behavior is a matter for another ticket...
Signed-off-by: rick <technoweenie@gmail.com>
2008-10-04 13:51:23 -04:00
|
|
|
|
2009-03-13 06:20:23 -04:00
|
|
|
desc "Installs all required gems."
|
2008-05-31 19:36:34 -04:00
|
|
|
task :install => :base do
|
2009-06-06 17:59:33 -04:00
|
|
|
current_gems.each { |gem| gem.install }
|
2008-03-29 22:17:28 -04:00
|
|
|
end
|
|
|
|
|
2009-03-13 06:20:23 -04:00
|
|
|
desc "Unpacks all required gems into vendor/gems."
|
|
|
|
task :unpack => :install do
|
2009-06-06 17:59:33 -04:00
|
|
|
current_gems.each { |gem| gem.unpack }
|
2008-03-29 22:17:28 -04:00
|
|
|
end
|
Fix a number of errors in the config.gem mechanism.
* Rails::GemDependency was missing definitions for hash and eql?, causing Array#uniq to not work.
* If several versions of a gem are unpacked in vendor, now chooses the highest if no version is specified.
* streamlined add_load_path. Now sets up Rubygems correctly to allow 'gem' to find frozen gems, with
gems frozen to vendor/gems and specifications in vendor/gems/<gem-name>/.specification
* Rails::GemDependency#specification would return a spec for the highest installed version, even for
frozen gems and/or previously loaded lower versions. See in part ticket #1123.
* removed vendor from default_load_paths - it was causing autoloading to append Gems::Gems::<gem-dir> to
constant names
* added additional tests for loading frozen gems.
* incorporates the fix from #1107 for vendor rails
* defers to freeze:gems for handling the Rails framework. gems:unpack WILL NOT place a copy of Rails
in vendor/gems. Should close #1123 completely.
* incorporates, via using the gem loader for frozen gems, fixes corresponding to #227, #324, #362, #527, and #742.
* gem plugins now work the same whether frozen or not. Correctness of the behavior is a matter for another ticket...
Signed-off-by: rick <technoweenie@gmail.com>
2008-10-04 13:51:23 -04:00
|
|
|
|
2008-04-11 18:25:11 -04:00
|
|
|
namespace :unpack do
|
2009-03-13 06:20:23 -04: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-04-11 18:25:11 -04:00
|
|
|
end
|
|
|
|
end
|
2008-10-11 13:54:21 -04:00
|
|
|
|
|
|
|
desc "Regenerate gem specifications in correct format."
|
2009-06-06 17:59:33 -04:00
|
|
|
task :refresh_specs do
|
|
|
|
frozen_gems(false).each { |gem| gem.refresh }
|
2009-03-13 06:20:23 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def current_gems
|
|
|
|
gems = Rails.configuration.gems
|
|
|
|
gems = gems.select { |gem| gem.name == ENV['GEM'] } unless ENV['GEM'].blank?
|
|
|
|
gems
|
|
|
|
end
|
|
|
|
|
2009-06-06 17:59:33 -04:00
|
|
|
def frozen_gems(load_specs=true)
|
2009-04-29 01:22:54 -04:00
|
|
|
Dir[File.join(RAILS_ROOT, 'vendor', 'gems', '*-*')].map do |gem_dir|
|
2009-06-06 17:59:33 -04:00
|
|
|
Rails::GemDependency.from_directory_name(gem_dir, load_specs)
|
2009-04-29 01:22:54 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2009-03-13 06:20:23 -04:00
|
|
|
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-11 13:54:21 -04:00
|
|
|
end
|
2009-03-13 06:20:23 -04:00
|
|
|
puts " "*(indent-1)+" - [#{code}] #{gem.name} #{gem.requirement.to_s}"
|
|
|
|
gem.dependencies.each { |g| print_gem_status(g, indent+1) }
|
|
|
|
end
|