neovim 0.8.1 → 0.9.0.pre.1

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/docs.yml +36 -0
  3. data/.github/workflows/linter.yml +32 -0
  4. data/.github/workflows/tests.yml +62 -0
  5. data/.rubocop.yml +19 -2
  6. data/CHANGELOG.md +6 -0
  7. data/CODE_OF_CONDUCT.md +3 -3
  8. data/README.md +19 -17
  9. data/Rakefile +28 -24
  10. data/exe/neovim-ruby-host +2 -15
  11. data/lib/neovim/buffer.rb +15 -1
  12. data/lib/neovim/client.rb +89 -1
  13. data/lib/neovim/connection.rb +0 -1
  14. data/lib/neovim/event_loop.rb +6 -3
  15. data/lib/neovim/host/cli.rb +41 -0
  16. data/lib/neovim/logging.rb +1 -1
  17. data/lib/neovim/ruby_provider.rb +25 -8
  18. data/lib/neovim/ruby_provider/object_ext.rb +5 -0
  19. data/lib/neovim/session.rb +13 -18
  20. data/lib/neovim/tabpage.rb +1 -1
  21. data/lib/neovim/version.rb +1 -1
  22. data/lib/neovim/window.rb +15 -1
  23. data/neovim.gemspec +1 -1
  24. data/script/ci/download_nvim.sh +40 -0
  25. data/script/run_acceptance.rb +15 -11
  26. data/spec/acceptance/ruby_spec.vim +6 -1
  27. data/spec/acceptance/rubyeval_spec.vim +22 -0
  28. data/spec/acceptance/rubyfile/set_pwd_before.rb +1 -1
  29. data/spec/acceptance/rubyfile_spec.vim +4 -6
  30. data/spec/helper.rb +20 -1
  31. data/spec/neovim/api_spec.rb +1 -1
  32. data/spec/neovim/buffer_spec.rb +4 -6
  33. data/spec/neovim/client_spec.rb +3 -3
  34. data/spec/neovim/current_spec.rb +1 -2
  35. data/spec/neovim/event_loop_spec.rb +10 -0
  36. data/spec/neovim/host/cli_spec.rb +94 -0
  37. data/spec/neovim/host_spec.rb +2 -7
  38. data/spec/neovim/line_range_spec.rb +1 -3
  39. data/spec/neovim/remote_object_spec.rb +1 -2
  40. data/spec/neovim/ruby_provider/buffer_ext_spec.rb +6 -7
  41. data/spec/neovim/ruby_provider/object_ext_spec.rb +10 -0
  42. data/spec/neovim/ruby_provider/vim_spec.rb +1 -1
  43. data/spec/neovim/ruby_provider/window_ext_spec.rb +7 -10
  44. data/spec/neovim/session_spec.rb +13 -46
  45. data/spec/neovim/window_spec.rb +1 -1
  46. data/spec/neovim_spec.rb +10 -63
  47. data/spec/support.rb +25 -0
  48. metadata +21 -12
  49. data/.travis.yml +0 -25
  50. data/appveyor.yml +0 -35
  51. data/script/validate_docs.rb +0 -29
@@ -2,7 +2,7 @@ require "helper"
2
2
 
3
3
  module Neovim
4
4
  RSpec.describe Window do
5
- let(:client) { Neovim.attach_child(Support.child_argv) }
5
+ let(:client) { Support.persistent_client }
6
6
  let(:window) { client.current.window }
7
7
 
8
8
  before do
@@ -1,11 +1,18 @@
1
1
  require "helper"
2
2
 
3
3
  RSpec.describe Neovim do
4
- shared_context "attached client" do
5
- it "establishes an RPC connection" do
6
- expect(client.strwidth("hi")).to eq(2)
4
+ let(:client) { Support.persistent_client }
5
+
6
+ let(:stream) do
7
+ case Support.backend_strategy
8
+ when /^tcp/, /^unix/
9
+ "socket"
10
+ else
11
+ "stdio"
7
12
  end
13
+ end
8
14
 
15
+ describe ".attach" do
9
16
  it "sets appropriate client info" do
10
17
  chan_info = client.evaluate("nvim_get_chan_info(#{client.channel_id})")
11
18
 
