aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bundler/settings.rb
diff options
context:
space:
mode:
authorAdam Roben <adam@roben.org>2015-01-06 11:53:10 -0500
committerAndre Arko <andre@arko.net>2015-01-26 23:42:35 -0800
commit39376ca535b3d2dd211c4b6706a55fbf211b0c78 (patch)
tree54d94b9620a70c52ddfc52d5a88e3c654cc887a5 /lib/bundler/settings.rb
parent54d7681e280cbfc6d84688ea2017eafdc0610cd2 (diff)
downloadbundler-39376ca535b3d2dd211c4b6706a55fbf211b0c78.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/bundler/settings.rb')
-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 56ffeba6..afaddf99 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -165,9 +165,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