diff options
author | Adam Roben <adam@roben.org> | 2015-01-06 11:53:10 -0500 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2015-03-30 17:10:49 +0100 |
commit | 22e367db34acda8cebb0473fddde346b6a9e5dc9 (patch) | |
tree | 4f21d0ee036cc9c51e51729d95fa34a6d46e8a0f /lib | |
parent | 1b13dc16a1817f70d17626873c1432f28a964ade (diff) | |
download | bundler-22e367db34acda8cebb0473fddde346b6a9e5dc9.tar.gz |
Don't add extra quotes to quoted wrapped config values
Long config values get wrapped to a second line. If they contain certain
special characters they will also get surrounded by quotes. When this
happened, we would add extra quotes to the value each time the config
file was saved. 94fd250935314aee86759de3e9b0e98a709823ed fixed this
issue for non-wrapped lines. Now it is fixed for wrapped lines as well.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/bundler/settings.rb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index 1ce336c4..d229ba81 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -155,9 +155,10 @@ module Bundler def load_config(config_file) valid_file = config_file && config_file.exist? && !config_file.size.zero? if !ignore_config? && valid_file - config_regex = /^(BUNDLE_.+): (?:['"](.*)['"]|(.+(?:\n(?!BUNDLE).+))|(.+))$/ + config_regex = /^(BUNDLE_.+): (['"]?)(.*(?:\n(?!BUNDLE).+)?)\2$/ config_pairs = config_file.read.scan(config_regex).map do |m| - m.compact.map { |n| n.gsub(/\s+/, " ").tr('"', "'") } + key, _, value = m + [key, value.gsub(/\s+/, " ").tr('"', "'")] end Hash[config_pairs] else |