Skip to content

Instantly share code, notes, and snippets.

@kalabiyau
Created January 17, 2011 11:20
Show Gist options
  • Save kalabiyau/782736 to your computer and use it in GitHub Desktop.
Save kalabiyau/782736 to your computer and use it in GitHub Desktop.
require 'rubygems' rescue nil
require 'wirble'
require 'hirb'
require 'ap'
Dir[Rails.root.join"spec/support/factories/*"].each {|x| require x}
#load wirble
Wirble.init
Wirble.colorize
# load hirb
#Hirb::View.enable
IRB.conf[:AUTO_INDENT] = true
if ENV.include?('RAILS_ENV')
if !Object.const_defined?('RAILS_DEFAULT_LOGGER')
require 'logger'
Object.const_set('RAILS_DEFAULT_LOGGER', Logger.new(STDOUT))
end
def sql(query)
ActiveRecord::Base.connection.select_all(query)
end
..
if ENV['RAILS_ENV'] == 'test'
require 'test/test_helper'
end
# for rails 3
elsif defined?(Rails) && !Rails.env.nil?
if Rails.logger
Rails.logger =Logger.new(STDOUT)
ActiveRecord::Base.logger = Rails.logger
end
if Rails.env == 'test'
require 'test/test_helper'
end
else
# nothing to do
end
# annotate column names of an AR model
def show(obj)
y(obj.send("column_names"))
end
puts "> all systems are go wirble/hirb/ap/show <"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment