mirror of
https://github.com/awesome-print/awesome_print
synced 2023-03-27 23:22:34 -04:00
Fix loadpath issues that became apparent outside of the spec suite
This commit is contained in:
parent
87850a2d6a
commit
8242bdf847
8 changed files with 30 additions and 40 deletions
|
@ -1,19 +1,26 @@
|
||||||
# AwesomePrint might be loaded implicitly through ~/.irbrc or ~/.pryrc
|
require 'awesome_print/formatters'
|
||||||
# so do nothing for subsequent requires.
|
require 'awesome_print/inspector'
|
||||||
#
|
require 'awesome_print/formatter'
|
||||||
unless defined?(AwesomePrint::Inspector)
|
require 'awesome_print/version'
|
||||||
# FIXME: not sure we need these, but..
|
|
||||||
require 'awesome_print/custom_defaults'
|
|
||||||
|
|
||||||
%w(active_support awesome_method_array string object class kernel).each do |file|
|
module AwesomePrint
|
||||||
|
class << self
|
||||||
|
attr_accessor :defaults, :force_colors
|
||||||
|
|
||||||
|
# Class accessor to force colorized output (ex. forked subprocess where TERM
|
||||||
|
# might be dumb).
|
||||||
|
#---------------------------------------------------------------------------
|
||||||
|
def force_colors!(value = true)
|
||||||
|
@force_colors = value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
# CORE EXTENSIONS... now that ap is loaded, inject awesome behavior into ruby
|
||||||
|
%w(awesome_method_array string object class kernel logger active_support).each do |file|
|
||||||
require "awesome_print/core_ext/#{file}"
|
require "awesome_print/core_ext/#{file}"
|
||||||
end
|
end
|
||||||
|
|
||||||
require 'awesome_print/inspector'
|
# FIXME: not sure we need these, but..
|
||||||
require 'awesome_print/formatter'
|
require 'awesome_print/custom_defaults'
|
||||||
|
|
||||||
Dir["./lib/awesome_print/formatters/**/*.rb"].each { |f| require f }
|
|
||||||
|
|
||||||
require 'awesome_print/version'
|
|
||||||
require 'awesome_print/core_ext/logger' if defined?(Logger)
|
|
||||||
end
|
|
||||||
|
|
|
@ -11,5 +11,5 @@ module AwesomePrint
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Logger.send(:include, AwesomePrint::Logger)
|
Logger.send(:include, AwesomePrint::Logger) if defined?(Logger)
|
||||||
ActiveSupport::BufferedLogger.send(:include, AwesomePrint::Logger) if defined?(ActiveSupport::BufferedLogger)
|
ActiveSupport::BufferedLogger.send(:include, AwesomePrint::Logger) if defined?(ActiveSupport::BufferedLogger)
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
module AwesomePrint
|
module AwesomePrint
|
||||||
class << self
|
class << self
|
||||||
attr_accessor :defaults, :force_colors
|
|
||||||
|
|
||||||
# Class accessor to force colorized output (ex. forked subprocess where TERM
|
|
||||||
# might be dumb).
|
|
||||||
#---------------------------------------------------------------------------
|
|
||||||
def force_colors!(value = true)
|
|
||||||
@force_colors = value
|
|
||||||
end
|
|
||||||
|
|
||||||
def console?
|
def console?
|
||||||
boolean(defined?(IRB) || defined?(Pry))
|
boolean(defined?(IRB) || defined?(Pry))
|
||||||
|
|
|
@ -1,15 +1,6 @@
|
||||||
module AwesomePrint
|
module AwesomePrint
|
||||||
module Formatters
|
module Formatters
|
||||||
require 'awesome_print/formatters/object_formatter'
|
Dir[File.join(__dir__, 'formatters', '**', '*.rb')].each { |f| require f }
|
||||||
require 'awesome_print/formatters/struct_formatter'
|
|
||||||
require 'awesome_print/formatters/hash_formatter'
|
|
||||||
require 'awesome_print/formatters/array_formatter'
|
|
||||||
require 'awesome_print/formatters/simple_formatter'
|
|
||||||
require 'awesome_print/formatters/method_formatter'
|
|
||||||
require 'awesome_print/formatters/class_formatter'
|
|
||||||
require 'awesome_print/formatters/dir_formatter'
|
|
||||||
require 'awesome_print/formatters/file_formatter'
|
|
||||||
require 'awesome_print/colorize'
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
require_relative 'formatter'
|
||||||
|
|
||||||
module AwesomePrint
|
module AwesomePrint
|
||||||
module Registrar
|
module Registrar
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,6 @@ module AwesomePrint
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.version
|
def self.version
|
||||||
'2.0.0.pre'
|
'2.0.0.pre2'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
|
|
||||||
require 'logger'
|
|
||||||
require 'awesome_print/core_ext/logger'
|
|
||||||
|
|
||||||
RSpec.describe 'AwesomePrint logging extensions' do
|
RSpec.describe 'AwesomePrint logging extensions' do
|
||||||
before(:all) do
|
before(:all) do
|
||||||
@logger = Logger.new('/dev/null') rescue Logger.new('nul')
|
@logger = Logger.new('/dev/null') rescue Logger.new('nul')
|
||||||
|
|
|
@ -30,6 +30,8 @@ ExtVerifier.require_dependencies!(
|
||||||
mongoid
|
mongoid
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
require 'logger'
|
||||||
require 'nokogiri'
|
require 'nokogiri'
|
||||||
require 'awesome_print'
|
require 'awesome_print'
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue