Sha256: d8982ce9c15967ae2b08c87129c614f5477983cb848dec9cc8d84b92cece0adb

Contents?: true

Size: 1.18 KB

Versions: 29

Compression:

Stored size: 1.18 KB

Contents

require 'pry' unless defined? Pry
require 'pry-remote'

module PryRemote
  class Server
    # Override the call to Pry.start to save off current Server, pass a
    # pry_remote flag so pry-nav knows this is a remote session, and not kill
    # the server right away
    def run
      if PryNav.current_remote_server
        raise 'Already running a pry-remote session!'
      else
        PryNav.current_remote_server = self
      end

      setup
      Pry.start @object, {
        :input  => client.input_proxy,
        :output => client.output,
        :pry_remote => true
      }
    end

    # Override to reset our saved global current server session.
    alias_method :teardown_without_pry_nav, :teardown
    def teardown_with_pry_nav
      teardown_without_pry_nav
      PryNav.current_remote_server = nil
    end
    alias_method :teardown, :teardown_with_pry_nav
  end
end

# Ensure cleanup when a program finishes without another break. For example,
# 'next' on the last line of a program never hits the tracer proc, and thus
# PryNav::Tracer#run doesn't have a chance to cleanup.
at_exit do
  set_trace_func nil
  if PryNav.current_remote_server
    PryNav.current_remote_server.teardown
  end
end

Version data entries

29 entries across 29 versions & 2 rubygems

Version Path
logstash-output-scalyr-0.2.1.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.2.0 vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.2.0.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.1.26.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.1.25.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.1.24.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.1.23.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.1.22.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.1.21.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.1.20.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.1.19.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.1.18.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.1.17.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.1.16.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.1.15.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.1.14.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.1.13 vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.1.12 vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.1.11.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb
logstash-output-scalyr-0.1.10.beta vendor/bundle/jruby/2.5.0/gems/pry-nav-0.3.0/lib/pry-nav/pry_remote_ext.rb