pry-remote-reloaded 2.0.0 → 3.0.0

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/lib/pry-remote-reloaded.rb +20 -31
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47fa701330dfe9b2c3e6745b87c0430bac660b92902be714ab46954f291e2ecf
4
- data.tar.gz: 606e6c99c628770bf0c21990ccf7ca5a76afa4b6a32cc7b843363598af81e7ed
3
+ metadata.gz: 38f0e97fed566e5ed687b4795bfcdfc283bdb0b735edea3f2b1d3169e2838244
4
+ data.tar.gz: 3f235f316d76c8909f1ddfadae37466e03d5b24afe1144ee9474b2215a3a917f
5
5
  SHA512:
6
- metadata.gz: 030a3a24700260d03f35a6a32096d122b3e699b408b21979a4cd7632ce86c159aa9698e02d4b8c4de9d946081835be61ab29f9bbe4a3033143943ef58a598ab6
7
- data.tar.gz: 1df4cc61e9cd28392ce74989d201a6ae94c123cc910e59946a7363d67d9921cca21d350ee2ddb952a203eab584cf340511c43a64f2a4e202f0453abb3f99c5e2
6
+ metadata.gz: d4c3b3cca08b280632864eef241a58010bd53fd1812cd6649f1b506de820eb81025c619a089b4b97e16f1b61ee7fae4d22590bbd26a43b0cee940178b0dc3157
7
+ data.tar.gz: 5e659b7d3dae7bdc9791dc330f14a4e98696a2947805347d393f3f5ed2481476fb504aa77cd050e515847c19b3f314cf57180417470cd1f04f98b1a2b83a7d9b
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## 3.0.0 (2025-08-20)
2
+
3
+ * Allow configuring server URI instead of host and port (#4)
4
+ * The CLI still allows to configure server/port, but allows to pass the
5
+ URI which takes precedence
6
+ * This is a breaking change for `Object#remote_pry` as its signature is
7
+ changed to keyword arguments (`uri:, **options`)
8
+ * The `PryRemoteReloaded::Server.new` and `PryRemoteReloaded::Server.run`
9
+ signatures also changed to keyword arguments,
10
+ but thats only for internal use
11
+
1
12
  ## 2.0.0 (205-08-19)
2
13
 
3
14
  * Upgraded to slop 4.x (#3)
@@ -7,6 +7,8 @@ require 'open3'
7
7
  module PryRemoteReloaded
8
8
  DefaultHost = ENV['PRY_REMOTE_DEFAULT_HOST'] || "127.0.0.1"
9
9
  DefaultPort = ENV['PRY_REMOTE_DEFAULT_PORT'] || 9876
10
+ DefaultURI = ENV.fetch('PRY_REMOTE_DEFAULT_URI',
11
+ "druby://#{DefaultHost}:#{DefaultPort}")
10
12
 
11
13
  # A class to represent an input object created from DRb. This is used because
12
14
  # Pry checks for arity to know if a prompt should be passed to the object.
@@ -140,13 +142,12 @@ module PryRemoteReloaded
140
142
  end
141
143
 
142
144
  class Server
143
- def self.run(object, host = DefaultHost, port = DefaultPort, options = {})
144
- new(object, host, port, options).run
145
+ def self.run(object, uri: DefaultURI, **options)
146
+ new(object, uri:, **options).run
145
147
  end
146
148
 
147
- def initialize(object, host = DefaultHost, port = DefaultPort, options = {})
148
- @host = host
149
- @port = port
149
+ def initialize(object, uri: DefaultURI, **options)
150
+ @uri = uri
150
151
 
151
152
  @object = object
152
153
  @options = options
@@ -154,7 +155,7 @@ module PryRemoteReloaded
154
155
  @client = PryRemoteReloaded::Client.new
155
156
  DRb.start_service uri, @client
156
157
  rescue Errno::EADDRINUSE => e
157
- puts "[pry-remote] Port already in use: #{e.message}"
158
+ puts "[pry-remote] Address already in use: #{e.message}"
158
159
  end
159
160
 
160
161
  # Code that has to be called for Pry-remote to work properly
@@ -249,16 +250,8 @@ module PryRemoteReloaded
249
250
  # @return [PryServer::Client] Client connecting to the pry-remote server
250
251
  attr_reader :client
251
252
 
252
- # @return [String] Host of the server
253
- attr_reader :host
254
-
255
- # @return [Integer] Port of the server
256
- attr_reader :port
257
-
258
253
  # @return [String] URI for DRb
259
- def uri
260
- "druby://#{host}:#{port}"
261
- end
254
+ attr_reader :uri
262
255
  end
263
256
 
264
257
  # Parses arguments and allows to start the client.
@@ -272,6 +265,8 @@ module PryRemoteReloaded
272
265
  default: DefaultHost
273
266
  conf.int '-p', '--port', "Port of the server (#{DefaultPort})",
274
267
  default: DefaultPort
268
+ conf.string '-u', '--uri', 'URI of the server, instead of ' \
269
+ "server/port (#{DefaultURI})"
275
270
 
276
271
  conf.bool '-w', '--wait', 'Wait for the pry server to come up',
277
272
  default: false
@@ -291,8 +286,11 @@ module PryRemoteReloaded
291
286
  end
292
287
  end
293
288
 
294
- @host = opts[:server]
295
- @port = opts[:port]
289
+ if opts[:uri]
290
+ @uri = opts[:uri]
291
+ else
292
+ @uri = "druby://#{opts[:server]}:#{opts[:port]}"
293
+ end
296
294
 
297
295
  @wait = opts[:wait]
298
296
  @persist = opts[:persist]
@@ -304,16 +302,8 @@ module PryRemoteReloaded
304
302
  exit 1
305
303
  end
306
304
 
307
- # @return [String] Host of the server
308
- attr_reader :host
309
-
310
- # @return [Integer] Port of the server
311
- attr_reader :port
312
-
313
305
  # @return [String] URI for DRb
314
- def uri
315
- "druby://#{host}:#{port}"
316
- end
306
+ attr_reader :uri
317
307
 
318
308
  attr_reader :wait
319
309
  attr_reader :persist
@@ -387,11 +377,10 @@ end
387
377
  class Object
388
378
  # Starts a remote Pry session
389
379
  #
390
- # @param [String] host Host of the server
391
- # @param [Integer] port Port of the server
392
- # @param [Hash] options Options to be passed to Pry.start
393
- def remote_pry(host = PryRemoteReloaded::DefaultHost, port = PryRemoteReloaded::DefaultPort, options = {})
394
- PryRemoteReloaded::Server.new(self, host, port, options).run
380
+ # @param uri [String] URI for DRb server
381
+ # @param options [Hash{Symbol => Mixed}] options to be passed to Pry.start
382
+ def remote_pry(uri: PryRemoteReloaded::DefaultURI, **options)
383
+ PryRemoteReloaded::Server.new(self, uri:, **options).run
395
384
  end
396
385
 
397
386
  # a handy alias as many people may think the method is named after the gem
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pry-remote-reloaded
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mon ouie
@@ -73,7 +73,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - ">="
75
75
  - !ruby/object:Gem::Version
76
- version: '0'
76
+ version: '3.1'
77
77
  required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  requirements:
79
79
  - - ">="