aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/commands/fetch_command.rb
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-01 03:45:05 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-01 03:45:05 +0000
commitd22130922e7842226d38d59680e4bbb48a28a5f0 (patch)
tree39594d3a14641dd5488a99a5e633239296fa5742 /lib/rubygems/commands/fetch_command.rb
parent4752539e3f3e563d559732c52424206bd6f12dbd (diff)
downloadruby-d22130922e7842226d38d59680e4bbb48a28a5f0.tar.gz
Import rubygems 1.8.5 (released @ 137c80f)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rubygems/commands/fetch_command.rb')
-rw-r--r--lib/rubygems/commands/fetch_command.rb11
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