5

I've been really enjoying developing Ruby applications with Pry. I've also seen a Pry plugin called pry-remote which lets you set up a Drb server for remote access to a Pry session. The pry-remote synopsis in the README makes sense and I have no problem running locally. But how can I use this to, for example, allow a colleague to access the same Pry session in his/her terminal?

If possible, the API I desire would be something like localtunnel:

On computer1:

$ ruby main.rb
[pry-remote] Waiting for client on druby://127.0.0.1:9876

$ drblocaltunnel 9876
share this url: 
http://xyz.drblocaltunnel.com

On computer2:

$ drblocaltunnel login -url http://xyz.drblocaltunnel.com

Frame number: 0/4

From: /programming/drb/main.rb @ line 5 Foo#initialize:

    4: def initialize(x, y)
 => 5:   binding.remote_pry
    6: end
user94154
  • 16,176
  • 20
  • 77
  • 116

2 Answers2

1

You can just use

binding.remote_pry(host_string, port_number)

In your code to bind on host different from localhost. And use pry-remote -s host -p port to connect to this host from another computer. But pry-remote opens only one listening socket, so your colleague can only has access if you are not connected yet.

Vessimir
  • 139
  • 5
0

As the previous answer indicated, you can specify a host and a port. If you want a remote computer, you have to bind it to its external IP address.

To access the server, you need to:

pry-remote -s (ip) -c

....which is only going to be viewable from pry-remote --help for some bizarre reason. The readme really should be updated on that one.

One thing I'm trying to figure out is how to get edit to launch an editor on the client machine rather than the server, but no luck so far.

baweaver
  • 304
  • 1
  • 12