require 'patchmaster' require 'irb' require 'tempfile' $dsl = nil # For bin/patchmaster. Does nothing def run end def dsl unless $dsl $dsl = PM::DSL.new $dsl.song("IRB Song") $dsl.patch("IRB Patch") end $dsl end def patch dsl.instance_variable_get(:@patch) end def clear patch.stop patch.connections = [] patch.start end def pm_help puts <"PatchMaster:%03n:%i> ", :PROMPT_N=>"PatchMaster:%03n:%i> ", :PROMPT_S=>"PatchMaster:%03n:%i%l ", :PROMPT_C=>"PatchMaster:%03n:%i* ", :RETURN=>"=> %s\n" } IRB.conf[:PROMPT_MODE] = :CUSTOM puts 'PatchMaster loaded' puts 'Type "pm_help" for help' EOS f.close ENV['IRBRC'] = f.path IRB.start f.unlink end