-
Notifications
You must be signed in to change notification settings - Fork 453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
awesome print 2.0 #350
base: master
Are you sure you want to change the base?
awesome print 2.0 #350
Changes from all commits
2105efb
3738676
bb5e751
7eaf2ca
102d254
32e7efd
856f8c4
e2bc9c2
f0ed2e2
7f7c0bf
bf1ff13
1e5c6c9
751d6c9
e2acfab
a45b2ac
5eb57ad
dbe414d
7ace70b
da29f74
52933a1
1ff1206
fe0786d
976e4a5
87850a2
8242bdf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,4 @@ Gemfile.lock | |
# PROJECT::RBENV | ||
.ruby-gemset | ||
.awesome-print/ | ||
.byebug_history |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
--format Fuubar | ||
--color |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,11 @@ | ||
# Copyright (c) 2010-2016 Michael Dvorkin and contributors | ||
# | ||
# Awesome Print is freely distributable under the terms of MIT license. | ||
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php | ||
#------------------------------------------------------------------------------ | ||
|
||
$:.push File.expand_path('../lib', __FILE__) | ||
require 'awesome_print/version' | ||
|
||
Gem::Specification.new do |s| | ||
s.name = 'awesome_print' | ||
s.version = AwesomePrint.version | ||
s.authors = 'Michael Dvorkin' | ||
s.authors = 'Michael Dvorkin, James Cox & contributors' | ||
s.date = Time.now.strftime('%Y-%m-%d') | ||
s.email = '[email protected]' | ||
s.homepage = 'https://github.com/awesome-print/awesome_print' | ||
s.summary = 'Pretty print Ruby objects with proper indentation and colors' | ||
s.description = 'Great Ruby debugging companion: pretty print Ruby objects to visualize their structure. Supports custom object formatting via plugins' | ||
|
@@ -24,7 +17,9 @@ Gem::Specification.new do |s| | |
s.require_paths = ['lib'] | ||
|
||
s.add_development_dependency 'rspec', '>= 3.0.0' | ||
s.add_development_dependency 'fuubar' | ||
s.add_development_dependency 'appraisal' | ||
s.add_development_dependency 'byebug' | ||
s.add_development_dependency 'fakefs', '>= 0.2.1' | ||
s.add_development_dependency 'sqlite3' | ||
s.add_development_dependency 'nokogiri', '>= 1.6.5' | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,6 @@ | ||
# Copyright (c) 2010-2016 Michael Dvorkin and contributors | ||
# | ||
# Awesome Print is freely distributable under the terms of MIT license. | ||
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php | ||
#------------------------------------------------------------------------------ | ||
# | ||
# Keeping this for backwards compatibility to allow | ||
# require "ap" | ||
# | ||
require File.dirname(__FILE__) + '/awesome_print' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,26 @@ | ||
# Copyright (c) 2010-2016 Michael Dvorkin and contributors | ||
# | ||
# Awesome Print is freely distributable under the terms of MIT license. | ||
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php | ||
#------------------------------------------------------------------------------ | ||
# | ||
# AwesomePrint might be loaded implicitly through ~/.irbrc or ~/.pryrc | ||
# so do nothing for subsequent requires. | ||
# | ||
unless defined?(AwesomePrint::Inspector) | ||
%w(awesome_method_array string method object class kernel).each do |file| | ||
require "awesome_print/core_ext/#{file}" | ||
end | ||
require 'awesome_print/formatters' | ||
require 'awesome_print/inspector' | ||
require 'awesome_print/formatter' | ||
require 'awesome_print/version' | ||
|
||
module AwesomePrint | ||
class << self | ||
attr_accessor :defaults, :force_colors | ||
|
||
require 'awesome_print/custom_defaults' | ||
require 'awesome_print/inspector' | ||
require 'awesome_print/formatter' | ||
require 'awesome_print/version' | ||
require 'awesome_print/core_ext/logger' if defined?(Logger) | ||
# | ||
# Load the following under normal circumstances as well as in Rails | ||
# console when required from ~/.irbrc or ~/.pryrc. | ||
# | ||
require 'awesome_print/ext/active_record' if defined?(ActiveRecord) || AwesomePrint.rails_console? | ||
require 'awesome_print/ext/active_support' if defined?(ActiveSupport) || AwesomePrint.rails_console? | ||
# | ||
# Load remaining extensions. | ||
# | ||
if defined?(ActiveSupport.on_load) | ||
ActiveSupport.on_load(:action_view) do | ||
require 'awesome_print/ext/action_view' | ||
# Class accessor to force colorized output (ex. forked subprocess where TERM | ||
# might be dumb). | ||
#--------------------------------------------------------------------------- | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably way overkill for this PR, but may make sense to look into YARDoc later as a standard documentation framework. |
||
def force_colors!(value = true) | ||
@force_colors = value | ||
end | ||
end | ||
require 'awesome_print/ext/mongo_mapper' if defined?(MongoMapper) | ||
require 'awesome_print/ext/mongoid' if defined?(Mongoid) | ||
require 'awesome_print/ext/nokogiri' if defined?(Nokogiri) | ||
require 'awesome_print/ext/nobrainer' if defined?(NoBrainer) | ||
require 'awesome_print/ext/ripple' if defined?(Ripple) | ||
require 'awesome_print/ext/sequel' if defined?(Sequel) | ||
require 'awesome_print/ext/ostruct' if defined?(OpenStruct) | ||
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}" | ||
end | ||
|
||
# FIXME: not sure we need these, but.. | ||
require 'awesome_print/custom_defaults' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ module Colorize | |
# Pick the color and apply it to the given string as necessary. | ||
#------------------------------------------------------------------------------ | ||
def colorize(str, type) | ||
# puts "[COLORIZING] - using #{options[:color][type]} for #{type}" if AwesomePrint.debug | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Forgot some commented code here? |
||
str = CGI.escapeHTML(str) if options[:html] | ||
if options[:plain] || !options[:color][type] || !inspector.colorize? | ||
str | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# | ||
# Colorize Rails logs. | ||
# | ||
if defined?(ActiveSupport::LogSubscriber) | ||
AwesomePrint.force_colors! ActiveSupport::LogSubscriber.colorize_logging | ||
end | ||
|
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also use
extend self
here instead of the singleton class trick.