aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rubygems/request_set
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-30 23:27:52 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-11-30 23:27:52 +0000
commit73fc703f7cbb2e6dfd50897d26b37fe8e76064e3 (patch)
tree0296426c8ac01331f2d33dde54fd9f1e183ea974 /lib/rubygems/request_set
parent6727297dfecddaef6b1166a7f442db2a22929c65 (diff)
downloadruby-73fc703f7cbb2e6dfd50897d26b37fe8e76064e3.tar.gz
* 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
Diffstat (limited to 'lib/rubygems/request_set')
-rw-r--r--lib/rubygems/request_set/lockfile.rb25
1 files changed, 24 insertions, 1 deletions
diff --git a/lib/rubygems/request_set/lockfile.rb b/lib/rubygems/request_set/lockfile.rb
index 0073bfdcc5..d70b09f7a2 100644
--- a/lib/rubygems/request_set/lockfile.rb
+++ b/lib/rubygems/request_set/lockfile.rb
@@ -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
@@ -343,6 +355,8 @@ class Gem::RequestSet::Lockfile
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