@@ -28,66 +35,6 @@ RSpec.describe Neovim do
28
35
  end
29
36
  end
30
37
 
31
- describe ".attach_tcp" do
32
- include_context "attached client" do
33
- let(:port) { Support.tcp_port }
34
- let(:stream) { "socket" }
35
-
36
- let!(:nvim_pid) do
37
- env = {"NVIM_LISTEN_ADDRESS" => "127.0.0.1:#{port}"}
38
- Process.spawn(env, *Support.child_argv, [:out, :err] => File::NULL)
39
- end
40
-
41
- let(:client) do
42
- begin
43
- Neovim.attach_tcp("127.0.0.1", port)
44
- rescue Errno::ECONNREFUSED
45
- retry
46
- end
47
- end
48
-
49
- after { Support.kill(nvim_pid) }
50
- end
51
- end
52
-
53
- describe ".attach_unix" do
54
- before do
55
- skip("Not supported on this platform") if Support.windows?
56
- end
57
-
58
- include_context "attached client" do
59
- let(:socket_path) { Support.socket_path }
60
- let(:stream) { "socket" }
61
-
62
- let!(:nvim_pid) do
63
- env = {"NVIM_LISTEN_ADDRESS" => socket_path}
64
- Process.spawn(env, *Support.child_argv, [:out, :err] => File::NULL)
65
- end
66
-
67
- let(:client) do
68
- begin
69
- Neovim.attach_unix(socket_path)
70
- rescue Errno::ENOENT, Errno::ECONNREFUSED
71
- retry
72
- end
73
- end
74
-
75
- after { Support.kill(nvim_pid) }
76
- end
77
- end
78
-
79
- describe ".attach_child" do
80
- include_context "attached client" do
81
- let(:stream) { "stdio" }
82
-
83
- let(:client) do
84
- Neovim.attach_child(Support.child_argv)
85
- end
86
- end
87
-
88
- after { client.shutdown }
89
- end
90
-
91
38
  describe ".executable" do
92
39
  it "returns the current executable" do
93
40
  expect(Neovim.executable).to be_a(Neovim::Executable)
@@ -1,8 +1,33 @@
1
+ require "shellwords"
2
+
1
3
  module Support
2
4
  class << self
3
5
  attr_accessor :nvim_version
4
6
  end
5
7
 
8
+ def self.clean_persistent_client
9
+ persistent_client.command("%bdelete! | tabonly | only | set all&")
10
+ end
11
+
12
+ def self.backend_strategy
13
+ @backend_strategy ||= ENV.fetch("NVIM_RUBY_SPEC_BACKEND", "child")
14
+ end
15
+
16
+ def self.persistent_client
17
+ return @persistent_client if defined?(@persistent_client)
18
+
19
+ case backend_strategy
20
+ when /^child:?(.*)$/
21
+ @persistent_client = Neovim.attach_child(child_argv + Shellwords.split($1))
22
+ when /^tcp:(.+)$/
23
+ @persistent_client = Neovim.attach_tcp(*$1.split(":", 2))
24
+ when /^unix:(.+)$/
25
+ @persistent_client = Neovim.attach_unix($1)
26
+ else
27
+ raise "Unrecognized $NVIM_RUBY_SPEC_BACKEND #{backend_strategy.inspect}"
28
+ end
29
+ end
30
+
6
31
  def self.workspace
7
32
  File.expand_path("workspace", __dir__)
8
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neovim
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.9.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Genco
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-21 00:00:00.000000000 Z
11
+ date: 2020-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '2.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '2.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -144,9 +144,11 @@ executables:
144
144
  extensions: []
145
145
  extra_rdoc_files: []
146
146
  files:
147
+ - ".github/workflows/docs.yml"
148
+ - ".github/workflows/linter.yml"
149
+ - ".github/workflows/tests.yml"
147
150
  - ".gitignore"
148
151
  - ".rubocop.yml"
149
- - ".travis.yml"
150
152
  - CHANGELOG.md
151
153
  - CODE_OF_CONDUCT.md
152
154
  - Gemfile
@@ -154,7 +156,6 @@ files:
154
156
  - README.md
155
157
  - Rakefile
156
158
  - VimFlavor
