1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/rubygems: Update to RubyGems master 66e5c39. Notable changes:

Implement gem.deps.rb (Gemfile) .lock support

  Fixed `gem uninstall` for a relative directory in GEM_HOME.

* test/rubygems:  ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43939 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
drbrain 2013-11-30 23:27:52 +00:00
parent 6727297dfe
commit 73fc703f7c
31 changed files with 598 additions and 26 deletions

View file

@ -1,3 +1,8 @@
##
# Parses a gem.deps.rb.lock file and constructs a LockSet containing the
# dependencies found inside. If the lock file is missing no LockSet is
# constructed.
class Gem::RequestSet::Lockfile
##
@ -100,7 +105,7 @@ class Gem::RequestSet::Lockfile
out << nil
end
def relative_path_from(dest, base)
def relative_path_from dest, base # :nodoc:
dest = File.expand_path(dest)
base = File.expand_path(base)
@ -263,6 +268,9 @@ class Gem::RequestSet::Lockfile
get while not @tokens.empty? and peek.first == type
end
##
# The contents of the lock file.
def to_s
@set.resolve
@ -293,6 +301,10 @@ class Gem::RequestSet::Lockfile
[byte_offset - @line_pos, @line]
end
##
# Converts a lock file into an Array of tokens. If the lock file is missing
# an empty Array is returned.
def tokenize # :nodoc:
@line = 0
@line_pos = 0
@ -342,6 +354,8 @@ class Gem::RequestSet::Lockfile
end
end
@tokens
rescue Errno::ENOENT
@tokens
end
@ -352,5 +366,14 @@ class Gem::RequestSet::Lockfile
@tokens.unshift @current_token
end
##
# Writes the lock file alongside the gem dependencies file
def write
open "#{@gem_deps_file}.lock", 'w' do |io|
io.write to_s
end
end
end