neovim 0.7.1 → 0.9.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 (75) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/docs.yml +39 -0
  3. data/.github/workflows/tests.yml +64 -0
  4. data/.gitignore +2 -0
  5. data/CHANGELOG.md +22 -0
  6. data/CODE_OF_CONDUCT.md +3 -3
  7. data/README.md +19 -20
  8. data/Rakefile +21 -11
  9. data/exe/neovim-ruby-host +5 -0
  10. data/lib/neovim/buffer.rb +120 -41
  11. data/lib/neovim/client.rb +304 -39
  12. data/lib/neovim/client_info.rb +46 -0
  13. data/lib/neovim/connection.rb +7 -2
  14. data/lib/neovim/event_loop.rb +8 -4
  15. data/lib/neovim/host/cli.rb +41 -0
  16. data/lib/neovim/host.rb +3 -0
  17. data/lib/neovim/logging.rb +1 -1
  18. data/lib/neovim/message.rb +1 -1
  19. data/lib/neovim/plugin/dsl.rb +6 -0
  20. data/lib/neovim/plugin.rb +7 -2
  21. data/lib/neovim/remote_object.rb +5 -2
  22. data/lib/neovim/ruby_provider/object_ext.rb +5 -0
  23. data/lib/neovim/ruby_provider/vim.rb +6 -5
  24. data/lib/neovim/ruby_provider.rb +29 -10
  25. data/lib/neovim/session.rb +21 -16
  26. data/lib/neovim/tabpage.rb +8 -15
  27. data/lib/neovim/version.rb +1 -1
  28. data/lib/neovim/window.rb +45 -33
  29. data/lib/neovim.rb +12 -3
  30. data/neovim.gemspec +4 -5
  31. data/script/ci/download_nvim.sh +40 -0
  32. data/script/dump_api.rb +1 -1
  33. data/script/generate_docs.rb +6 -7
  34. data/script/run_acceptance.rb +15 -11
  35. data/spec/acceptance/client_info_spec.vim +42 -0
  36. data/spec/acceptance/rplugin_command_spec.vim +2 -2
  37. data/spec/acceptance/ruby_spec.vim +18 -11
  38. data/spec/acceptance/rubydo_spec.vim +9 -0
  39. data/spec/acceptance/rubyeval_spec.vim +22 -0
  40. data/spec/acceptance/rubyfile/curbuf_ivar_get.rb +1 -1
  41. data/spec/acceptance/rubyfile/curbuf_ivar_set.rb +1 -1
  42. data/spec/acceptance/rubyfile/define_foo.rb +1 -1
  43. data/spec/acceptance/rubyfile/nested_inner.rb +1 -1
  44. data/spec/acceptance/rubyfile/set_pwd_after.rb +1 -1
  45. data/spec/acceptance/rubyfile/set_pwd_before.rb +1 -1
  46. data/spec/acceptance/rubyfile_spec.vim +19 -19
  47. data/spec/acceptance/runtime/init.vim +2 -2
  48. data/spec/acceptance/runtime/rplugin/ruby/commands.rb +2 -2
  49. data/spec/helper.rb +25 -7
  50. data/spec/neovim/api_spec.rb +1 -1
  51. data/spec/neovim/buffer_spec.rb +10 -6
  52. data/spec/neovim/client_info_spec.rb +77 -0
  53. data/spec/neovim/client_spec.rb +9 -2
  54. data/spec/neovim/connection_spec.rb +32 -4
  55. data/spec/neovim/current_spec.rb +1 -2
  56. data/spec/neovim/event_loop_spec.rb +16 -0
  57. data/spec/neovim/host/cli_spec.rb +94 -0
  58. data/spec/neovim/host_spec.rb +16 -14
  59. data/spec/neovim/line_range_spec.rb +1 -3
  60. data/spec/neovim/remote_object_spec.rb +1 -2
  61. data/spec/neovim/ruby_provider/buffer_ext_spec.rb +6 -7
  62. data/spec/neovim/ruby_provider/object_ext_spec.rb +10 -0
  63. data/spec/neovim/ruby_provider/vim_spec.rb +1 -1
  64. data/spec/neovim/ruby_provider/window_ext_spec.rb +7 -10
  65. data/spec/neovim/session_spec.rb +13 -40
  66. data/spec/neovim/window_spec.rb +1 -1
  67. data/spec/neovim_spec.rb +28 -51
  68. data/spec/support.rb +27 -1
  69. metadata +26 -44
  70. data/.coveralls.yml +0 -1
  71. data/.rubocop.yml +0 -118
  72. data/.travis.yml +0 -22
  73. data/appveyor.yml +0 -31
  74. data/bin/neovim-ruby-host +0 -18
  75. 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
