diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-26 17:44:33 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-26 17:44:33 +0000 |
commit | d39041bab5135529848be11712fad4a3973c2cf7 (patch) | |
tree | ef30eba4189274be883d95769166d3bb3993a7b8 /lib | |
parent | b385f19c922b9186537150df3124d72d14e9c213 (diff) |
* lib/rubygems: Update to RubyGems 2.0.13. [ruby-core:58031]
[Backport #9052]
the patch is provided by drbrain (Eric Hodel).
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@43435 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rubygems.rb | 2 | ||||
-rw-r--r-- | lib/rubygems/server.rb | 18 | ||||
-rw-r--r-- | lib/rubygems/source.rb | 7 | ||||
-rw-r--r-- | lib/rubygems/spec_fetcher.rb | 7 | ||||
-rw-r--r-- | lib/rubygems/version.rb | 2 |
5 files changed, 27 insertions, 9 deletions
diff --git a/lib/rubygems.rb b/lib/rubygems.rb index e28fab4eae..a5857d810d 100644 --- a/lib/rubygems.rb +++ b/lib/rubygems.rb @@ -8,7 +8,7 @@ require 'rbconfig' module Gem - VERSION = '2.0.12' + VERSION = '2.0.13' end # Must be first since it unloads the prelude from 1.9.2 diff --git a/lib/rubygems/server.rb b/lib/rubygems/server.rb index dd582193ee..f2d1428489 100644 --- a/lib/rubygems/server.rb +++ b/lib/rubygems/server.rb @@ -445,7 +445,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } @spec_dirs = @gem_dirs.map { |gem_dir| File.join gem_dir, 'specifications' } @spec_dirs.reject! { |spec_dir| !File.directory? spec_dir } - Gem::Specification.dirs = @gem_dirs + reset_gems @have_rdoc_4_plus = nil end @@ -470,7 +470,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } end def latest_specs(req, res) - Gem::Specification.reset + reset_gems res['content-type'] = 'application/x-gzip' @@ -531,7 +531,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } end def quick(req, res) - Gem::Specification.reset + reset_gems res['content-type'] = 'text/plain' add_date res @@ -567,7 +567,8 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } end def root(req, res) - Gem::Specification.reset + reset_gems + add_date res raise WEBrick::HTTPStatus::NotFound, "`#{req.path}' not found." unless @@ -698,6 +699,13 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } end ## + # Updates the server to use the latest installed gems. + + def reset_gems # :nodoc: + Gem::Specification.dirs = @gem_dirs + end + + ## # Returns true and prepares http response, if rdoc for the requested gem # name pattern was found. # @@ -787,7 +795,7 @@ div.method-source-code pre { color: #ffdead; overflow: hidden; } end def specs(req, res) - Gem::Specification.reset + reset_gems add_date res diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb index 96d57870e2..c997d78ca6 100644 --- a/lib/rubygems/source.rb +++ b/lib/rubygems/source.rb @@ -63,7 +63,12 @@ class Gem::Source end def update_cache? - @update_cache ||= File.stat(Gem.user_home).uid == Process.uid + @update_cache ||= + begin + File.stat(Gem.user_home).uid == Process.uid + rescue Errno::ENOENT + false + end end def fetch_spec(name) diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb index 3d484d1c13..e4db426633 100644 --- a/lib/rubygems/spec_fetcher.rb +++ b/lib/rubygems/spec_fetcher.rb @@ -39,7 +39,12 @@ class Gem::SpecFetcher def initialize @dir = File.join Gem.user_home, '.gem', 'specs' - @update_cache = File.stat(Gem.user_home).uid == Process.uid + @update_cache = + begin + File.stat(Gem.user_home).uid == Process.uid + rescue Errno::EACCES, Errno::ENOENT + false + end @specs = {} @latest_specs = {} diff --git a/lib/rubygems/version.rb b/lib/rubygems/version.rb index 50849857fe..2b7bf9b422 100644 --- a/lib/rubygems/version.rb +++ b/lib/rubygems/version.rb @@ -174,7 +174,7 @@ class Gem::Version # REFACTOR: There's no real reason this should be separate from #initialize. def self.create input - if input.respond_to? :version then + if self === input then # check yourself before you wreck yourself input elsif input.nil? then nil |