summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSimon Hengel <sol@typeful.net>2012-11-05 21:49:28 +0100
committerAndre Arko <andre@arko.net>2012-11-06 15:13:55 -0800
commit8142427248a4f6895cb707bc13e89b919bfaba9d (patch)
tree878183b069ef3d1ff5e36394e910449bc6dd343f /lib
parentddfe1e73a8a86bfdcbe7be142aedbf472d33857f (diff)
downloadbundler-8142427248a4f6895cb707bc13e89b919bfaba9d.tar.gz
Fix for Ruby 1.8.7
Commit 7ac9df0a4dcff52971f5aa4c62387286e4e62410 introduced a regression. Psych::SyntaxError is undefined, if 'psych' is not available (e.g. on Ruby 1.8.7).
Diffstat (limited to 'lib')
-rw-r--r--lib/bundler.rb3
-rw-r--r--lib/bundler/psyched_yaml.rb6
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index dec7dcb0b6..18e8dde44b 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -291,13 +291,12 @@ module Bundler
# Eval the gemspec from its parent directory
Dir.chdir(path.dirname.to_s) do
contents = File.read(path.basename.to_s)
-
if contents =~ /\A---/ # try YAML
begin
Gem::Specification.from_yaml(contents)
# Raises ArgumentError if the file is not valid YAML (on syck)
# Psych raises a Psych::SyntaxError
- rescue ArgumentError, Psych::SyntaxError, Gem::EndOfYAMLException, Gem::Exception
+ rescue ArgumentError, YamlSyntaxError, Gem::EndOfYAMLException, Gem::Exception
eval_gemspec(path, contents)
end
else
diff --git a/lib/bundler/psyched_yaml.rb b/lib/bundler/psyched_yaml.rb
index cdc80ca0e4..6a75eecbe1 100644
--- a/lib/bundler/psyched_yaml.rb
+++ b/lib/bundler/psyched_yaml.rb
@@ -13,3 +13,9 @@ end
# Psych might NOT EXIST AT ALL
require 'yaml'
+
+begin
+ YamlSyntaxError = Psych::SyntaxError
+rescue NameError
+ YamlSyntaxError = ArgumentError
+end