157
- - appveyor.yml
158
159
  - exe/neovim-ruby-host
159
160
  - lib/neovim.rb
160
161
  - lib/neovim/api.rb
@@ -166,6 +167,7 @@ files:
166
167
  - lib/neovim/event_loop.rb
167
168
  - lib/neovim/executable.rb
168
169
  - lib/neovim/host.rb
170
+ - lib/neovim/host/cli.rb
169
171
  - lib/neovim/host/loader.rb
170
172
  - lib/neovim/line_range.rb
171
173
  - lib/neovim/logging.rb
@@ -176,6 +178,7 @@ files:
176
178
  - lib/neovim/remote_object.rb
177
179
  - lib/neovim/ruby_provider.rb
178
180
  - lib/neovim/ruby_provider/buffer_ext.rb
181
+ - lib/neovim/ruby_provider/object_ext.rb
179
182
  - lib/neovim/ruby_provider/vim.rb
180
183
  - lib/neovim/ruby_provider/window_ext.rb
181
184
  - lib/neovim/session.rb
@@ -183,18 +186,19 @@ files:
183
186
  - lib/neovim/version.rb
184
187
  - lib/neovim/window.rb
185
188
  - neovim.gemspec
189
+ - script/ci/download_nvim.sh
186
190
  - script/dump_api.rb
187
191
  - script/generate_docs.rb
188
192
  - script/j2mp.rb
189
193
  - script/mp2j.rb
190
194
  - script/run_acceptance.rb
191
- - script/validate_docs.rb
192
195
  - spec/acceptance/client_info_spec.vim
193
196
  - spec/acceptance/rplugin_autocmd_spec.vim
194
197
  - spec/acceptance/rplugin_command_spec.vim
195
198
  - spec/acceptance/rplugin_function_spec.vim
196
199
  - spec/acceptance/ruby_spec.vim
197
200
  - spec/acceptance/rubydo_spec.vim
201
+ - spec/acceptance/rubyeval_spec.vim
198
202
  - spec/acceptance/rubyfile/call_foo.rb
199
203
  - spec/acceptance/rubyfile/curbuf_ivar_get.rb
200
204
  - spec/acceptance/rubyfile/curbuf_ivar_set.rb
@@ -220,6 +224,7 @@ files:
220
224
  - spec/neovim/current_spec.rb
221
225
  - spec/neovim/event_loop_spec.rb
222
226
  - spec/neovim/executable_spec.rb
227
+ - spec/neovim/host/cli_spec.rb
223
228
  - spec/neovim/host/loader_spec.rb
224
229
  - spec/neovim/host_spec.rb
225
230
  - spec/neovim/line_range_spec.rb
@@ -228,6 +233,7 @@ files:
228
233
  - spec/neovim/plugin_spec.rb
229
234
  - spec/neovim/remote_object_spec.rb
230
235
  - spec/neovim/ruby_provider/buffer_ext_spec.rb
236
+ - spec/neovim/ruby_provider/object_ext_spec.rb
231
237
  - spec/neovim/ruby_provider/vim_spec.rb
232
238
  - spec/neovim/ruby_provider/window_ext_spec.rb
233
239
  - spec/neovim/session_spec.rb
@@ -249,11 +255,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
249
255
  version: 2.2.0
250
256
  required_rubygems_version: !ruby/object:Gem::Requirement
251
257
  requirements:
252
- - - ">="
258
+ - - ">"
253
259
  - !ruby/object:Gem::Version
254
- version: '0'
260
+ version: 1.3.1
255
261
  requirements: []
256
- rubygems_version: 3.0.3
262
+ rubygems_version: 3.0.1
257
263
  signing_key:
258
264
  specification_version: 4
259
265
  summary: A Ruby client for Neovim
@@ -264,6 +270,7 @@ test_files:
264
270
  - spec/acceptance/rplugin_function_spec.vim
265
271
  - spec/acceptance/ruby_spec.vim
266
272
  - spec/acceptance/rubydo_spec.vim
273
+ - spec/acceptance/rubyeval_spec.vim
267
274
  - spec/acceptance/rubyfile/call_foo.rb
268
275
  - spec/acceptance/rubyfile/curbuf_ivar_get.rb
