Sha256: 67e94b4a04aad16bfa343e38776230d1281af29e028931bc8dbdc731ab7289e1
Contents?: true
Size: 1.81 KB
Versions: 15
Compression:
Stored size: 1.81 KB
Contents
#! /usr/bin/env ruby Main { argument('root'){ optional } def run help! end mode(:console){ def run if params['root'].given? Ro.root = params['root'].value else if ENV['RO_ROOT'] Ro.root = ENV['RO_ROOT'] else Ro.root = './ro' end end basename = File.basename(Ro.root) ARGV.clear require 'irb' Kernel.module_eval do def reload! Object.send(:remove_const, :Ro) load "#{ $libdir }/ro.rb" "#{ $libdir }/ro.rb" end end $HACK = IRB.method(:load_modules) def IRB.load_modules $HACK.call() basename = File.basename(Ro.root) IRB.conf[:PROMPT][:RO] = { :PROMPT_I=>"Ro(./#{ basename }):%03n:%i> ", :PROMPT_N=>"Ro(./#{ basename }):%03n:%i> ", :PROMPT_S=>"Ro(./#{ basename }):%03n:%i%l ", :PROMPT_C=>"Ro(./#{ basename }):%03n:%i* ", :RETURN=>"=> %s\n" } IRB.conf[:PROMPT_MODE] = :RO IRB.conf[:AUTO_INDENT] = true end ::IRB.start end =begin module Console def reload! Object.send(:remove_const, :Ro) load "#{ $libdir }/ro.rb" "#{ $libdir }/ro.rb" end end =end class Console < Ro::BlankSlate def initialize(nodes) @nodes = nodes end def binding Kernel.binding end def reload! Object.send(:remove_const, :Ro) load "#{ $libdir }/ro.rb" "#{ $libdir }/ro.rb" end def method_missing(method, *args, &block) @nodes.send(method, *args, &block) end end } } BEGIN { require 'main' $bindir = File.dirname(__FILE__) $libdir = File.expand_path("#{ $bindir }/../lib/") require "#{ $libdir }/ro.rb" }
Version data entries
15 entries across 15 versions & 1 rubygems