diff options
author | Terence Lee <hone02@gmail.com> | 2012-08-24 17:09:40 -0700 |
---|---|---|
committer | Terence Lee <hone02@gmail.com> | 2012-08-24 17:14:29 -0700 |
commit | 3cadcec49991cb80bab87dd68822eb0118be8523 (patch) | |
tree | 765e787dd296f0db36b85fb6224b50c236fb0183 | |
parent | 8acc82f39d03f9cf0bf1016debdc2e80fe4264fc (diff) | |
download | bundler-3cadcec49991cb80bab87dd68822eb0118be8523.tar.gz |
Fix #2075. Return to old namespace behavior.
$1 gets overidden by gsub.
-rw-r--r-- | lib/bundler/runtime.rb | 5 | ||||
-rw-r--r-- | spec/runtime/require_spec.rb | 18 |
2 files changed, 21 insertions, 2 deletions
diff --git a/lib/bundler/runtime.rb b/lib/bundler/runtime.rb index 2611fa6339..5d7101b2e3 100644 --- a/lib/bundler/runtime.rb +++ b/lib/bundler/runtime.rb @@ -74,8 +74,9 @@ module Bundler Kernel.require namespaced_file rescue LoadError REGEXPS.find { |r| r =~ e.message } - raise if dep.autorequire || ($1 && $1.gsub('-', '/') != namespaced_file) - raise e if $1.nil? + regex_name = $1 + raise if dep.autorequire || (regex_name && regex_name.gsub('-', '/') != namespaced_file) + raise e if regex_name.nil? end else REGEXPS.find { |r| r =~ e.message } diff --git a/spec/runtime/require_spec.rb b/spec/runtime/require_spec.rb index da65c6afee..342deb8c73 100644 --- a/spec/runtime/require_spec.rb +++ b/spec/runtime/require_spec.rb @@ -107,6 +107,24 @@ describe "Bundler.require" do out.should eq("jquery/rails") end + it "silently passes if the require fails" do + build_lib "bcrypt-ruby", "1.0.0", :no_default => true do |s| + s.write "lib/brcrypt.rb", "BCrypt = '1.0.0'" + end + gemfile <<-G + path "#{lib_path}" + gem "bcrypt-ruby" + G + + cmd = <<-RUBY + require 'bundler' + Bundler.require + RUBY + ruby(cmd, :expect_err => true) + + err.should be_empty + end + it "does not mangle explictly given requires" do gemfile <<-G path "#{lib_path}" |