diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/lockfile_parser.rb | 12 | ||||
-rw-r--r-- | lib/bundler/settings.rb | 8 |
2 files changed, 16 insertions, 4 deletions
diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb index 21367fe7..c499d9a0 100644 --- a/lib/bundler/lockfile_parser.rb +++ b/lib/bundler/lockfile_parser.rb @@ -22,12 +22,13 @@ module Bundler PATH = "PATH" SPECS = " specs:" OPTIONS = /^ ([a-z]+): (.*)$/i + SOURCE = [GIT, GEM, PATH] def initialize(lockfile) @platforms = [] @sources = [] @dependencies = [] - @state = :source + @state = nil @specs = {} @rubygems_aggregate = Source::Rubygems.new @@ -38,13 +39,18 @@ module Bundler end lockfile.split(/(?:\r?\n)+/).each do |line| - if line == DEPENDENCIES + if SOURCE.include?(line) + @state = :source + parse_source(line) + elsif line == DEPENDENCIES @state = :dependency elsif line == PLATFORMS @state = :platform elsif line == BUNDLED @state = :bundled_with - else + elsif line =~ /^[^\s]/ + @state = nil + elsif @state send("parse_#{@state}", line) end end diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 7a58c8af..beb53205 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -228,7 +228,7 @@ module Bundler config_regex = /^(BUNDLE_.+): (['"]?)(.*(?:\n(?!BUNDLE).+)?)\2$/ config_pairs = config_file.read.scan(config_regex).map do |m| key, _, value = m - [key, value.gsub(/\s+/, " ").tr('"', "'")] + [convert_to_backward_compatible_key(key), value.gsub(/\s+/, " ").tr('"', "'")] end Hash[config_pairs] else @@ -236,6 +236,12 @@ module Bundler end end + def convert_to_backward_compatible_key(key) + key = "#{key}/" if key =~ /https?:/i && key !~ %r[/\Z] + key = key.gsub(".", "__") if key.include?(".") + key + end + # TODO: duplicates Rubygems#normalize_uri # TODO: is this the correct place to validate mirror URIs? def normalize_uri(uri) |