Sha256: 70af0cd982433246afbf13d6d349c1d8a2225d0a37cd1c833e4b45f995f1b0fd
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 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 @volt_app.page.store end def page @volt_app.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' # Boot the volt app volt_app = Volt.boot(Dir.pwd) SocketConnectionHandlerStub.dispatcher = Dispatcher.new(volt_app) Pry.config.prompt_name = 'volt' Pry.main.instance_variable_set('@volt_app', volt_app) Pry.main.send(:include, Volt::Console::Helpers) Pry.start end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
volt-0.9.3.pre2 | lib/volt/cli/console.rb |