diff options
author | Strech (Sergey Fedorov) <oni.strech@gmail.com> | 2015-05-14 14:02:14 +0500 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2015-05-16 14:40:18 -0700 |
commit | ed86e50c8c7414c0a53f5288c5e4e7925b4960d5 (patch) | |
tree | 1b0be360183328c77112bfb1a27104d42eff3ad6 /lib/bundler/settings.rb | |
parent | 910529997449d91e94f1ce58dce59dc2212320e2 (diff) | |
download | bundler-ed86e50c8c7414c0a53f5288c5e4e7925b4960d5.tar.gz |
Added backward compatibility for BUNDLE_* config keys
Closes #3557
Diffstat (limited to 'lib/bundler/settings.rb')
-rw-r--r-- | lib/bundler/settings.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb index a29e7104c7..88e139ccd1 100644 --- a/lib/bundler/settings.rb +++ b/lib/bundler/settings.rb @@ -178,7 +178,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 @@ -186,6 +186,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) |