data/spec/neovim_spec.rb CHANGED
@@ -1,60 +1,37 @@
1
1
  require "helper"
2
2
 
3
3
  RSpec.describe Neovim do
4
- describe ".attach_tcp" do
5
- it "attaches to a TCP socket" do
6
- port = Support.tcp_port
7
- env = {"NVIM_LISTEN_ADDRESS" => "127.0.0.1:#{port}"}
8
- pid = Process.spawn(env, *Support.child_argv, [:out, :err] => File::NULL)
9
-
10
- begin
11
- client = Neovim.attach_tcp("127.0.0.1", port)
12
- rescue Errno::ECONNREFUSED
13
- retry
14
- end
15
-
16
- begin
17
- expect(client.strwidth("hi")).to eq(2)
18
- ensure
19
- Support.kill(pid)
20
- Process.waitpid(pid)
21
- end
22
- end
23
- end
24
-
25
- describe ".attach_unix" do
26
- before do
27
- skip("Not supported on this platform") if Support.windows?
28
- end
29
-
30
- it "attaches to a UNIX socket" do
31
- socket_path = Support.socket_path
32
- env = {"NVIM_LISTEN_ADDRESS" => socket_path}
33
- pid = Process.spawn(env, *Support.child_argv, [:out, :err] => File::NULL)
34
-
35
- begin
36
- client = Neovim.attach_unix(socket_path)
37
- rescue Errno::ENOENT, Errno::ECONNREFUSED
38
- retry
39
- end
40
-
41
- begin
42
- expect(client.strwidth("hi")).to eq(2)
43
- ensure
44
- Support.kill(pid)
45
- Process.waitpid(pid)
46
- end
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"
47
12
  end
48
13
  end
49
14
 
50
- describe ".attach_child" do
51
- it "spawns and attaches to a child process" do
52
- begin
53
- client = Neovim.attach_child(Support.child_argv)
54
- expect(client.strwidth("hi")).to eq(2)
55
- ensure
56
- client.shutdown
57
- end
15
+ describe ".attach" do
16
+ it "sets appropriate client info" do
17
+ chan_info = client.evaluate("nvim_get_chan_info(#{client.channel_id})")
18
+
19
+ expect(chan_info).to match(
20
+ "client" => {
21
+ "name" => "ruby-client",
22
+ "version" => {
23
+ "major" => duck_type(:to_int),
24
+ "minor" => duck_type(:to_int),
25
+ "patch" => duck_type(:to_int)
26
+ },
27
+ "type" => "remote",
28
+ "methods" => {},
29
+ "attributes" => duck_type(:to_hash)
30
+ },
31
+ "id" => duck_type(:to_int),
32
+ "mode" => "rpc",
33
+ "stream" => stream
34
+ )
58
35
  end
59
36
  end
60
37
 
data/spec/support.rb CHANGED
@@ -1,10 +1,35 @@
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
- File.expand_path("../workspace", __FILE__)
32
+ File.expand_path("workspace", __dir__)
8
33
  end
9
34
 
10
35
  def self.socket_path
@@ -43,6 +68,7 @@ module Support
43
68
 
44
69
  def self.kill(pid)
45
70
  windows? ? Process.kill(:KILL, pid) : Process.kill(:TERM, pid)
71
+ Process.waitpid(pid)
46
72
  end
