pry-remote 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/lib/pry-remote.rb +51 -15
- metadata +11 -17
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 169f55f956d914a4ca611f12b2b41c221166c1da
|
4
|
+
data.tar.gz: a0dfdb736a3c3772e1d9542fb96f3a2fd57446ef
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b58db7ae0a89f8b6c4b6ce1e2e341d18bf679d3b703f6948a7e200b3efa6d5bd71fc523b47a16f3669e3665d355b8378eb1267339740ce499bcf0d4a2bf3e7cd
|
7
|
+
data.tar.gz: f970dbe41d24079a2910cb03bba7b61d898065bf625f8cd446dc1dc424d701596ffbb0bb6d0e1e04dbe2bfc8a7c8f9bf86f3268ca9fc051ffd8462743a93f904
|
data/lib/pry-remote.rb
CHANGED
@@ -54,7 +54,9 @@ module PryRemote
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def readline(prompt)
|
57
|
-
if
|
57
|
+
if Readline == @obj
|
58
|
+
@obj.readline(prompt, true)
|
59
|
+
elsif @obj.method(:readline).arity == 1
|
58
60
|
@obj.readline(prompt)
|
59
61
|
else
|
60
62
|
$stdout.print prompt
|
@@ -70,6 +72,10 @@ module PryRemote
|
|
70
72
|
@obj.print(*objs)
|
71
73
|
end
|
72
74
|
|
75
|
+
def printf(*args)
|
76
|
+
@obj.printf(*args)
|
77
|
+
end
|
78
|
+
|
73
79
|
def write(data)
|
74
80
|
@obj.write data
|
75
81
|
end
|
@@ -128,18 +134,21 @@ module PryRemote
|
|
128
134
|
end
|
129
135
|
|
130
136
|
class Server
|
131
|
-
def self.run(object, host = DefaultHost, port = DefaultPort)
|
132
|
-
new(object, host, port).run
|
137
|
+
def self.run(object, host = DefaultHost, port = DefaultPort, options = {})
|
138
|
+
new(object, host, port, options).run
|
133
139
|
end
|
134
140
|
|
135
|
-
def initialize(object, host = DefaultHost, port = DefaultPort)
|
136
|
-
@
|
137
|
-
@
|
141
|
+
def initialize(object, host = DefaultHost, port = DefaultPort, options = {})
|
142
|
+
@host = host
|
143
|
+
@port = port
|
144
|
+
|
145
|
+
@object = object
|
146
|
+
@options = options
|
138
147
|
|
139
148
|
@client = PryRemote::Client.new
|
140
|
-
DRb.start_service
|
149
|
+
DRb.start_service uri, @client
|
141
150
|
|
142
|
-
puts "[pry-remote] Waiting for client on
|
151
|
+
puts "[pry-remote] Waiting for client on #{uri}"
|
143
152
|
@client.wait
|
144
153
|
|
145
154
|
puts "[pry-remote] Client received, starting remote session"
|
@@ -196,7 +205,8 @@ module PryRemote
|
|
196
205
|
# Actually runs pry-remote
|
197
206
|
def run
|
198
207
|
setup
|
199
|
-
|
208
|
+
|
209
|
+
Pry.start(@object, @options.merge(:input => client.input_proxy, :output => client.output))
|
200
210
|
ensure
|
201
211
|
teardown
|
202
212
|
end
|
@@ -206,6 +216,17 @@ module PryRemote
|
|
206
216
|
|
207
217
|
# @return [PryServer::Client] Client connecting to the pry-remote server
|
208
218
|
attr_reader :client
|
219
|
+
|
220
|
+
# @return [String] Host of the server
|
221
|
+
attr_reader :host
|
222
|
+
|
223
|
+
# @return [Integer] Port of the server
|
224
|
+
attr_reader :port
|
225
|
+
|
226
|
+
# @return [String] URI for DRb
|
227
|
+
def uri
|
228
|
+
"druby://#{host}:#{port}"
|
229
|
+
end
|
209
230
|
end
|
210
231
|
|
211
232
|
# Parses arguments and allows to start the client.
|
@@ -218,6 +239,8 @@ module PryRemote
|
|
218
239
|
:default => DefaultHost
|
219
240
|
on :p, :port=, "Port of the server (#{DefaultPort})", :argument => :optional,
|
220
241
|
:as => Integer, :default => DefaultPort
|
242
|
+
on :w, :wait, "Wait for the pry server to come up",
|
243
|
+
:default => false
|
221
244
|
on :c, :capture, "Captures $stdout and $stderr from the server (true)",
|
222
245
|
:default => true
|
223
246
|
on :f, "Disables loading of .pryrc and its plugins, requires, and command history "
|
@@ -228,6 +251,7 @@ module PryRemote
|
|
228
251
|
@host = params[:server]
|
229
252
|
@port = params[:port]
|
230
253
|
|
254
|
+
@wait = params[:wait]
|
231
255
|
@capture = params[:capture]
|
232
256
|
|
233
257
|
Pry.initial_session_setup unless params[:f]
|
@@ -244,7 +268,9 @@ module PryRemote
|
|
244
268
|
"druby://#{host}:#{port}"
|
245
269
|
end
|
246
270
|
|
271
|
+
attr_reader :wait
|
247
272
|
attr_reader :capture
|
273
|
+
alias wait? wait
|
248
274
|
alias capture? capture
|
249
275
|
|
250
276
|
# Connects to the server
|
@@ -252,15 +278,24 @@ module PryRemote
|
|
252
278
|
# @param [IO] input Object holding input for pry-remote
|
253
279
|
# @param [IO] output Object pry-debug will send its output to
|
254
280
|
def run(input = Pry.config.input, output = Pry.config.output)
|
255
|
-
|
281
|
+
local_ip = UDPSocket.open {|s| s.connect(@host, 1); s.addr.last}
|
282
|
+
DRb.start_service "druby://#{local_ip}:0"
|
256
283
|
client = DRbObject.new(nil, uri)
|
257
284
|
|
258
285
|
input = IOUndumpedProxy.new(input)
|
259
286
|
output = IOUndumpedProxy.new(output)
|
260
287
|
|
261
|
-
|
262
|
-
|
263
|
-
|
288
|
+
begin
|
289
|
+
client.input = input
|
290
|
+
client.output = output
|
291
|
+
rescue DRb::DRbConnError => ex
|
292
|
+
if wait?
|
293
|
+
sleep 1
|
294
|
+
retry
|
295
|
+
else
|
296
|
+
raise ex
|
297
|
+
end
|
298
|
+
end
|
264
299
|
|
265
300
|
if capture?
|
266
301
|
client.stdout = $stdout
|
@@ -280,8 +315,9 @@ class Object
|
|
280
315
|
#
|
281
316
|
# @param [String] host Host of the server
|
282
317
|
# @param [Integer] port Port of the server
|
283
|
-
|
284
|
-
|
318
|
+
# @param [Hash] options Options to be passed to Pry.start
|
319
|
+
def remote_pry(host = PryRemote::DefaultHost, port = PryRemote::DefaultPort, options = {})
|
320
|
+
PryRemote::Server.new(self, host, port, options).run
|
285
321
|
end
|
286
322
|
|
287
323
|
# a handy alias as many people may think the method is named after the gem
|
metadata
CHANGED
@@ -1,46 +1,41 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-remote
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.8
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Mon ouie
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-01-29 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: slop
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '3.0'
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '3.0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: pry
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0.9'
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0.9'
|
46
41
|
description: Connect to Pry remotely using DRb
|
@@ -56,27 +51,26 @@ files:
|
|
56
51
|
- bin/pry-remote
|
57
52
|
homepage: http://github.com/Mon-Ouie/pry-remote
|
58
53
|
licenses: []
|
54
|
+
metadata: {}
|
59
55
|
post_install_message:
|
60
56
|
rdoc_options: []
|
61
57
|
require_paths:
|
62
58
|
- lib
|
63
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|
64
|
-
none: false
|
65
60
|
requirements:
|
66
|
-
- -
|
61
|
+
- - ">="
|
67
62
|
- !ruby/object:Gem::Version
|
68
63
|
version: '0'
|
69
64
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
65
|
requirements:
|
72
|
-
- -
|
66
|
+
- - ">="
|
73
67
|
- !ruby/object:Gem::Version
|
74
68
|
version: '0'
|
75
69
|
requirements: []
|
76
70
|
rubyforge_project:
|
77
|
-
rubygems_version:
|
71
|
+
rubygems_version: 2.0.14
|
78
72
|
signing_key:
|
79
|
-
specification_version:
|
73
|
+
specification_version: 4
|
80
74
|
summary: Connect to Pry remotely
|
81
75
|
test_files: []
|
82
76
|
has_rdoc:
|