diff options
author | Santiago Pastorino <santiago@wyeworks.com> | 2010-07-30 16:05:51 -0300 |
---|---|---|
committer | Santiago Pastorino <santiago@wyeworks.com> | 2010-07-30 16:05:51 -0300 |
commit | 5132081975810afade4d783e68731b06d7f37665 (patch) | |
tree | abc7ec4f5597864b416c6e94fe4cda6fadd43b57 /activesupport/lib | |
parent | 95e9ced5815782980230221d6a0b33fde2d74c98 (diff) | |
download | rails-5132081975810afade4d783e68731b06d7f37665.tar.gz rails-5132081975810afade4d783e68731b06d7f37665.tar.bz2 rails-5132081975810afade4d783e68731b06d7f37665.zip |
AS gem doesn't depend on nokogiri so shows a nicer error if users haven't installed
Diffstat (limited to 'activesupport/lib')
-rw-r--r-- | activesupport/lib/active_support/xml_mini/nokogiri.rb | 7 | ||||
-rw-r--r-- | activesupport/lib/active_support/xml_mini/nokogirisax.rb | 9 |
2 files changed, 13 insertions, 3 deletions
diff --git a/activesupport/lib/active_support/xml_mini/nokogiri.rb b/activesupport/lib/active_support/xml_mini/nokogiri.rb index eb61a7fc22..e03a744257 100644 --- a/activesupport/lib/active_support/xml_mini/nokogiri.rb +++ b/activesupport/lib/active_support/xml_mini/nokogiri.rb @@ -1,4 +1,9 @@ -require 'nokogiri' +begin + require 'nokogiri' +rescue LoadError => e + $stderr.puts "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install" + raise e +end require 'active_support/core_ext/object/blank' # = XmlMini Nokogiri implementation diff --git a/activesupport/lib/active_support/xml_mini/nokogirisax.rb b/activesupport/lib/active_support/xml_mini/nokogirisax.rb index 8af7b5e565..38c8685390 100644 --- a/activesupport/lib/active_support/xml_mini/nokogirisax.rb +++ b/activesupport/lib/active_support/xml_mini/nokogirisax.rb @@ -1,4 +1,9 @@ -require 'nokogiri' +begin + require 'nokogiri' +rescue LoadError => e + $stderr.puts "You don't have nokogiri installed in your application. Please add it to your Gemfile and run bundle install" + raise e +end require 'active_support/core_ext/object/blank' # = XmlMini Nokogiri implementation using a SAX-based parser @@ -80,4 +85,4 @@ module ActiveSupport end end end -end
\ No newline at end of file +end |