47
73
 
48
74
  begin
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.7.1
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Genco
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2018-03-04 00:00:00.000000000 Z
11
+ date: 2021-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -42,30 +42,16 @@ dependencies:
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: coveralls
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
45
+ - - "~>"
60
46
  - !ruby/object:Gem::Version
61
- version: '0'
47
+ version: '2.0'
62
48
  type: :development
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
- - - ">="
52
+ - - "~>"
67
53
  - !ruby/object:Gem::Version
68
- version: '0'
54
+ version: '2.0'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: pry
71
57
  requirement: !ruby/object:Gem::Requirement
@@ -122,20 +108,6 @@ dependencies:
122
108
  - - "~>"
123
109
  - !ruby/object:Gem::Version
124
110
  version: '3.0'
125
- - !ruby/object:Gem::Dependency
126
- name: rubocop
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - '='
130
- - !ruby/object:Gem::Version
131
- version: 0.52.1
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - '='
137
- - !ruby/object:Gem::Version
138
- version: 0.52.1
139
111
  - !ruby/object:Gem::Dependency
140
112
  name: vim-flavor
141
113
  requirement: !ruby/object:Gem::Requirement
@@ -158,10 +130,9 @@ executables:
158
130
  extensions: []
159
131
  extra_rdoc_files: []
160
132
  files:
161
- - ".coveralls.yml"
133
+ - ".github/workflows/docs.yml"
134
+ - ".github/workflows/tests.yml"
162
135
  - ".gitignore"
163
- - ".rubocop.yml"
164
- - ".travis.yml"
165
136
  - CHANGELOG.md
166
137
  - CODE_OF_CONDUCT.md
167
138
  - Gemfile
@@ -169,17 +140,18 @@ files:
169
140
  - README.md
170
141
  - Rakefile
171
142
  - VimFlavor
172
- - appveyor.yml
173
- - bin/neovim-ruby-host
143
+ - exe/neovim-ruby-host
174
144
  - lib/neovim.rb
175
145
  - lib/neovim/api.rb
176
146
  - lib/neovim/buffer.rb
177
147
  - lib/neovim/client.rb
148
+ - lib/neovim/client_info.rb
178
149
  - lib/neovim/connection.rb
179
150
  - lib/neovim/current.rb
180
151
  - lib/neovim/event_loop.rb
181
152
  - lib/neovim/executable.rb
182
153
  - lib/neovim/host.rb
154
+ - lib/neovim/host/cli.rb
183
155
  - lib/neovim/host/loader.rb
184
156
  - lib/neovim/line_range.rb
185
157
  - lib/neovim/logging.rb
@@ -190,6 +162,7 @@ files:
190
162
  - lib/neovim/remote_object.rb
191
163
  - lib/neovim/ruby_provider.rb
192
164
  - lib/neovim/ruby_provider/buffer_ext.rb
165
+ - lib/neovim/ruby_provider/object_ext.rb
193
166
  - lib/neovim/ruby_provider/vim.rb
194
167
  - lib/neovim/ruby_provider/window_ext.rb
195
168
  - lib/neovim/session.rb
@@ -197,17 +170,19 @@ files:
197
170
  - lib/neovim/version.rb
198
171
  - lib/neovim/window.rb
199
172
  - neovim.gemspec
173
+ - script/ci/download_nvim.sh
200
174
  - script/dump_api.rb
201
175
  - script/generate_docs.rb
202
176
  - script/j2mp.rb
203
177
  - script/mp2j.rb
204
178
  - script/run_acceptance.rb
205
- - script/validate_docs.rb
179
+ - spec/acceptance/client_info_spec.vim
206
180
  - spec/acceptance/rplugin_autocmd_spec.vim
207
181
  - spec/acceptance/rplugin_command_spec.vim
208
182
  - spec/acceptance/rplugin_function_spec.vim
209
183
  - spec/acceptance/ruby_spec.vim
210
184
  - spec/acceptance/rubydo_spec.vim
