nrepl-lazuli 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eabdc5490b15f4402769dbdf5a21d3eb27e206df7a5e1effcbcd8d3d919ea9fa
4
- data.tar.gz: f3d43cf6d6d1065f676147e87a03280d08fbe29bf28f9deeede58a8cfff126fd
3
+ metadata.gz: 8c38f3cd330d07e579fff5971c656a12c4ee9f9a1488aba33d8183dd80b1236c
4
+ data.tar.gz: a63be29edddccc449e4a5bbdd9f80a05e2fb2fa0b3ca0b271ee50830da521118
5
5
  SHA512:
6
- metadata.gz: 49da53ef4958b719b6c46835431bdc8cbc78a5d0624d28b88994b8589ffcfd06c71fb5d44056ee1af4ec73a49a8dcadab3d03c0d3b88d6882f6df5f5a1a8386f
7
- data.tar.gz: fb81f3e46cd3e4ec8a5b2da284b5310d3da694ec552cd3246722b19f9a57fa4404e0998faee52c63db760d9cf009fbbb0b788a0ee30c944eb8d236a322fa9dec
6
+ metadata.gz: 2d75413ea25c513b6107daacd4f4128649c7696fc170f8536d8f636a166ce5fcb9ba675a4c218de9b9ec906f488c7cc9dfbdd48afbce0e828677d08c0bc96283
7
+ data.tar.gz: a3bb98a1bc7d9ba46d9bbc0cd1ea3b30dfa186da9444a80acf03015c427430962d4bf3f14dfc0d695b7050fe8caf632b14c1bac0a92edbe65ee9fd0f04a803c5
@@ -16,10 +16,11 @@ module NREPL
16
16
  @binding = binding
17
17
  @bindings = bindings
18
18
  @bindings_by_id = bindings_by_id
19
+ @retries = 0
19
20
  end
20
21
 
21
22
  def treat_messages!
22
- bencode = BEncode::Parser.new(@in)
23
+ bencode = BEncode.new(@in)
23
24
  loop do
24
25
  break if @in.eof?
25
26
  msg = bencode.parse!
@@ -30,6 +31,8 @@ module NREPL
30
31
  @pending_evals.each { |(i, _)| clear_eval!(i) }
31
32
  rescue Errno::ECONNRESET
32
33
  @pending_evals.each { |(i, _)| clear_eval!(i) }
34
+ rescue => e
35
+ STDOUT.puts "CRASH! #{e}"
33
36
  end
34
37
 
35
38
  def treat_msg(msg)
@@ -296,8 +299,11 @@ module NREPL
296
299
 
297
300
  def send_msg(msg)
298
301
  debug "Sending", msg
299
- @out.write(msg.bencode)
302
+ @out.write_nonblock(BEncode.encode(msg))
300
303
  @out.flush
304
+ rescue IO::EAGAINWaitWritable
305
+ @retries += 1
306
+ @out.close if @retries > 50
301
307
  end
302
308
  end
303
309
  end
@@ -3,8 +3,8 @@
3
3
  # A Ruby port of ogion https://gitlab.com/technomancy/ogion &
4
4
  # https://github.com/borkdude/nrepl-server/blob/master/src/borkdude/nrepl_server.clj
5
5
 
6
- require 'bencode'
7
6
  require 'socket'
7
+ require_relative 'bencode'
8
8
  require_relative 'connection'
9
9
  require_relative 'fake_stdout'
10
10
 
@@ -43,8 +43,18 @@ module NREPL
43
43
  @debug = debug
44
44
  @connections = Set.new
45
45
  @binding = binding
46
- @bindings = {}
47
- @bindings_by_id = {}
46
+ loc = caller_locations.reject { |x| x.absolute_path =~ /nrepl\-lazuli/ }[0]
47
+ loc = caller_locations[0] if(!loc)
48
+ path = loc.absolute_path
49
+ line = loc.lineno - 1
50
+ @bindings = {path => {line => {"NREPL::Server.start" => binding}}}
51
+ @bindings_by_id = {
52
+ "NREPL::Server.start" => {
53
+ binding: binding,
54
+ file: path,
55
+ row: line
56
+ }
57
+ }
48
58
  @tracing = tracing
49
59
  Thread.current[:nrepl_server] = self
50
60
  NREPL.class_variable_set(:@@connections, @connections)
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nrepl-lazuli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maurício Szabo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-24 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bencode
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - '='
18
- - !ruby/object:Gem::Version
19
- version: 0.8.2
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - '='
25
- - !ruby/object:Gem::Version
26
- version: 0.8.2
11
+ date: 2024-11-13 00:00:00.000000000 Z
12
+ dependencies: []
27
13
  description: A Ruby nREPL server, made to be used with Lazuli plug-in (but can be
28
14
  used with any nREPL client too)
29
15
  email: mauricio@szabo.link
@@ -55,7 +41,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
55
41
  - !ruby/object:Gem::Version
56
42
  version: '0'
57
43
  requirements: []
58
- rubygems_version: 3.5.9
44
+ rubygems_version: 3.5.11
59
45
  signing_key:
60
46
  specification_version: 4
61
47
  summary: A Ruby nREPL server