269
276
  - spec/acceptance/rubyfile/curbuf_ivar_set.rb
@@ -289,6 +296,7 @@ test_files:
289
296
  - spec/neovim/current_spec.rb
290
297
  - spec/neovim/event_loop_spec.rb
291
298
  - spec/neovim/executable_spec.rb
299
+ - spec/neovim/host/cli_spec.rb
292
300
  - spec/neovim/host/loader_spec.rb
293
301
  - spec/neovim/host_spec.rb
294
302
  - spec/neovim/line_range_spec.rb
@@ -297,6 +305,7 @@ test_files:
297
305
  - spec/neovim/plugin_spec.rb
298
306
  - spec/neovim/remote_object_spec.rb
299
307
  - spec/neovim/ruby_provider/buffer_ext_spec.rb
308
+ - spec/neovim/ruby_provider/object_ext_spec.rb
300
309
  - spec/neovim/ruby_provider/vim_spec.rb
301
310
  - spec/neovim/ruby_provider/window_ext_spec.rb
302
311
  - spec/neovim/session_spec.rb
@@ -1,25 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- sudo: false
4
- dist: trusty
5
-
6
- branches:
7
- only: master
8
-
9
- rvm:
10
- - 2.2
11
- - 2.3
12
- - 2.4
13
- - 2.5
14
- - 2.6
15
- - ruby-head
16
-
17
- before_install:
18
- - eval "$(curl --connect-timeout 30 --retry 3 -Ss https://raw.githubusercontent.com/neovim/bot-ci/master/scripts/travis-setup.sh) nightly-x64"
19
- - gem update --system --conservative || (gem install "rubygems-update:~>2.7" --no-document && update_rubygems)
20
- - gem install --remote bundler || gem install --remote bundler -v "1.17.3"
21
- - gem install --user-install executable-hooks
22
- - bundle --version
23
-
24
- env: NVIM_RUBY_LOG_LEVEL=DEBUG NVIM_RUBY_LOG_FILE=ci.log
25
- script: bundle exec rake --trace
@@ -1,35 +0,0 @@
1
- version: '{build}'
2
-
3
- environment:
4
- matrix:
5
- - RUBY_VERSION: 26
6
- - RUBY_VERSION: 25
7
- - RUBY_VERSION: 24
8
- - RUBY_VERSION: 23
9
- - RUBY_VERSION: 22
10
-
11
- cache:
12
- - vendor/bundle
13
-
14
- install:
15
- - set SSL_CERT_FILE=C:/ruby24-x64/ssl/cert.pem
16
- - set PATH=C:\Ruby%RUBY_VERSION%\bin;C:\tools\neovim\Neovim\bin;%PATH%
17
- - set NVIM_RUBY_LOG_LEVEL=DEBUG
18
- - set NVIM_RUBY_LOG_FILE=%cd%\ci.log
19
- - choco install neovim --pre -fy --ignore-dependencies --ignore-checksums
20
- - bundle install --path vendor/bundle
21
-
22
- build: off
23
-
24
- branches:
25
- only:
26
- - master
27
-
28
- before_test:
29
- - ruby -v
30
- - gem -v
31
- - bundle -v
32
- - nvim -v
33
-
34
- test_script:
35
- - bundle exec rake spec:functional spec:acceptance
@@ -1,29 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "json"
4
- require "open-uri"
5
-
6
- url = "https://api.github.com/repos/neovim/neovim/releases/latest"
7
-
8
- begin
9
- response = open(url) { |res| JSON.parse(res.read) }
10
- rescue SocketError, OpenURI::HTTPError => e
11
- puts "Request failed: #{e}\n"
12
- exit
13
- end
14
-
15
- release_version = response["name"][/NVIM v?(.+)$/, 1]
16
-
17
- client_file = File.read(
18
- File.expand_path("../lib/neovim/client.rb", __dir__)
19
- )
20
- docs_version = client_file[
21
- /The methods documented here were generated using NVIM v?(.+)$/,
22
- 1
23
- ]
24
-
25
- if docs_version == release_version
26
- puts "Documentation is up-to-date."
27
- else
28
- abort "Documentation is out of date: expected #{release_version}, got #{docs_version}."
29
- end