summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTerence Lee <hone02@gmail.com>2011-12-21 19:47:12 -0500
committerTerence Lee <hone02@gmail.com>2011-12-21 19:47:12 -0500
commitd45742257ee89611ada7d3f53d6ce7e42e7a2802 (patch)
treecf4d298ad3f2d085a739ffeb3a7a3ebdccd5388e
parenta858ab61c8113f329d7930f492107110160691d2 (diff)
downloadbundler-d45742257ee89611ada7d3f53d6ce7e42e7a2802.tar.gz
fix issue when global .bundle/config is empty
-rw-r--r--lib/bundler/settings.rb2
-rw-r--r--spec/install/gems/simple_case_spec.rb12
2 files changed, 13 insertions, 1 deletions
diff --git a/lib/bundler/settings.rb b/lib/bundler/settings.rb
index a7e0f025e4..ea2404b064 100644
--- a/lib/bundler/settings.rb
+++ b/lib/bundler/settings.rb
@@ -3,7 +3,7 @@ module Bundler
def initialize(root)
@root = root
@local_config = (File.exist?(local_config_file) && yaml = YAML.load_file(local_config_file)) ? yaml : {}
- @global_config = File.exist?(global_config_file) ? YAML.load_file(global_config_file) : {}
+ @global_config = (File.exist?(global_config_file) && yaml = YAML.load_file(global_config_file)) ? yaml : {}
end
def [](key)
diff --git a/spec/install/gems/simple_case_spec.rb b/spec/install/gems/simple_case_spec.rb
index 513807f1c8..a8dd586fe0 100644
--- a/spec/install/gems/simple_case_spec.rb
+++ b/spec/install/gems/simple_case_spec.rb
@@ -325,6 +325,18 @@ describe "bundle install with gem sources" do
G
exitstatus.should == 0
end
+
+ it "doesn't blow up when the global .bundle/config is empty" do
+ FileUtils.mkdir_p("#{Bundler.rubygems.user_home}/.bundle")
+ FileUtils.touch("#{Bundler.rubygems.user_home}/.bundle/config")
+
+ install_gemfile(<<-G, :exitstatus => true)
+ source "file://#{gem_repo1}"
+
+ gem 'foo'
+ G
+ exitstatus.should == 0
+ end
end
describe "when prerelease gems are available" do