-
Notifications
You must be signed in to change notification settings - Fork 455
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 vN.... (was v2, but not anymore..) #193
base: master
Are you sure you want to change the base?
Changes from all commits
7e6e7c0
f6fbe02
c75c058
cf91f4e
f5f494b
b48989c
141628d
f230268
c2563be
9ad2ddb
708a79c
ffa2e30
3470b72
db32b90
3e0e124
2d786cf
6ec149d
2cbdbc8
040f129
d7fe4c8
4b9f0bf
5a9da75
e9a4c72
2426de2
2cffbaa
556a1cc
437857b
8696ec2
2727d38
b4e782c
02982d1
f791021
413a350
05fad93
9c320e6
1def646
17abe6d
d27284f
58d618c
0f5d96b
4d6e963
ea274a5
9168b0d
ab63f91
ad175c1
9cb3a15
7695cfc
a9629ba
3f24897
188becf
4332366
95c6bfd
d2a0719
de51f83
896e8f7
a4d960f
1dd896f
a9c6a90
aef581d
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 |
---|---|---|
@@ -1,13 +1,11 @@ | ||
# Copyright (c) 2010-2013 Michael Dvorkin | ||
# | ||
# 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 "rake" | ||
require 'awesome_print/version' | ||
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. maybe go back to |
||
|
||
Gem::Specification.new do |s| | ||
s.name = "awesome_print" | ||
s.version = "1.6.2" | ||
s.version = AwesomePrint.version | ||
# s.platform = Gem::Platform::RUBY | ||
s.authors = "Michael Dvorkin" | ||
s.date = Time.now.strftime("%Y-%m-%d") | ||
|
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,25 @@ | ||
# Copyright (c) 2010-2013 Michael Dvorkin | ||
# | ||
# 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(array string method object class kernel).each do |file| | ||
require File.dirname(__FILE__) + "/awesome_print/core_ext/#{file}" | ||
require "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/version" | ||
require File.dirname(__FILE__) + "/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 File.dirname(__FILE__) + "/awesome_print/ext/active_record" if defined?(ActiveRecord) || AwesomePrint.rails_console? | ||
require File.dirname(__FILE__) + "/awesome_print/ext/active_support" if defined?(ActiveSupport) || AwesomePrint.rails_console? | ||
require 'awesome_print/support' | ||
require 'awesome_print/configuration' | ||
require 'awesome_print/inspector' | ||
require 'awesome_print/formatter' | ||
require 'awesome_print/version' | ||
require 'awesome_print/core_ext/logger' if defined?(Logger) | ||
|
||
# | ||
# Load remaining extensions. | ||
# | ||
if defined?(ActiveSupport) | ||
ActiveSupport.on_load(:action_view) do | ||
require File.dirname(__FILE__) + "/awesome_print/ext/action_view" | ||
require 'awesome_print/ext/action_view' | ||
end | ||
end | ||
require File.dirname(__FILE__) + "/awesome_print/ext/mongo_mapper" if defined?(MongoMapper) | ||
require File.dirname(__FILE__) + "/awesome_print/ext/mongoid" if defined?(Mongoid) | ||
require File.dirname(__FILE__) + "/awesome_print/ext/nokogiri" if defined?(Nokogiri) | ||
require File.dirname(__FILE__) + "/awesome_print/ext/nobrainer" if defined?(NoBrainer) | ||
require File.dirname(__FILE__) + "/awesome_print/ext/ripple" if defined?(Ripple) | ||
require File.dirname(__FILE__) + "/awesome_print/ext/sequel" if defined?(Sequel) | ||
require File.dirname(__FILE__) + "/awesome_print/ext/ostruct" if defined?(OpenStruct) | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
module AwesomePrint | ||
|
||
class << self # Class accessors for custom defaults. | ||
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? | ||
!!(defined?(IRB) || defined?(Pry)) | ||
end | ||
|
||
def rails_console? | ||
console? && !!(defined?(Rails::Console) || ENV["RAILS_ENV"]) | ||
end | ||
|
||
def irb! | ||
return unless defined?(IRB) | ||
unless IRB.version.include?("DietRB") | ||
IRB::Irb.class_eval do | ||
def output_value | ||
ap @context.last_value | ||
end | ||
end | ||
else # MacRuby | ||
IRB.formatter = Class.new(IRB::Formatter) do | ||
def inspect_object(object) | ||
object.ai | ||
end | ||
end.new | ||
end | ||
end | ||
|
||
def pry! | ||
if defined?(Pry) | ||
Pry.print = proc { |output, value| output.puts value.ai } | ||
end | ||
end | ||
end | ||
end |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
# Copyright (c) 2010-2013 Michael Dvorkin | ||
# | ||
# Awesome Print is freely distributable under the terms of MIT license. | ||
# See LICENSE file or http://www.opensource.org/licenses/mit-license.php | ||
#------------------------------------------------------------------------------ | ||
module Kernel | ||
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. 👍 getting rid of the superfluous copyright lines. It's not necessary given a master license. |
||
|
||
def ai(options = {}) | ||
|
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.
i think this README change deserves a separate PR, so it gets into the main README ASAP.