summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Roben <adam@roben.org>2015-01-06 11:53:10 -0500
committerAndre Arko <andre@arko.net>2015-03-30 17:10:49 +0100
commit22e367db34acda8cebb0473fddde346b6a9e5dc9 (patch)
tree4f21d0ee036cc9c51e51729d95fa34a6d46e8a0f
parent1b13dc16a1817f70d17626873c1432f28a964ade (diff)
downloadbundler-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.
-rw-r--r--lib/bundler/settings.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index 1ce336c449..d229ba8134 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