diff options
author | Terence Lee <hone02@gmail.com> | 2011-12-21 19:47:12 -0500 |
---|---|---|
committer | Terence Lee <hone02@gmail.com> | 2011-12-21 19:47:12 -0500 |
commit | d45742257ee89611ada7d3f53d6ce7e42e7a2802 (patch) | |
tree | cf4d298ad3f2d085a739ffeb3a7a3ebdccd5388e | |
parent | a858ab61c8113f329d7930f492107110160691d2 (diff) | |
download | bundler-d45742257ee89611ada7d3f53d6ce7e42e7a2802.tar.gz |
fix issue when global .bundle/config is empty
-rw-r--r-- | lib/bundler/settings.rb | 2 | ||||
-rw-r--r-- | spec/install/gems/simple_case_spec.rb | 12 |
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 |