Permalink
Browse files

extract the complex Psych-loading process

  • Loading branch information...
1 parent e65e53f commit 0171be663257483af27f4690959c47b049f617cb @indirect indirect committed Oct 19, 2011
Showing with 17 additions and 26 deletions.
  1. +1 −13 lib/bundler.rb
  2. +15 −0 lib/bundler/psyched_yaml.rb
  3. +1 −13 spec/spec_helper.rb
View
@@ -1,19 +1,7 @@
require 'rbconfig'
require 'fileutils'
require 'pathname'
-
-begin
- gem 'psych'
-rescue Gem::LoadError
-end
-
-begin
- # Pull in Psych if we can, but not if Syck is already loaded
- require 'psych' unless defined?(Syck)
-rescue LoadError
-end
-
-require 'yaml'
+require 'bundler/psyched_yaml'
require 'bundler/rubygems_ext'
require 'bundler/rubygems_integration'
require 'bundler/version'
@@ -0,0 +1,15 @@
+# Psych could be a gem
+begin
+ gem 'psych'
+rescue Gem::LoadError
+end
+
+# Psych could be a stdlib
+begin
+ # it's too late if Syck is already loaded
+ require 'psych' unless defined?(Syck)
+rescue LoadError
+end
+
+# Psych might NOT EXIST AT ALL
+require 'yaml'
View
@@ -1,18 +1,6 @@
$:.unshift File.expand_path('..', __FILE__)
$:.unshift File.expand_path('../../lib', __FILE__)
-
-begin
- gem 'psych'
-rescue Gem::LoadError
-end
-
-begin
- require 'psych'
-rescue LoadError
-ensure
- require 'yaml'
-end
-
+require 'bundler/psyched_yaml'
require 'fileutils'
require 'rubygems'
require 'bundler'

0 comments on commit 0171be6

Please sign in to comment.