185
+ - spec/acceptance/rubyeval_spec.vim
211
186
  - spec/acceptance/rubyfile/call_foo.rb
212
187
  - spec/acceptance/rubyfile/curbuf_ivar_get.rb
213
188
  - spec/acceptance/rubyfile/curbuf_ivar_set.rb
@@ -227,11 +202,13 @@ files:
227
202
  - spec/helper.rb
228
203
  - spec/neovim/api_spec.rb
229
204
  - spec/neovim/buffer_spec.rb
205
+ - spec/neovim/client_info_spec.rb
230
206
  - spec/neovim/client_spec.rb
231
207
  - spec/neovim/connection_spec.rb
232
208
  - spec/neovim/current_spec.rb
233
209
  - spec/neovim/event_loop_spec.rb
234
210
  - spec/neovim/executable_spec.rb
211
+ - spec/neovim/host/cli_spec.rb
235
212
  - spec/neovim/host/loader_spec.rb
236
213
  - spec/neovim/host_spec.rb
237
214
  - spec/neovim/line_range_spec.rb
@@ -240,13 +217,14 @@ files:
240
217
  - spec/neovim/plugin_spec.rb
241
218
  - spec/neovim/remote_object_spec.rb
242
219
  - spec/neovim/ruby_provider/buffer_ext_spec.rb
220
+ - spec/neovim/ruby_provider/object_ext_spec.rb
243
221
  - spec/neovim/ruby_provider/vim_spec.rb
244
222
  - spec/neovim/ruby_provider/window_ext_spec.rb
245
223
  - spec/neovim/session_spec.rb
246
224
  - spec/neovim/window_spec.rb
247
225
  - spec/neovim_spec.rb
248
226
  - spec/support.rb
249
- homepage: https://github.com/alexgenco/neovim-ruby
227
+ homepage: https://github.com/neovim/neovim-ruby
250
228
  licenses:
251
229
  - MIT
252
230
  metadata: {}
@@ -265,17 +243,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
265
243
  - !ruby/object:Gem::Version
266
244
  version: '0'
267
245
  requirements: []
268
- rubyforge_project:
269
- rubygems_version: 2.6.13
246
+ rubygems_version: 3.2.2
270
247
  signing_key:
271
248
  specification_version: 4
272
249
  summary: A Ruby client for Neovim
273
250
  test_files:
251
+ - spec/acceptance/client_info_spec.vim
274
252
  - spec/acceptance/rplugin_autocmd_spec.vim
275
253
  - spec/acceptance/rplugin_command_spec.vim
276
254
  - spec/acceptance/rplugin_function_spec.vim
277
255
  - spec/acceptance/ruby_spec.vim
278
256
  - spec/acceptance/rubydo_spec.vim
257
+ - spec/acceptance/rubyeval_spec.vim
279
258
  - spec/acceptance/rubyfile/call_foo.rb
280
259
  - spec/acceptance/rubyfile/curbuf_ivar_get.rb
281
260
  - spec/acceptance/rubyfile/curbuf_ivar_set.rb
@@ -295,11 +274,13 @@ test_files:
295
274
  - spec/helper.rb
296
275
  - spec/neovim/api_spec.rb
297
276
  - spec/neovim/buffer_spec.rb
277
+ - spec/neovim/client_info_spec.rb
298
278
  - spec/neovim/client_spec.rb
299
279
  - spec/neovim/connection_spec.rb
300
280
  - spec/neovim/current_spec.rb
301
281
  - spec/neovim/event_loop_spec.rb
302
282
  - spec/neovim/executable_spec.rb
283
+ - spec/neovim/host/cli_spec.rb
303
284
  - spec/neovim/host/loader_spec.rb
304
285
  - spec/neovim/host_spec.rb
305
286
  - spec/neovim/line_range_spec.rb
@@ -308,6 +289,7 @@ test_files:
308
289
  - spec/neovim/plugin_spec.rb
309
290
  - spec/neovim/remote_object_spec.rb
310
291
  - spec/neovim/ruby_provider/buffer_ext_spec.rb
