summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Giddins <segiddins@segiddins.me>2017-04-03 21:10:20 -0500
committerSamuel Giddins <segiddins@segiddins.me>2017-04-03 21:10:20 -0500
commit47959cf97ca82292fc037f5118c89820446f4a35 (patch)
treea4f2d5a3f8d6f0163f96d70bcbe779f68fa52340
parent6e25694cafeb697c200d981d5bced45e8b693cca (diff)
downloadbundler-47959cf97ca82292fc037f5118c89820446f4a35.tar.gz
[LockfileParser] Add comments to NAME_PATTERN
-rw-r--r--lib/bundler/lockfile_parser.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb
index 344f3a58ae..dbf8926690 100644
--- a/lib/bundler/lockfile_parser.rb
+++ b/lib/bundler/lockfile_parser.rb
@@ -171,7 +171,15 @@ module Bundler
end
end
- NAME_VERSION = /^( {2}| {4}| {6})(?! )(.*?)(?: \(([^-]*)(?:-(.*))?\))?(!)?$/
+ space = / /
+ NAME_VERSION = /
+ ^(#{space}{2}|#{space}{4}|#{space}{6})(?!#{space}) # Exactly 2, 4, or 6 spaces at the start of the line
+ (.*?) # Name
+ (?:#{space}\(([^-]*) # Space, followed by version
+ (?:-(.*))?\))? # Optional platform
+ (!)? # Optional pinned marker
+ $ # Line end
+ /xo
def parse_dependency(line)
return unless line =~ NAME_VERSION