Permalink
Browse files

Initial public commit

  • Loading branch information...
michaeldv committed Apr 3, 2010
1 parent 55cdefa commit 4ac2bfd653127257ac1a07a8bed3abf1163fe039
Showing with 879 additions and 40 deletions.
  1. +0 −5 .document
  2. +2 −1 LICENSE
  3. +134 −0 README.md
  4. +0 −17 README.rdoc
  5. +12 −9 Rakefile
  6. +1 −1 VERSION
  7. +63 −0 awesome_print.gemspec
  8. +1 −0 init.rb
  9. +10 −0 lib/ap.rb
  10. +194 −0 lib/ap/awesome_print.rb
  11. +14 −0 lib/ap/core_ext/kernel.rb
  12. +21 −0 lib/ap/core_ext/string.rb
  13. +60 −0 lib/ap/mixin/rails.rb
  14. +1 −0 rails/init.rb
  15. +0 −7 spec/ap_spec.rb
  16. +261 −0 spec/awesome_print_spec.rb
  17. +87 −0 spec/rails_spec.rb
  18. +18 −0 spec/string_spec.rb
View
@@ -1,5 +0,0 @@
-README.rdoc
-lib/**/*.rb
-bin/*
-features/**/*.feature
-LICENSE
View
@@ -1,4 +1,5 @@
-Copyright (c) 2009 Mike Dvorkin
+Copyright (c) 2010 Michael Dvorkin
+%w(mike dvorkin.net) * "@" || %w(mike fatfreecrm.com) * "@"
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
134 README.md
@@ -0,0 +1,134 @@
+## Awesome Print ##
+ Awesome Print is Ruby library that pretty prints Ruby objects in full color
+ exposing their internal structure with proper indentation. Rails ActiveRecord
+ objects are supported via included mixin.
+
+### Installation ###
+ $ # Installing as Ruby gem
+ $ gem install awesome_print
+
+ # Installing as Rails plugin
+ $ ruby script/plugin install http://github.com/michaeldv/awesome_print_.git
+
+ $ # Cloning the repository
+ $ git clone git://github.com/michaeldv/awesome_print_.git
+
+### Usage ###
+ require "ap"
+ ap(object, options = {})
+
+ Default options:
+ :miltiline => true,
+ :plain => false,
+ :colors => {
+ :array => :white,
+ :bignum => :blue,
+ :class => :yellow,
+ :date => :greenish,
+ :falseclass => :red,
+ :fixnum => :blue,
+ :float => :blue,
+ :hash => :gray,
+ :nilclass => :red,
+ :string => :yellowish,
+ :symbol => :cyanish,
+ :time => :greenish,
+ :trueclass => :green
+ }
+
+ Supported color names:
+ :gray, :red, :green, :yellow, :blue, :purple, :cyan, :white
+ :black, :redish, :greenish, :yellowish, :blueish, :purpleish, :cyanish, :pale
+
+### Example (IRB) ###
+ $ irb
+ irb> require "ap"
+ irb> data = [ false, 42, %w(fourty two), { :now => Time.now, :class => Time.now.class, :distance => 42e42 } ]
+ irb> ap data
+ [
+ [0] false,
+ [1] 42,
+ [2] [
+ [0] "fourty",
+ [1] "two"
+ ],
+ [3] {
+ :class => Time < Object,
+ :now => Fri Apr 02 19:55:53 -0700 2010,
+ :distance => 4.2e+43
+ }
+ ]
+ irb> ap data, :multiline => false
+ [ false, 42, [ "fourty", "two" ], { :class => Time < Object, :distance => 4.2e+43, :now => Fri Apr 02 19:44:52 -0700 2010 } ]
+ irb>
+
+### Example (Rails) ###
+ $ ruby script/console
+ Loading development environment (Rails 2.3.5)
+ rails> require "ap"
+ rails> ap Account.all(:limit => 2)
+ [
+ [0] #<Account:0x1033220b8> {
+ :id => 1,
+ :user_id => 5,
+ :assigned_to => 7,
+ :name => "Hayes-DuBuque",
+ :access => "Public",
+ :website => "http://www.hayesdubuque.com",
+ :toll_free_phone => "1-800-932-6571",
+ :phone => "(111)549-5002",
+ :fax => "(349)415-2266",
+ :deleted_at => nil,
+ :created_at => Sat, 06 Mar 2010 09:46:10 UTC +00:00,
+ :updated_at => Sat, 06 Mar 2010 16:33:10 UTC +00:00,
+ :email => "info@hayesdubuque.com",
+ :background_info => nil
+ },
+ [1] #<Account:0x103321ff0> {
+ :id => 2,
+ :user_id => 4,
+ :assigned_to => 4,
+ :name => "Ziemann-Streich",
+ :access => "Public",
+ :website => "http://www.ziemannstreich.com",
+ :toll_free_phone => "1-800-871-0619",
+ :phone => "(042)056-1534",
+ :fax => "(106)017-8792",
+ :deleted_at => nil,
+ :created_at => Tue, 09 Feb 2010 13:32:10 UTC +00:00,
+ :updated_at => Tue, 09 Feb 2010 20:05:01 UTC +00:00,
+ :email => "info@ziemannstreich.com",
+ :background_info => nil
+ }
+ ]
+ rails> ap Account
+ class Account < ActiveRecord::Base {
+ :id => :integer,
+ :user_id => :integer,
+ :assigned_to => :integer,
+ :name => :string,
+ :access => :string,
+ :website => :string,
+ :toll_free_phone => :string,
+ :phone => :string,
+ :fax => :string,
+ :deleted_at => :datetime,
+ :created_at => :datetime,
+ :updated_at => :datetime,
+ :email => :string,
+ :background_info => :string
+ }
+ rails>
+
+### Note on Patches/Pull Requests ###
+ * Fork the project on Github.
+ * Make your feature addition or bug fix.
+ * Add specs for it, making sure $ rake spec is all green.
+ * Commit, do not mess with rakefile, version, or history.
+ * Send me a pull request.
+
+### License ###
+ Copyright (c) 2010 Michael Dvorkin
+ %w(mike dvorkin.net) * "@" || %w(mike fatfreecrm.com) * "@"
+
+ Released under the MIT license. See LICENSE file for details.
View
@@ -1,17 +0,0 @@
-= ap
-
-Description goes here.
-
-== Note on Patches/Pull Requests
-
-* Fork the project.
-* Make your feature addition or bug fix.
-* Add tests for it. This is important so I don't break it in a
- future version unintentionally.
-* Commit, do not mess with rakefile, version, or history.
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
-* Send me a pull request. Bonus points for topic branches.
-
-== Copyright
-
-Copyright (c) 2010 Mike Dvorkin. See LICENSE for details.
View
@@ -4,13 +4,16 @@ require 'rake'
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
- gem.name = "ap"
- gem.summary = %Q{TODO: one-line summary of your gem}
- gem.description = %Q{TODO: longer description of your gem}
+ gem.name = "awesome_print"
+ gem.rubyforge_project = "awesome_print"
+ gem.summary = %Q{Pretty print Ruby objects with proper indentation and colors.}
+ gem.description = %Q{Great Ruby dubugging companion: pretty print Ruby objects to visualize their structure. Supports Rails ActiveRecord objects via included mixin.}
gem.email = "mike@dvorkin.net"
- gem.homepage = "http://github.com/michaeldv/ap"
- gem.authors = ["Mike Dvorkin"]
+ gem.homepage = "http://github.com/michaeldv/awesome_print"
+ gem.authors = ["Michael Dvorkin"]
gem.add_development_dependency "rspec", ">= 1.2.9"
+ gem.files = FileList["[A-Z]*", "lib/**/*.rb", "rails/*.rb", "spec/*", "init.rb"]
+ gem.has_rdoc = false
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
Jeweler::GemcutterTasks.new
@@ -38,8 +41,8 @@ require 'rake/rdoctask'
Rake::RDocTask.new do |rdoc|
version = File.exist?('VERSION') ? File.read('VERSION') : ""
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = "ap #{version}"
- rdoc.rdoc_files.include('README*')
- rdoc.rdoc_files.include('lib/**/*.rb')
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = "ap #{version}"
+ rdoc.rdoc_files.include('README*')
+ rdoc.rdoc_files.include('lib/**/*.rb')
end
View
@@ -1 +1 @@
-0.0.0
+0.1.0
View
@@ -0,0 +1,63 @@
+# Generated by jeweler
+# DO NOT EDIT THIS FILE DIRECTLY
+# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
+# -*- encoding: utf-8 -*-
+
+Gem::Specification.new do |s|
+ s.name = %q{awesome_print}
+ s.version = "0.1.0"
+
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
+ s.authors = ["Michael Dvorkin"]
+ s.date = %q{2010-04-02}
+ s.description = %q{Great Ruby dubugging companion: pretty print Ruby objects to visualize their structure. Supports Rails ActiveRecord objects via included mixin.}
+ s.email = %q{mike@dvorkin.net}
+ s.extra_rdoc_files = [
+ "LICENSE",
+ "README.md"
+ ]
+ s.files = [
+ "LICENSE",
+ "README.md",
+ "Rakefile",
+ "VERSION",
+ "init.rb",
+ "lib/ap.rb",
+ "lib/ap/awesome_print.rb",
+ "lib/ap/core_ext/kernel.rb",
+ "lib/ap/core_ext/string.rb",
+ "lib/ap/mixin/rails.rb",
+ "rails/init.rb",
+ "spec/awesome_print_spec.rb",
+ "spec/rails_spec.rb",
+ "spec/spec.opts",
+ "spec/spec_helper.rb",
+ "spec/string_spec.rb"
+ ]
+ s.homepage = %q{http://github.com/michaeldv/awesome_print}
+ s.rdoc_options = ["--charset=UTF-8"]
+ s.require_paths = ["lib"]
+ s.rubyforge_project = %q{awesome_print}
+ s.rubygems_version = %q{1.3.6}
+ s.summary = %q{Pretty print Ruby objects with proper indentation and colors.}
+ s.test_files = [
+ "spec/awesome_print_spec.rb",
+ "spec/rails_spec.rb",
+ "spec/spec_helper.rb",
+ "spec/string_spec.rb"
+ ]
+
+ if s.respond_to? :specification_version then
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
+ s.specification_version = 3
+
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
+ s.add_development_dependency(%q<rspec>, [">= 1.2.9"])
+ else
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
+ end
+ else
+ s.add_dependency(%q<rspec>, [">= 1.2.9"])
+ end
+end
+
View
@@ -0,0 +1 @@
+require File.join(File.dirname(__FILE__), "lib", "ap")
View
10 lib/ap.rb 100644 → 100755
@@ -0,0 +1,10 @@
+# Copyright (c) 2010 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
+#------------------------------------------------------------------------------
+require File.dirname(__FILE__) + "/ap/core_ext/string"
+require File.dirname(__FILE__) + "/ap/core_ext/kernel"
+require File.dirname(__FILE__) + "/ap/awesome_print"
+
+require File.dirname(__FILE__) + "/ap/mixin/rails" if defined?(::Rails)
Oops, something went wrong.

0 comments on commit 4ac2bfd

Please sign in to comment.