diff options
Diffstat (limited to 'lib/rubygems/commands/fetch_command.rb')
-rw-r--r-- | lib/rubygems/commands/fetch_command.rb | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/rubygems/commands/fetch_command.rb b/lib/rubygems/commands/fetch_command.rb index c0fdc83e46..7d99276506 100644 --- a/lib/rubygems/commands/fetch_command.rb +++ b/lib/rubygems/commands/fetch_command.rb @@ -41,19 +41,22 @@ class Gem::Commands::FetchCommand < Gem::Command version = options[:version] || Gem::Requirement.default all = Gem::Requirement.default != version + platform = Gem.platforms.last gem_names = get_all_gem_names gem_names.each do |gem_name| dep = Gem::Dependency.new gem_name, version dep.prerelease = options[:prerelease] - specs_and_sources = Gem::SpecFetcher.fetcher.fetch(dep, all, true, - dep.prerelease?) - specs_and_sources, errors = Gem::SpecFetcher.fetcher.fetch_with_errors(dep, all, true, dep.prerelease?) + if platform then + filtered = specs_and_sources.select { |s,| s.platform == platform } + specs_and_sources = filtered unless filtered.empty? + end + spec, source_uri = specs_and_sources.sort_by { |s,| s.version }.last if spec.nil? then @@ -62,7 +65,7 @@ class Gem::Commands::FetchCommand < Gem::Command end path = Gem::RemoteFetcher.fetcher.download spec, source_uri - FileUtils.mv path, spec.file_name + FileUtils.mv path, File.basename(spec.cache_file) say "Downloaded #{spec.full_name}" end |