lib/nydp.rb in nydp-0.0.4 vs lib/nydp.rb in nydp-0.0.5

- old
+ new

@@ -6,30 +6,35 @@ def self.setup ns; PLUGINS.each { |plg| plg.setup ns } ; end def self.loadfiles; PLUGINS.map(&:loadfiles).flatten ; end def self.testfiles; PLUGINS.map(&:testfiles).flatten ; end def self.plugin_names ; PLUGINS.map(&:name) ; end def self.loadall vm, ns, files - files.each { |f| StreamRunner.new(vm, ns, File.new(f)).run } + files.each { |f| + reader = Nydp::StreamReader.new(File.new(f)) + Nydp::Runner.new(vm, ns, reader).run + } end def self.repl puts "welcome to nydp" ns = { } setup(ns) vm = VM.new loadall vm, ns, loadfiles - Repl.new(vm, ns, $stdin).run + reader = Nydp::ReadlineReader.new $stdin, "nydp > " + Nydp::Runner.new(vm, ns, reader, $stdout).run end def self.tests *options verbose = options.include?(:verbose) ? "t" : "nil" puts "welcome to nydp : running tests" ns = { } setup(ns) vm = VM.new loadall vm, ns, loadfiles loadall vm, ns, testfiles - StreamRunner.new(vm, ns, "(run-all-tests #{verbose})").run + reader = Nydp::StringReader.new "(run-all-tests #{verbose})" + Nydp::Runner.new(vm, ns, reader).run end end require "nydp/core"