summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Arko <andre@arko.net>2015-05-16 22:50:09 -0700
committerAndre Arko <andre@arko.net>2015-05-16 22:50:09 -0700
commit86c0b7775690f5b00fe3f3f73ae407b2fa6db875 (patch)
tree54e974cb12ed5148f35b8d1213b1a9d7b08a4273
parent7536f442674f3a8d8407fdf72719559340783a77 (diff)
parentbe432f5bceacf37e08d4dc8e3a727717260f18f7 (diff)
downloadbundler-86c0b7775690f5b00fe3f3f73ae407b2fa6db875.tar.gz
Merge tag 'v1.9.9' into 1-10-stable
Version 1.9.9 Conflicts: CHANGELOG.md lib/bundler/fetcher.rb lib/bundler/lockfile_parser.rb lib/bundler/version.rb
-rw-r--r--CHANGELOG.md18
-rw-r--r--lib/bundler/lockfile_parser.rb12
-rw-r--r--lib/bundler/settings.rb8
-rw-r--r--spec/bundler/settings_spec.rb18
4 files changed, 52 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1b3e699fa7..4b08c2d2e0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -41,6 +41,24 @@ Deprecations:
- deprecated the (never enabled) `bundle_ruby` binary (@smlance)
+## 1.9.9 (2015-05-16)
+
+Bugfixes:
+
+ - read mirror and credential settings from older versions (#3557, @Strech)
+
+## 1.9.8 (2015-05-12)
+
+Bugfixes:
+
+ - fix regression in sudo mode introduced by 1.9.7 (#3642, @segiddins)
+
+## 1.9.7 (2015-05-11)
+
+Bugfixes:
+
+ - always clean up tmp dirs (#3277, @hone, @indirect, @segiddins)
+
## 1.9.6 (2015-05-02)
Bugfixes:
diff --git a/lib/bundler/lockfile_parser.rb b/lib/bundler/lockfile_parser.rb
index 21367fe70c..c499d9a070 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 7a58c8af54..beb53205ec 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)
diff --git a/spec/bundler/settings_spec.rb b/spec/bundler/settings_spec.rb
index cb8440689e..54485f8ccb 100644
--- a/spec/bundler/settings_spec.rb
+++ b/spec/bundler/settings_spec.rb
@@ -141,6 +141,24 @@ describe Bundler::Settings do
settings["mirror.https://rubygems.org"] = "http://rubygems-mirror.org"
expect(settings.gem_mirrors).to eq(URI("https://rubygems.org/") => URI("http://rubygems-mirror.org/"))
end
+ end
+
+ describe "BUNDLE_ keys format" do
+ let(:settings) { described_class.new(bundled_app('.bundle')) }
+
+ it "converts older keys without double dashes" do
+ config("BUNDLE_MY__PERSONAL.RACK" => "~/Work/git/rack")
+ expect(settings["my.personal.rack"]).to eq("~/Work/git/rack")
+ end
+ it "converts older keys without trailing slashes and double dashes" do
+ config("BUNDLE_MIRROR__HTTPS://RUBYGEMS.ORG" => "http://rubygems-mirror.org")
+ expect(settings["mirror.https://rubygems.org/"]).to eq("http://rubygems-mirror.org")
+ end
+
+ it "reads newer keys format properly" do
+ config("BUNDLE_MIRROR__HTTPS://RUBYGEMS__ORG/" => "http://rubygems-mirror.org")
+ expect(settings["mirror.https://rubygems.org/"]).to eq("http://rubygems-mirror.org")
+ end
end
end