Permalink
Browse files

Revert "Revert "work around Ruby bug empty files in YAML.load_file""

Travis is failing on 1.9.3p194 without this patch.

This reverts commit 4449672.
  • Loading branch information...
1 parent 7719a95 commit 63a6a93e7a7f3ef635689cb91478065c078d9313 @indirect indirect committed May 27, 2012
Showing with 10 additions and 2 deletions.
  1. +10 −2 lib/bundler/settings.rb
@@ -2,8 +2,8 @@ module Bundler
class Settings
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 = YAML.load_file(global_config_file)) ? yaml : {}
+ @local_config = load_config(local_config_file)
+ @global_config = load_config(global_config_file)
end
def [](key)
@@ -124,5 +124,13 @@ def global_config_file
def local_config_file
Pathname.new("#{@root}/config")
end
+
+ def load_config(config_file)
+ if config_file.exist? && !config_file.size.zero?
+ yaml = YAML.load_file(config_file)
+ end
+ yaml || {}
+ end
+
end
end

0 comments on commit 63a6a93

Please sign in to comment.