Sha256: cbbdc1f52a60e8621b6ed96cf14a3f0a7d06300ea5d311526f8f5b4277d8c77c

Contents?: true

Size: 910 Bytes

Versions: 15

Compression:

Stored size: 910 Bytes

Contents

require 'pry'

class Pry
  # 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 rep(target = TOPLEVEL_BINDING)
    target = Pry.binding_for(target)
    result = re(target)

    Pry.critical_section do
      show_result(result)
    end

    # Automatically flush after each line
    Volt::Computation.flush!
  end
end

module Volt
  class Console
    def self.start
      require 'pry'

      $LOAD_PATH << 'lib'
      ENV['SERVER'] = 'true'

      require 'volt'
      require 'volt/boot'
      require 'volt/server/socket_connection_handler_stub'

      SocketConnectionHandlerStub.dispatcher = Dispatcher.new

      Volt.boot(Dir.pwd)

      Pry.config.prompt_name = 'volt'

      # start a REPL session
      # Pry.start

      $page.pry
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
volt-0.8.27.beta2 lib/volt/cli/console.rb
volt-0.8.27.beta1 lib/volt/cli/console.rb
volt-0.8.26.beta1 lib/volt/cli/console.rb
volt-0.8.26 lib/volt/cli/console.rb
volt-0.8.24 lib/volt/cli/console.rb
volt-0.8.23 lib/volt/cli/console.rb
volt-0.8.22 lib/volt/cli/console.rb
volt-0.8.22.beta2 lib/volt/cli/console.rb
volt-0.8.22.beta1 lib/volt/cli/console.rb
volt-0.8.21 lib/volt/cli/console.rb
volt-0.8.20 lib/volt/cli/console.rb
volt-0.8.19 lib/volt/cli/console.rb
volt-0.8.18 lib/volt/cli/console.rb
volt-0.8.17 lib/volt/console.rb
volt-0.8.16 lib/volt/console.rb