diff options
author | Andre Arko <andre@arko.net> | 2012-11-14 20:44:38 -0800 |
---|---|---|
committer | Andre Arko <andre@arko.net> | 2012-11-14 20:44:38 -0800 |
commit | 990458320797564b1cae4139e2a180d71e89a2c5 (patch) | |
tree | 56809cb4c1c48842b95a31cc684e57b462c3347f | |
parent | f99bc89baa20c26b84d7e4d146968451afd78b95 (diff) | |
download | bundler-990458320797564b1cae4139e2a180d71e89a2c5.tar.gz |
make sure we require psych if gem fails
-rw-r--r-- | lib/bundler/psyched_yaml.rb | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/lib/bundler/psyched_yaml.rb b/lib/bundler/psyched_yaml.rb index 70bd4b7f71..9447475f1d 100644 --- a/lib/bundler/psyched_yaml.rb +++ b/lib/bundler/psyched_yaml.rb @@ -1,17 +1,20 @@ +# Psych could be a gem, so try to ask for it begin - # Psych could be a gem, so set up the load path - gem 'psych' if defined?(gem) + gem 'psych' +rescue LoadError +end if defined?(gem) - # Psych could just be in the stdlib - # but it's too late if Syck is already loaded +# Psych could just be in the stdlib +# but it's too late if Syck is already loaded +begin require 'psych' unless defined?(Syck) rescue LoadError - # apparently Psych wasn't available. Oh well. -ensure - # at least load the YAML stdlib, whatever that may be - require 'yaml' + # Apparently Psych wasn't available. Oh well. end +# At least load the YAML stdlib, whatever that may be +require 'yaml' + module Bundler # On encountering invalid YAML, # Psych raises Psych::SyntaxError |