nvim 1.3.0 → 1.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: f5191debebad5c3b62e615186a5d01bd768a0b1b5779e56a2f52e01f0c421773
4
- data.tar.gz: 264e879be038d63211c76b1ad2bcffcf8cb28796212010850b6e733a5ad702f3
3
+ metadata.gz: ee36b4c5053b9d05ab3a47d66b5b248aeacc3ffd340b282db719200c298a3fe1
4
+ data.tar.gz: aa714f06cd14114dfc406afbec1e38ce452ff3cdb935c0f2dfeecba6762c1ec3
5
5
  SHA512:
6
- metadata.gz: '0696bf812f39ad42982db2cb61242ba325dae1f94405c1ca537058617cac648a2e601215a8c2f02c40e27e238efc28a681a6a19e4abd55b9c11865318e77ecfc'
7
- data.tar.gz: 9ead8707a4fc45cf519a92f7ad03bc78acac2a3b2e8a532e3f3a02e06cfe5963d69bb82817cf098f40293ce03f7384a3102d844d1becc1f252067301132b7601
6
+ metadata.gz: 7867c1fc7051d1776058d412e71c56f4127d06176fa3b9f0ce744ab2171e738626eb47916dc186551799be637d7eca565a48ed24b19014400818c805548be7d9
7
+ data.tar.gz: 8913f88061341f6282c05f041e8ac734bb664a775a711e00e1080af97d674a3b38e8988265fdb7d1ab38393615b48b08abd690cf1c8fbd6fa3d703f6d97c876a
data/INFO.yaml CHANGED
@@ -3,7 +3,7 @@
3
3
  #
4
4
 
5
5
  nvim:
6
- version: 1.3.0
6
+ version: 1.4.0
7
7
  license: BSD-2-Clause+
8
8
  authors:
9
9
  - Bertram Scharpf
data/README.md CHANGED
@@ -215,17 +215,21 @@ let chan = jobstart('./demo_remote.rb', { 'rpc': v:true })
215
215
  Logging is a easy as this:
216
216
 
217
217
  ```shell
218
- export NVIM_RUBY_LOG_LEVEL=all NVIM_RUBY_LOG_FILE=nvim.log
218
+ export NVIM_RUBY_LOG_LEVEL=all NVIM_RUBY_LOG_FILE=ruby.log
219
219
  nvim +'ruby puts "hi"*10'
220
220
  ```
221
221
 
222
+ If the logfile isn't an absoulte path and doesn't start with `"./"`,
223
+ it will be relative to Neovim's `stdpath("log")`.
224
+
222
225
  To show the log levels, simply run in Neovim:
223
226
 
224
227
  ```vim
225
228
  ruby puts Neovim::Logging::LEVELS.keys
226
229
  ```
227
230
 
