Sha256: adb69d12c6db8babd50a1b4248c4229db1f0210dd58c4bad1608d6a2f056d177
Contents?: true
Size: 1.31 KB
Versions: 2
Compression:
Stored size: 1.31 KB
Contents
require 'pry' class Pry class REPL # To make the console more useful, we make it so we flush the event registry # after each line. This makes it so events are triggered after each line. # To accomplish this we monkey-patch pry. def repl loop do case val = read when :control_c output.puts '' pry.reset_eval_string when :no_more_input output.puts '' if output.tty? break else output.puts '' if val.nil? && output.tty? return pry.exit_value unless pry.eval(val) end # Flush after each line Volt::Computation.flush! Volt::Timers.flush_next_tick_timers! end end end end module Volt class Console module Helpers def store $page.store end def page $page.page end end def self.start require 'pry' $LOAD_PATH << 'lib' ENV['SERVER'] = 'true' require 'volt' require 'volt/boot' require 'volt/volt/core' require 'volt/server/socket_connection_handler_stub' SocketConnectionHandlerStub.dispatcher = Dispatcher.new Volt.boot(Dir.pwd) Pry.config.prompt_name = 'volt' Pry.main.send(:include, Volt::Console::Helpers) # $page.pry Pry.start end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
volt-0.9.3.pre1 | lib/volt/cli/console.rb |
volt-0.9.2 | lib/volt/cli/console.rb |