From c88594a811a0c783a65beefd0f21167e6dd43e7b Mon Sep 17 00:00:00 2001 From: Mike Dvorkin Date: Tue, 8 Nov 2011 22:03:16 -0800 Subject: [PATCH] Keep lib/ap.rb for backwards compatibility --- lib/ap.rb | 22 +++------------------- lib/awesome_print.rb | 9 ++++----- 2 files changed, 7 insertions(+), 24 deletions(-) diff --git a/lib/ap.rb b/lib/ap.rb index 7c689a2..98eaac0 100755 --- a/lib/ap.rb +++ b/lib/ap.rb @@ -4,23 +4,7 @@ # See LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------ # -# AwesomePrint might be loaded implicitly through ~/.irbrc so do nothing -# for subsequent requires. +# Keeping this for backwards compatibility to allow +# require "ap" # -unless defined?(AwesomePrint) - %w(array string method object class kernel).each do |file| - require File.dirname(__FILE__) + "/awesome_print/core_ext/#{file}" - end - - require File.dirname(__FILE__) + "/awesome_print/inspector" - require File.dirname(__FILE__) + "/awesome_print/formatter" - require File.dirname(__FILE__) + "/awesome_print/core_ext/logger" if defined?(Logger) - require File.dirname(__FILE__) + "/awesome_print/ext/action_view" if defined?(ActionView) - - # Load the following under normal circumstances as well as in Rails - # console when required from ~/.irbrc. - require File.dirname(__FILE__) + "/awesome_print/ext/active_record" if defined?(ActiveRecord) || (defined?(IRB) && ENV['RAILS_ENV']) - require File.dirname(__FILE__) + "/awesome_print/ext/active_support" if defined?(ActiveSupport) || (defined?(IRB) && ENV['RAILS_ENV']) - require File.dirname(__FILE__) + "/awesome_print/ext/mongo_mapper" if defined?(MongoMapper) - require File.dirname(__FILE__) + "/awesome_print/ext/mongoid" if defined?(Mongoid) -end +require File.dirname(__FILE__) + "/awesome_print" diff --git a/lib/awesome_print.rb b/lib/awesome_print.rb index 62b426b..7c689a2 100755 --- a/lib/awesome_print.rb +++ b/lib/awesome_print.rb @@ -4,10 +4,8 @@ # See LICENSE file or http://www.opensource.org/licenses/mit-license.php #------------------------------------------------------------------------------ # -# This is the copy of original 'ap.rb' file that matches the gem name. It makes -# it possible to omit the :require part in bundler's Gemfile: -# -# gem 'awesome_print', '>= 0.4.0' +# AwesomePrint might be loaded implicitly through ~/.irbrc so do nothing +# for subsequent requires. # unless defined?(AwesomePrint) %w(array string method object class kernel).each do |file| @@ -19,9 +17,10 @@ unless defined?(AwesomePrint) require File.dirname(__FILE__) + "/awesome_print/core_ext/logger" if defined?(Logger) require File.dirname(__FILE__) + "/awesome_print/ext/action_view" if defined?(ActionView) - # Load the following under normal circumstatnces as well as in Rails + # Load the following under normal circumstances as well as in Rails # console when required from ~/.irbrc. require File.dirname(__FILE__) + "/awesome_print/ext/active_record" if defined?(ActiveRecord) || (defined?(IRB) && ENV['RAILS_ENV']) require File.dirname(__FILE__) + "/awesome_print/ext/active_support" if defined?(ActiveSupport) || (defined?(IRB) && ENV['RAILS_ENV']) require File.dirname(__FILE__) + "/awesome_print/ext/mongo_mapper" if defined?(MongoMapper) + require File.dirname(__FILE__) + "/awesome_print/ext/mongoid" if defined?(Mongoid) end