From 934d2945925b30e9c8ee6b6b423fad5abc382b6d Mon Sep 17 00:00:00 2001 From: Mike Dvorkin Date: Sat, 13 Nov 2010 09:24:26 -0800 Subject: [PATCH] Copied ap.rb to awesome_print.rb to match gem name; removed redundant logic for Logger --- lib/ap.rb | 3 +-- lib/ap/core_ext/logger.rb | 2 +- lib/awesome_print.rb | 18 +++++++----------- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/lib/ap.rb b/lib/ap.rb index 5158220..8400044 100755 --- a/lib/ap.rb +++ b/lib/ap.rb @@ -8,8 +8,7 @@ end require File.dirname(__FILE__) + "/ap/awesome_print" -require File.dirname(__FILE__) + "/ap/core_ext/logger" if defined?(::Logger) or defined?(::ActiveSupport::BufferedLogger) +require File.dirname(__FILE__) + "/ap/core_ext/logger" if defined?(::Logger) require File.dirname(__FILE__) + "/ap/mixin/action_view" if defined?(::ActionView) require File.dirname(__FILE__) + "/ap/mixin/active_record" if defined?(::ActiveRecord) require File.dirname(__FILE__) + "/ap/mixin/active_support" if defined?(::ActiveSupport) - diff --git a/lib/ap/core_ext/logger.rb b/lib/ap/core_ext/logger.rb index 1355e8a..7f82531 100644 --- a/lib/ap/core_ext/logger.rb +++ b/lib/ap/core_ext/logger.rb @@ -14,5 +14,5 @@ module AwesomePrintLogger end -Logger.send(:include, AwesomePrintLogger) if defined?(Logger) +Logger.send(:include, AwesomePrintLogger) ActiveSupport::BufferedLogger.send(:include, AwesomePrintLogger) if defined?(::ActiveSupport::BufferedLogger) diff --git a/lib/awesome_print.rb b/lib/awesome_print.rb index 67b8582..cb7af89 100755 --- a/lib/awesome_print.rb +++ b/lib/awesome_print.rb @@ -10,16 +10,12 @@ # gem 'awesome_print', '>= 0.2.1', :require => 'ap' # gem 'awesome_print', '>= 3.0.0' # -require File.dirname(__FILE__) + "/ap/core_ext/array" -require File.dirname(__FILE__) + "/ap/core_ext/string" -require File.dirname(__FILE__) + "/ap/core_ext/object" -require File.dirname(__FILE__) + "/ap/core_ext/class" -require File.dirname(__FILE__) + "/ap/core_ext/kernel" +%w(array string method object class kernel).each do |file| + require File.dirname(__FILE__) + "/ap/core_ext/#{file}" +end + require File.dirname(__FILE__) + "/ap/awesome_print" - -require File.dirname(__FILE__) + "/ap/core_ext/logger" if defined?(::Logger) or defined?(::ActiveSupport::BufferedLogger) - -require File.dirname(__FILE__) + "/ap/mixin/action_view" if defined?(::ActionView) -require File.dirname(__FILE__) + "/ap/mixin/active_record" if defined?(::ActiveRecord) +require File.dirname(__FILE__) + "/ap/core_ext/logger" if defined?(::Logger) +require File.dirname(__FILE__) + "/ap/mixin/action_view" if defined?(::ActionView) +require File.dirname(__FILE__) + "/ap/mixin/active_record" if defined?(::ActiveRecord) require File.dirname(__FILE__) + "/ap/mixin/active_support" if defined?(::ActiveSupport) -