#!/usr/bin/env ruby $:.unshift File.dirname(__FILE__) + "/../lib" require 'acts_as_icontact' require 'rubygems' require 'readline' require 'bond' require 'bond/completion' module ActsAsIcontact # Lifted from: http://tagaholic.me/2009/07/23/mini-irb-and-mini-script-console.html history_file = File.join(ENV["HOME"], '.icontact_history') IO.readlines(history_file).each {|e| Readline::HISTORY << e.chomp } if File.exists?(history_file) print "# ActsAsIcontact command line (type 'exit' to quit)\n" while (input = Readline.readline("\n>> ", 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") } end exit!