PryRemoteEm enables you to
start instances of Pry in a running
EventMachine program and connect to
those Pry instances over a network or the Internet. Once connected you
can interact with the internal state of the program.
It adds user authentication and SSL support along with tab-completion
and paging. It's compatble with MRI 1.9, or any other VM with support
for Fibers and EventMachine.
$pry-remote-em[pry-remote-em]clientconnectedtopryem://127.0.0.1:6462/[pry-remote-em]remoteisPryRemoteEm0.4.0pryem[1]pry(#<Foo>)> stat MethodInformation:--Name:initializeOwner:FooVisibility:privateType:BoundArity:2MethodSignature:initialize(x,y)SourceLocation:(irb):5[2]pry(#<Foo>)> self=>#<Foo:0x007fef1b22ac10>[3]pry(#<Foo>)> lslocals:__dir__ex__file__in__out__pry_xy[4]pry(#<Foo>)> x=>10[5]pry(#<Foo>)> x = 12=>12[6]pry(#<Foo>)> exit[pry-remote-em]sessionterminated$pry-remote-em[pry-remote-em]clientconnectedtopryem://127.0.0.1:6462/[pry-remote-em]remoteisPryRemoteEm0.4.0pryem[1]pry(#<Foo>)> x=>12[2]pry(#<Foo>)> exit[pry-remote-em]sessionterminated
Features
Multiple Servers
It's easy to run more than one PryRemoteEm service on a single machine,
or even in the same process. When you start the service via
#remotepryem, just specify :auto as the port to use. The service
will automatically take the next free port from 6462.
$ ruby test/auto-demo.rb
[pry-remote-em] listening for connections on pryem://localhost:6462/
[pry-remote-em] listening for connections on pryem://localhost:6463/
[pry-remote-em] listening for connections on pryem://localhost:6464/
[pry-remote-em] listening for connections on pryem://localhost:6465/
[pry-remote-em] listening for connections on pryem://localhost:6466/
123456789101112131415161718192021222324
$ pry-remote-em
[pry-remote-em] client connected to pryem://127.0.0.1:6462/
[pry-remote-em] remote is PryRemoteEm 0.4.0 pryem
[1] pry("pretty_print")>
$ pry-remote-em pryem://127.0.0.1:6463/
[pry-remote-em] client connected to pryem://127.0.0.1:6463/
[pry-remote-em] remote is PryRemoteEm 0.4.0 pryem
[1] pry("pack")>
$ pry-remote-em pryem://127.0.0.1:6464/
[pry-remote-em] client connected to pryem://127.0.0.1:6464/
[pry-remote-em] remote is PryRemoteEm 0.4.0 pryem
[1] pry("to_json")>
$ pry-remote-em pryem://127.0.0.1:6465/
[pry-remote-em] client connected to pryem://127.0.0.1:6465/
[pry-remote-em] remote is PryRemoteEm 0.4.0 pryem
[1] pry("to_json")>
$ pry-remote-em pryem://127.0.0.1:6466/
[pry-remote-em] client connected to pryem://127.0.0.1:6466/
[pry-remote-em] remote is PryRemoteEm 0.4.0 pryem
[1] pry(#<RubyVM::InstructionSequence>)>
TLS Encryption
When creating a server pass the :tls => true option to enable TLS.
1
obj.remote_pry_em('localhost',:auto,:tls=>true)
If you pass a Hash it will be used to configure the internal TLS handler.
When the command line client connects to a TLS enabled server it will
automatically use TLS mode even if the user didn't request it.
123456
$ pry-remote-em pryem://localhost:6462/
[pry-remote-em] client connected to pryem://127.0.0.1:6462/
[pry-remote-em] remote is PryRemoteEm 0.4.0 pryems
[pry-remote-em] negotiating TLS
[pry-remote-em] TLS connection established
[1] pry(#<Hash>)>
To always require a TLS connection give pry-remote-em a pryems URL. If
the server doesn't support TLS the connection will be terminated.
123456
$ pry-remote-em pryems://localhost:6468/
[pry-remote-em] client connected to pryem://127.0.0.1:6468/
[pry-remote-em] remote is PryRemoteEm 0.4.0 pryem
[pry-remote-em] connection failed
[pry-remote-em] server doesn't support required scheme "pryems"[pry-remote-em] session terminated
User Authentication
Server
If the service is started with the :auth option it will require all
clients to authenticate on connect. The :auth option can be a Hash, proc
or any object that responds to #call.
The included command line client pry-remote-em can take a username
and/or password as part of the url argument. If either a username or
password is not supplied, but required, by the server, it will prompt for
them.
12345678
$ pry-remote-em pryems://localhost:6464/
[pry-remote-em] client connected to pryem://127.0.0.1:6464/
[pry-remote-em] remote is PryRemoteEm 0.4.0 pryems
[pry-remote-em] negotiating TLS
[pry-remote-em] TLS connection established
user: caleb
caleb's password: *****
[1] pry(#<Hash>)>
1234567
$ pry-remote-em pryems://caleb@localhost:6464
[pry-remote-em] client connected to pryem://127.0.0.1:6464/
[pry-remote-em] remote is PryRemoteEm 0.4.0 pryems
[pry-remote-em] negotiating TLS
[pry-remote-em] TLS connection established
caleb's password: *****
[1] pry(#<Hash>)>
123456
$ pry-remote-em pryems://caleb:crane@localhost:6464
[pry-remote-em] client connected to pryem://127.0.0.1:6464/
[pry-remote-em] remote is PryRemoteEm 0.4.0 pryems
[pry-remote-em] negotiating TLS
[pry-remote-em] TLS connection established
[1] pry(#<Hash>)>
Tab Completion
Tab completion candidates will be retrieved from the server and
presented on the client side.
Vi mode editing - RbReadline doesn't support vi edit mode. I'm looking into contributing it. PryRemoteEm uses rb-readline because the STLIB version doesn't play nice with Fibers.
Ssh key based authentication
Issues
Please post any bug reports or feature requests on Github
Copyright
Copyright (c) 2012 Caleb Crane
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.