summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-18 21:56:18 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-18 21:56:18 +0000
commit08aa6d59a2bc35556125d373f90f5286440c6f84 (patch)
tree532694033c6b495c4355b9f35a1a8b60497ad103 /lib
parent9f9b47671052072a305275b99d7e132cf17fbc79 (diff)
* lib/rubygems: Update to RubyGems master 0a3814b. Changes:
Fixed extension directory in Gem::Specification#require_paths. Allow installation of gems when $HOME is nonexistent or unwritable. Use proper API in InstallCommand. Improve support for path option in gem dependency files. Remove warnings. * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/rubygems/basic_specification.rb2
-rw-r--r--lib/rubygems/commands/install_command.rb6
-rw-r--r--lib/rubygems/request_set.rb10
-rw-r--r--lib/rubygems/request_set/gem_dependency_api.rb4
-rw-r--r--lib/rubygems/source.rb14
-rw-r--r--lib/rubygems/source/installed.rb1
-rw-r--r--lib/rubygems/spec_fetcher.rb7
-rw-r--r--lib/rubygems/stub_specification.rb7
-rw-r--r--lib/rubygems/test_case.rb6
9 files changed, 41 insertions, 16 deletions
diff --git a/lib/rubygems/basic_specification.rb b/lib/rubygems/basic_specification.rb
index 7f738155c9..7d0469000b 100644
--- a/lib/rubygems/basic_specification.rb
+++ b/lib/rubygems/basic_specification.rb
@@ -176,7 +176,7 @@ class Gem::BasicSpecification
return @require_paths if @extensions.empty?
relative_extension_install_dir =
- File.join '..', '..', '..', 'extensions', Gem::Platform.local.to_s,
+ File.join '..', '..', 'extensions', Gem::Platform.local.to_s,
Gem.extension_api_version, full_name
@require_paths + [relative_extension_install_dir]
diff --git a/lib/rubygems/commands/install_command.rb b/lib/rubygems/commands/install_command.rb
index 0bb40ed633..1f3210ff5d 100644
--- a/lib/rubygems/commands/install_command.rb
+++ b/lib/rubygems/commands/install_command.rb
@@ -135,7 +135,7 @@ to write the specification by hand. For example:
def execute
if gf = options[:gemdeps] then
install_from_gemdeps gf
- return
+ return # not reached
end
@installed_specs = []
@@ -151,7 +151,7 @@ to write the specification by hand. For example:
show_installed
- raise Gem::SystemExitException, exit_code
+ terminate_interaction exit_code
end
def install_from_gemdeps gf # :nodoc:
@@ -173,7 +173,7 @@ to write the specification by hand. For example:
@installed_specs = specs
- raise Gem::SystemExitException, 0
+ terminate_interaction
end
def install_gem name, version # :nodoc:
diff --git a/lib/rubygems/request_set.rb b/lib/rubygems/request_set.rb
index eb45516cfb..9a7ac83e91 100644
--- a/lib/rubygems/request_set.rb
+++ b/lib/rubygems/request_set.rb
@@ -159,7 +159,15 @@ class Gem::RequestSet
# Resolve the requested dependencies and return an Array of Specification
# objects to be activated.
- def resolve set = nil
+ def resolve set = Gem::DependencyResolver::IndexSet.new
+ sets = [set, @vendor_set].compact
+
+ set = if sets.size == 1 then
+ sets.first
+ else
+ Gem::DependencyResolver.compose_sets(*sets)
+ end
+
resolver = Gem::DependencyResolver.new @dependencies, set
resolver.development = @development
resolver.soft_missing = @soft_missing
diff --git a/lib/rubygems/request_set/gem_dependency_api.rb b/lib/rubygems/request_set/gem_dependency_api.rb
index 40dccb6433..f11ffb12c3 100644
--- a/lib/rubygems/request_set/gem_dependency_api.rb
+++ b/lib/rubygems/request_set/gem_dependency_api.rb
@@ -51,8 +51,8 @@ class Gem::RequestSet::GemDependencyAPI
@vendor_set.add_vendor_gem name, directory
end
- group = options.delete :group
- all_groups = group ? Array(group) : []
+ g = options.delete :group
+ all_groups = g ? Array(g) : []
groups = options.delete :groups
all_groups |= groups if groups
diff --git a/lib/rubygems/source.rb b/lib/rubygems/source.rb
index ecfb6c8897..394ea6cf22 100644
--- a/lib/rubygems/source.rb
+++ b/lib/rubygems/source.rb
@@ -47,12 +47,7 @@ class Gem::Source
include Comparable
def ==(other)
- case other
- when self.class
- @uri == other.uri
- else
- false
- end
+ self.class === other and @uri == other.uri
end
alias_method :eql?, :==
@@ -71,7 +66,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/source/installed.rb b/lib/rubygems/source/installed.rb
index 7709778791..8e3a3560bf 100644
--- a/lib/rubygems/source/installed.rb
+++ b/lib/rubygems/source/installed.rb
@@ -1,6 +1,7 @@
class Gem::Source::Installed < Gem::Source
def initialize
+ @uri = nil
end
##
diff --git a/lib/rubygems/spec_fetcher.rb b/lib/rubygems/spec_fetcher.rb
index 3ae7afc9d9..4bef93351f 100644
--- a/lib/rubygems/spec_fetcher.rb
+++ b/lib/rubygems/spec_fetcher.rb
@@ -38,7 +38,12 @@ class Gem::SpecFetcher
end
def initialize
- @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/stub_specification.rb b/lib/rubygems/stub_specification.rb
index ffa2d3f964..221dc1d404 100644
--- a/lib/rubygems/stub_specification.rb
+++ b/lib/rubygems/stub_specification.rb
@@ -165,5 +165,12 @@ class Gem::StubSpecification < Gem::BasicSpecification
@version ||= data.version
end
+ ##
+ # Is there a stub line present for this StubSpecification?
+
+ def stubbed?
+ data.is_a? StubLine
+ end
+
end
diff --git a/lib/rubygems/test_case.rb b/lib/rubygems/test_case.rb
index a5a81d72a2..1e6d9feeeb 100644
--- a/lib/rubygems/test_case.rb
+++ b/lib/rubygems/test_case.rb
@@ -1098,11 +1098,15 @@ Also, a list:
##
# A vendor_gem is used with a gem dependencies file. The gem created here
# has no files, just a gem specification for the given +name+ and +version+.
+ #
+ # Yields the +specification+ to the block, if given
def vendor_gem name = 'a', version = 1
directory = File.join 'vendor', name
- vendor_spec = Gem::Specification.new name, version
+ vendor_spec = Gem::Specification.new name, version do |specification|
+ yield specification if block_given?
+ end
FileUtils.mkdir_p directory