Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mini script/console
['readline', 'rubygems', 'bond', File.dirname(__FILE__) + '/../config/boot'].each {|e| require e }
Bond.start
["#{RAILS_ROOT}/config/environment", 'console_app', 'console_with_helpers'].each {|e| require e}
history_file = File.join(ENV["HOME"], '.myrb_history')
IO.readlines(history_file).each {|e| Readline::HISTORY << e.chomp } if File.exists?(history_file)
while (input = Readline.readline('>> ', true)) != 'exit'
begin puts "=> #{eval(input).inspect}"; rescue Exception; puts "Error: #{$!}" end
end
File.open(history_file, 'w') {|f| f.write Readline::HISTORY.to_a.join("\n") }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment