Sha256: aa2ffcff11274c89733e3ca18c8ff393c94799158cbd2737a575cccdd992396a
Contents?: true
Size: 1010 Bytes
Versions: 6
Compression:
Stored size: 1010 Bytes
Contents
#!/usr/bin/env ruby $:.unshift File.dirname(__FILE__) + "/../lib" require 'rubygems' require 'acts_as_icontact' require 'readline' require 'acts_as_icontact/command_line/completion' require 'acts_as_icontact/command_line/variables' 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 'quit' or 'exit' to quit)\n" loop do case input = Readline.readline("\n>> ", true) when /^(exit|quit)$/ break when /^[a-z][\w\d_]*\s*=/ # Keep local variable assignments from becoming black holes input = "self." + input end 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!
Version data entries
6 entries across 6 versions & 2 rubygems