228
- If you are inside a [Tmux](https://tmux.github.io), you might prefer to trace the colored log in a split window.
231
+ If you are inside a [Tmux](https://tmux.github.io), you might prefer to trace
232
+ the colored log in a split window.
229
233
 
230
234
  ```shell
231
235
  tmux split-window -fhd 'echo -e "\e[33m==== $$ ==== `tty` ====\e[m" ; ln -sf `tty` /tmp/tmux-`id -u`/debug ; exec cat >/dev/null 2>&1'
data/TODO ADDED
@@ -0,0 +1,2 @@
1
+ - system "ls" stürzt ab
2
+ - Logdatei ins Standardverzeichnis
@@ -113,6 +113,25 @@ module Neovim
113
113
  end
114
114
  end
115
115
 
116
+ def stdpath what
117
+ cmd = [ path, "--headless", ]
118
+ cmd.push "-c", "echo stdpath(#{what.to_s.inspect})"
119
+ cmd.push "-c", "q"
120
+ (pipe_stderr cmd)&.tap { |x| x.chomp! }
121
+ end
122
+
123
+ private
124
+
125
+ def pipe_stderr cmd
126
+ re, we = IO.pipe
127
+ fork do
128
+ re.close ; $stderr.reopen we ; we.close
129
+ exec *cmd
130
+ end
131
+ we.close
132
+ re.read
133
+ end
134
+
116
135
  end
117
136
 
118
137
  end
data/lib/neovim/host.rb CHANGED
@@ -27,7 +27,7 @@ module Neovim
27
27
  log :fatal, "Disconnected"
28
28
  nil
29
29
  rescue SignalException
30
- n = $!.signm
30
+ n = $!.signm.notempty? || $!.class.to_s
31
31
  log :fatal, "Signal was caught: #{n}"
32
32
  (n =~ /\A(?:SIG)?TERM\z/) ? 0 : 1
33
33
  rescue Exception
data/lib/neovim/info.rb CHANGED
@@ -1,10 +1,10 @@
1
1
  require "neovim/meta.rb"
2
2
  Neovim::INFO = Neovim::Meta.new "nvim",
3
- version: "1.3.0",
3
+ version: "1.4.0",
4
4
  license: "BSD-2-Clause+",
5
5
  authors: ["Bertram Scharpf"],
6
6
  email: "software@bertram-scharpf.de",
7
7
  summary: "Yet another Ruby client for Neovim",
8
8
  description: "A simple Ruby client for Neovim.\nClean code, minimal dependecies, no frills, no wokeness.",
9
9
  homepage: "https://github.com/BertramScharpf/ruby-nvim",
10
- commit: "7dc787c"
10
+ commit: "3318cce"
@@ -103,6 +103,11 @@ module Neovim
103
103
  v = kwargs.delete k
104
104
  params[ k] = v if v
105
105
  end
106
+ unless path =~ /\A(?:\.\/|~|\/)/ then
107
+ require "neovim/connection"
108
+ base = ConnectionChild.stdpath "log"
109
+ end
110
+ path = File.expand_path path, base
106
111
  File.open path, "a", **params do |f|
107
112
  yield (new f, **kwargs)
108
113
  end
data/lib/neovim/output.rb CHANGED
@@ -3,6 +3,37 @@
3
3
  #
4
4
 
5
5
 
6
+ module Kernel
7
+
8
+ module_function def system *cmd
9
+ ro, wo = IO.pipe
10
+ re, we = IO.pipe
11
+ child = fork do
12
+ STDIN.close
13
+ ro.close ; STDOUT.reopen wo ; wo.close
14
+ re.close ; STDERR.reopen we ; we.close
15
+ exec *cmd
16
+ end
17
+ wo.close
18
+ we.close
19
+ h = { ro => $stdout, re => $stderr, }
20
+ until h.empty? do
21
+ h.keys.each { |r|
22
+ if r.eof? then
23
+ r.close
24
+ h.delete r
25
+ else
26
+ h[ r].puts r.readline
27
+ end
28
+ }
29
+ end
30
+ Process.waitpid child
31
+ $?.success?
32
+ end
33
+
34
+ end
35
+
36
+
6
37
  module Neovim
7
38
 
8
39
  class Write
@@ -12,7 +12,7 @@ module Neovim
12
12
 
13
13
  def result
14
14
  @result or return
15
- r = @result.round @decs
15
+ r = @decs ? (@result.round @decs) : @result
16
16
  case r
17
17
  when BigDecimal then
18
18
  r = r.to_s "F"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nvim
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bertram Scharpf
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-04 00:00:00.000000000 Z
11
+ date: 2024-11-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: software@bertram-scharpf.de
@@ -21,6 +21,7 @@ files:
21
21
  - LICENSE
22
22
  - README.md
23
23
  - Rakefile
24
+ - TODO
24
25
  - bin/neovim-ruby-host
25
26
  - lib/neovim.rb
26
27
  - lib/neovim/client.rb
@@ -61,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
61
62
  - !ruby/object:Gem::Version
62
63
  version: '0'
63
64
  requirements: []
64
- rubygems_version: 3.5.19
65
+ rubygems_version: 3.5.22
65
66
  signing_key:
66
67
  specification_version: 4
67
68
  summary: Yet another Ruby client for Neovim