292
+ - spec/neovim/ruby_provider/object_ext_spec.rb
311
293
  - spec/neovim/ruby_provider/vim_spec.rb
312
294
  - spec/neovim/ruby_provider/window_ext_spec.rb
313
295
  - spec/neovim/session_spec.rb
data/.coveralls.yml DELETED
@@ -1 +0,0 @@
1
- service_name: travis-ci
data/.rubocop.yml DELETED
@@ -1,118 +0,0 @@
1
- AllCops:
2
- Exclude:
3
- - _neovim/**/*
4
- - spec/acceptance/**/*
5
- - vendor/**/*
6
- - script/**/*
7
-
8
- Layout/EndOfLine:
9
- EnforcedStyle: lf
10
-
11
- Layout/SpaceAroundEqualsInParameterDefault:
12
- EnforcedStyle: no_space
13
-
14
- Layout/SpaceInsideHashLiteralBraces:
15
- EnforcedStyle: no_space
16
-
17
- Lint/AmbiguousBlockAssociation:
18
- Exclude:
19
- - spec/**/*
20
-
21
- Lint/HandleExceptions:
22
- Exclude:
23
- - lib/neovim/ruby_provider.rb
24
- - lib/neovim/logging.rb
25
- - lib/neovim/connection.rb
26
- - lib/neovim/line_range.rb
27
-
28
- Lint/RescueException:
29
- Exclude:
30
- - lib/neovim/host.rb
31
-
32
- Lint/UnderscorePrefixedVariableName:
33
- Exclude:
34
- - lib/neovim/ruby_provider.rb
35
-
36
- Lint/UselessAccessModifier:
37
- Exclude:
38
- - lib/neovim/buffer.rb
39
- - lib/neovim/client.rb
40
-
41
- Lint/Void:
42
- Exclude:
43
- - lib/neovim/window.rb
44
-
45
- Metrics/AbcSize:
46
- Max: 20
47
-
48
- Metrics/BlockLength:
49
- Exclude:
50
- - spec/**/*
51
-
52
- Metrics/ClassLength:
53
- Max: 500
54
-
55
- Metrics/LineLength:
56
- Max: 125
57
-
58
- Metrics/MethodLength:
59
- Max: 50
60
-
61
- Metrics/ModuleLength:
62
- Exclude:
63
- - spec/**/*
64
-
65
- Metrics/ParameterLists:
66
- Max: 6
67
-
68
- Naming/AccessorMethodName:
69
- Exclude:
70
- - lib/neovim/client.rb
71
-
72
- Security/Eval:
73
- Exclude:
74
- - lib/neovim/ruby_provider.rb
75
-
76
- Style/BlockComments:
77
- Exclude:
78
- - lib/neovim/buffer.rb
79
- - lib/neovim/client.rb
80
- - lib/neovim/tabpage.rb
81
- - lib/neovim/window.rb
82
-
83
- Style/ConditionalAssignment:
84
- EnforcedStyle: assign_inside_condition
85
- IncludeTernaryExpressions: false
86
-
87
- Style/DoubleNegation:
88
- Enabled: false
89
-
90
- Style/FormatStringToken:
91
- EnforcedStyle: unannotated
92
-
93
- Style/GlobalVars:
94
- Exclude:
95
- - lib/neovim/ruby_provider/vim.rb
96
- - spec/neovim/ruby_provider/vim_spec.rb
97
-
98
- Style/ParallelAssignment:
99
- Enabled: false
100
-
101
- Style/RescueStandardError:
102
- EnforcedStyle: implicit
103
-
104
- Style/SpecialGlobalVars:
105
- EnforcedStyle: use_perl_names
106
-
107
- Style/StringLiterals:
108
- EnforcedStyle: double_quotes
109
-
110
- Style/SymbolArray:
111
- EnforcedStyle: brackets
112
-
113
- Style/WordArray:
114
- EnforcedStyle: brackets
115
-
116
- Style/ZeroLengthPredicate:
117
- Exclude:
118
- - lib/neovim/ruby_provider.rb