diff options
author | Matt Jones <al2o3cr@gmail.com> | 2009-03-01 11:53:58 +0000 |
---|---|---|
committer | Pratik Naik <pratiknaik@gmail.com> | 2009-03-01 11:53:58 +0000 |
commit | a3ac1e1621506a6519b265ef6ec6abc70f6c8a27 (patch) | |
tree | 21770cd0ac52bfb034da9195b412236ddb893176 /railties/lib | |
parent | 3b169cd693f45911ee71e26708fb9267811c8d83 (diff) | |
download | rails-a3ac1e1621506a6519b265ef6ec6abc70f6c8a27.tar.gz rails-a3ac1e1621506a6519b265ef6ec6abc70f6c8a27.tar.bz2 rails-a3ac1e1621506a6519b265ef6ec6abc70f6c8a27.zip |
Display gem dependencies correctly and unpack exactly once [#2097 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/gem_dependency.rb | 11 | ||||
-rw-r--r-- | railties/lib/tasks/gems.rake | 7 |
2 files changed, 10 insertions, 8 deletions
diff --git a/railties/lib/rails/gem_dependency.rb b/railties/lib/rails/gem_dependency.rb index 5a07841be8..2dd659032f 100644 --- a/railties/lib/rails/gem_dependency.rb +++ b/railties/lib/rails/gem_dependency.rb @@ -72,13 +72,14 @@ module Rails rescue Gem::LoadError end - def dependencies - return [] if framework_gem? - return [] if specification.nil? + def dependencies(options = {}) + return [] if framework_gem? || specification.nil? + all_dependencies = specification.dependencies.map do |dependency| GemDependency.new(dependency.name, :requirement => dependency.version_requirements) end - all_dependencies += all_dependencies.map(&:dependencies).flatten + + all_dependencies += all_dependencies.map { |d| d.dependencies(options) }.flatten if options[:flatten] all_dependencies.uniq end @@ -149,6 +150,8 @@ module Rails end def unpack_to(directory) + return if specification.nil? || File.directory?(gem_dir(directory)) || framework_gem? + FileUtils.mkdir_p directory Dir.chdir directory do Gem::GemRunner.new.run(unpack_command) diff --git a/railties/lib/tasks/gems.rake b/railties/lib/tasks/gems.rake index d538e52ca6..0932ba73b5 100644 --- a/railties/lib/tasks/gems.rake +++ b/railties/lib/tasks/gems.rake @@ -47,8 +47,8 @@ namespace :gems do require 'rubygems' require 'rubygems/gem_runner' Rails.configuration.gems.each do |gem| - next unless !gem.frozen? && (ENV['GEM'].blank? || ENV['GEM'] == gem.name) - gem.unpack_to(Rails::GemDependency.unpacked_path) if gem.loaded? + next unless ENV['GEM'].blank? || ENV['GEM'] == gem.name + gem.unpack_to(Rails::GemDependency.unpacked_path) end end @@ -59,8 +59,7 @@ namespace :gems do require 'rubygems/gem_runner' Rails.configuration.gems.each do |gem| next unless ENV['GEM'].blank? || ENV['GEM'] == gem.name - gem.dependencies.each do |dependency| - next if dependency.frozen? + gem.dependencies(:flatten => true).each do |dependency| dependency.unpack_to(Rails::GemDependency.unpacked_path) end end |