nvvm 0.1.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.
- checksums.yaml +7 -0
- data/.coveralls.yml +1 -0
- data/.document +5 -0
- data/.rspec +4 -0
- data/.rubocop.yml +27 -0
- data/.travis.yml +12 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +123 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +66 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/bin/nvvm +13 -0
- data/etc/login +18 -0
- data/lib/nvvm.rb +10 -0
- data/lib/nvvm/accessor.rb +29 -0
- data/lib/nvvm/cli.rb +74 -0
- data/lib/nvvm/constants.rb +3 -0
- data/lib/nvvm/ext/mkmf.rb +8 -0
- data/lib/nvvm/installer.rb +77 -0
- data/lib/nvvm/switcher.rb +18 -0
- data/lib/nvvm/uninstaller.rb +23 -0
- data/lib/nvvm/validator.rb +64 -0
- data/lib/nvvm/version.rb +44 -0
- data/nvvm.gemspec +91 -0
- data/spec/accessor_spec.rb +32 -0
- data/spec/installer_spec.rb +136 -0
- data/spec/spec_helper.rb +77 -0
- data/spec/switcher_spec.rb +42 -0
- data/spec/uninstaller_spec.rb +33 -0
- data/spec/validator_spec.rb +292 -0
- data/spec/version_spec.rb +93 -0
- metadata +175 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
|
4
|
+
FORMATTERS = [
|
5
|
+
SimpleCov::Formatter::HTMLFormatter,
|
6
|
+
Coveralls::SimpleCov::Formatter
|
7
|
+
].freeze
|
8
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(FORMATTERS)
|
9
|
+
SimpleCov.start do
|
10
|
+
add_filter '/spec/'
|
11
|
+
add_filter '/vendor/'
|
12
|
+
end
|
13
|
+
|
14
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
15
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
16
|
+
require 'rspec'
|
17
|
+
require 'fileutils'
|
18
|
+
require 'tmpdir'
|
19
|
+
require 'nvvm'
|
20
|
+
require 'nvvm/ext/mkmf'
|
21
|
+
|
22
|
+
VERSION1 = 'v0.2.1'.freeze
|
23
|
+
VERSION2 = 'v0.2.0'.freeze
|
24
|
+
|
25
|
+
RSpec.configure do |config|
|
26
|
+
config.before :suite do
|
27
|
+
cache = cache_dir
|
28
|
+
unless File.exist?(cache)
|
29
|
+
ENV['NVVMROOT'] = cache
|
30
|
+
ENV['NVVMOPT'] = nil
|
31
|
+
FileUtils.mkdir_p(cache)
|
32
|
+
Nvvm::Installer.fetch
|
33
|
+
[VERSION1, VERSION2].each do |v|
|
34
|
+
installer = Nvvm::Installer.new(v, [], true)
|
35
|
+
installer.checkout
|
36
|
+
installer.make_install
|
37
|
+
end
|
38
|
+
Nvvm::Installer.cp_etc
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
config.before :all do
|
43
|
+
@tmp = Dir.mktmpdir
|
44
|
+
FileUtils.cp_r(cache_dir, @tmp) unless self.class.metadata[:disable_cache]
|
45
|
+
ENV['NVVMROOT'] = File.expand_path(File.join(@tmp, '.nvvm_cache'))
|
46
|
+
ENV['NVVMOPT'] = nil
|
47
|
+
end
|
48
|
+
|
49
|
+
config.after :all do
|
50
|
+
FileUtils.rm_rf(@tmp)
|
51
|
+
end
|
52
|
+
|
53
|
+
config.before(:all, clean: true) { remove_dirs }
|
54
|
+
config.before(:all, repo: true) { cp_repo_dir }
|
55
|
+
config.before(:all, src: true) { cp_src_dir }
|
56
|
+
end
|
57
|
+
|
58
|
+
def cache_dir
|
59
|
+
File.expand_path(File.join(File.dirname(__FILE__), '..', '.nvvm_cache'))
|
60
|
+
end
|
61
|
+
|
62
|
+
def remove_dirs
|
63
|
+
[src_dir, repo_dir, etc_dir].each do |dir|
|
64
|
+
FileUtils.rm_rf(dir) if File.exist?(dir)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def cp_repo_dir
|
69
|
+
return if File.exist?(repo_dir)
|
70
|
+
FileUtils.cp_r(File.join(cache_dir, 'repo'), dot_dir)
|
71
|
+
end
|
72
|
+
|
73
|
+
def cp_src_dir
|
74
|
+
return if File.exist?(src_dir(@version))
|
75
|
+
FileUtils.mkdir_p(src_dir)
|
76
|
+
FileUtils.cp_r(File.join(cache_dir, 'src', @version), src_dir)
|
77
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Switcher' do
|
4
|
+
describe 'use' do
|
5
|
+
context 'system vim' do
|
6
|
+
before :all do
|
7
|
+
Nvvm::Switcher.new('system').use
|
8
|
+
end
|
9
|
+
|
10
|
+
it 'delete current' do
|
11
|
+
expect(File.exist?(current_dir)).not_to be_truthy
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'different version' do
|
16
|
+
before :all do
|
17
|
+
version = VERSION1
|
18
|
+
Nvvm::Switcher.new(version).use
|
19
|
+
@src_dir = src_dir(version)
|
20
|
+
@current = current_dir
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'exist current' do
|
24
|
+
expect(File.exist?(@current)).to be_truthy
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'switch current' do
|
28
|
+
expect(File.readlink(@current)).to eq @src_dir
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context 'unknown version' do
|
33
|
+
before :all do
|
34
|
+
@switcher = Nvvm::Switcher.new('v0.1.0')
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'raise error' do
|
38
|
+
expect(proc { @switcher.use }).to raise_error SystemExit
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Uninstaller' do
|
4
|
+
describe 'uninstall' do
|
5
|
+
context 'Neovim version is currently used' do
|
6
|
+
before :all do
|
7
|
+
version = VERSION1
|
8
|
+
Nvvm::Switcher.new(version).use
|
9
|
+
@uninstaller = Nvvm::Uninstaller.new(version)
|
10
|
+
end
|
11
|
+
|
12
|
+
after :all do
|
13
|
+
Nvvm::Switcher.new('system').use
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'raise error' do
|
17
|
+
expect(proc { @uninstaller.uninstall }).to raise_error SystemExit
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
context 'can uninstall version' do
|
22
|
+
before :all do
|
23
|
+
@version = VERSION1
|
24
|
+
Nvvm::Switcher.new('system').use
|
25
|
+
Nvvm::Uninstaller.new(@version).uninstall
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'delete src dir' do
|
29
|
+
expect(File.exist?(src_dir(@version))).not_to be_truthy
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,292 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Validator' do
|
4
|
+
include Nvvm::Validator
|
5
|
+
|
6
|
+
NEW_VERSION = 'v0.2.2'.freeze
|
7
|
+
|
8
|
+
describe 'validate_before_invoke' do
|
9
|
+
before do
|
10
|
+
allow(Nvvm::Validator).to receive(:new_version?).and_return(true)
|
11
|
+
allow(Nvvm::Validator).to receive(:installed_version?).and_return(true)
|
12
|
+
allow(Nvvm::Validator).to receive(:version?).and_return(true)
|
13
|
+
allow(Nvvm::Validator).to receive(:git?).and_return(true)
|
14
|
+
end
|
15
|
+
|
16
|
+
context 'install' do
|
17
|
+
it 'version?' do
|
18
|
+
expect(Nvvm::Validator).to receive(:version?).with(no_args)
|
19
|
+
Nvvm::Validator.validate_before_invoke('install')
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'git?' do
|
23
|
+
expect(Nvvm::Validator).to receive(:git?).with(no_args)
|
24
|
+
Nvvm::Validator.validate_before_invoke('install')
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'new_version?' do
|
28
|
+
expect(Nvvm::Validator).to receive(:new_version?).with(no_args)
|
29
|
+
Nvvm::Validator.validate_before_invoke('install')
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'installed_version?' do
|
33
|
+
expect(Nvvm::Validator).not_to receive(:installed_version?).with(no_args)
|
34
|
+
Nvvm::Validator.validate_before_invoke('install')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context 'reinstall' do
|
39
|
+
it 'version?' do
|
40
|
+
expect(Nvvm::Validator).not_to receive(:version?).with(no_args)
|
41
|
+
Nvvm::Validator.validate_before_invoke('reinstall')
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'git?' do
|
45
|
+
expect(Nvvm::Validator).to receive(:git?).with(no_args)
|
46
|
+
Nvvm::Validator.validate_before_invoke('reinstall')
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'new_version?' do
|
50
|
+
expect(Nvvm::Validator).not_to receive(:new_version?).with(no_args)
|
51
|
+
Nvvm::Validator.validate_before_invoke('reinstall')
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'installed_version?' do
|
55
|
+
expect(Nvvm::Validator).to receive(:installed_version?).with(no_args)
|
56
|
+
Nvvm::Validator.validate_before_invoke('reinstall')
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'rebuild' do
|
61
|
+
it 'version?' do
|
62
|
+
expect(Nvvm::Validator).to receive(:version?).with(no_args)
|
63
|
+
Nvvm::Validator.validate_before_invoke('rebuild')
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'git?' do
|
67
|
+
expect(Nvvm::Validator).to receive(:git?).with(no_args)
|
68
|
+
Nvvm::Validator.validate_before_invoke('rebuild')
|
69
|
+
end
|
70
|
+
|
71
|
+
it 'new_version?' do
|
72
|
+
expect(Nvvm::Validator).not_to receive(:new_version?).with(no_args)
|
73
|
+
Nvvm::Validator.validate_before_invoke('rebuild')
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'installed_version?' do
|
77
|
+
expect(Nvvm::Validator).to receive(:installed_version?).with(no_args)
|
78
|
+
Nvvm::Validator.validate_before_invoke('rebuild')
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
context 'use' do
|
83
|
+
it 'version?' do
|
84
|
+
expect(Nvvm::Validator).to receive(:version?).with(no_args)
|
85
|
+
Nvvm::Validator.validate_before_invoke('use')
|
86
|
+
end
|
87
|
+
|
88
|
+
it 'git?' do
|
89
|
+
expect(Nvvm::Validator).not_to receive(:git?).with(no_args)
|
90
|
+
Nvvm::Validator.validate_before_invoke('use')
|
91
|
+
end
|
92
|
+
|
93
|
+
it 'new_version?' do
|
94
|
+
expect(Nvvm::Validator).not_to receive(:new_version?).with(no_args)
|
95
|
+
Nvvm::Validator.validate_before_invoke('use')
|
96
|
+
end
|
97
|
+
|
98
|
+
it 'installed_version?' do
|
99
|
+
expect(Nvvm::Validator).to receive(:installed_version?).with(no_args)
|
100
|
+
Nvvm::Validator.validate_before_invoke('use')
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
context 'list' do
|
105
|
+
it 'version?' do
|
106
|
+
expect(Nvvm::Validator).not_to receive(:version?).with(no_args)
|
107
|
+
Nvvm::Validator.validate_before_invoke('list')
|
108
|
+
end
|
109
|
+
|
110
|
+
it 'git?' do
|
111
|
+
expect(Nvvm::Validator).to receive(:git?).with(no_args)
|
112
|
+
Nvvm::Validator.validate_before_invoke('list')
|
113
|
+
end
|
114
|
+
|
115
|
+
it 'new_version?' do
|
116
|
+
expect(Nvvm::Validator).not_to receive(:new_version?).with(no_args)
|
117
|
+
Nvvm::Validator.validate_before_invoke('list')
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'installed_version?' do
|
121
|
+
expect(Nvvm::Validator).not_to receive(:installed_version?).with(no_args)
|
122
|
+
Nvvm::Validator.validate_before_invoke('list')
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
context 'versions' do
|
127
|
+
it 'version?' do
|
128
|
+
expect(Nvvm::Validator).not_to receive(:version?).with(no_args)
|
129
|
+
Nvvm::Validator.validate_before_invoke('versions')
|
130
|
+
end
|
131
|
+
|
132
|
+
it 'git?' do
|
133
|
+
expect(Nvvm::Validator).not_to receive(:git?).with(no_args)
|
134
|
+
Nvvm::Validator.validate_before_invoke('versions')
|
135
|
+
end
|
136
|
+
|
137
|
+
it 'new_version?' do
|
138
|
+
expect(Nvvm::Validator).not_to receive(:new_version?).with(no_args)
|
139
|
+
Nvvm::Validator.validate_before_invoke('versions')
|
140
|
+
end
|
141
|
+
|
142
|
+
it 'installed_version?' do
|
143
|
+
expect(Nvvm::Validator).not_to receive(:installed_version?).with(no_args)
|
144
|
+
Nvvm::Validator.validate_before_invoke('versions')
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
context 'uninstall' do
|
149
|
+
it 'version?' do
|
150
|
+
expect(Nvvm::Validator).to receive(:version?).with(no_args)
|
151
|
+
Nvvm::Validator.validate_before_invoke('uninstall')
|
152
|
+
end
|
153
|
+
|
154
|
+
it 'git?' do
|
155
|
+
expect(Nvvm::Validator).not_to receive(:git?).with(no_args)
|
156
|
+
Nvvm::Validator.validate_before_invoke('uninstall')
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'new_version?' do
|
160
|
+
expect(Nvvm::Validator).not_to receive(:new_version?).with(no_args)
|
161
|
+
Nvvm::Validator.validate_before_invoke('uninstall')
|
162
|
+
end
|
163
|
+
|
164
|
+
it 'installed_version?' do
|
165
|
+
expect(Nvvm::Validator).to receive(:installed_version?).with(no_args)
|
166
|
+
Nvvm::Validator.validate_before_invoke('uninstall')
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
describe 'git?' do
|
172
|
+
context 'git is installed' do
|
173
|
+
before { allow(Nvvm::Validator).to receive(:find_executable).and_return(true) }
|
174
|
+
|
175
|
+
it 'success to run the method' do
|
176
|
+
expect(Nvvm::Validator.git?).to be_truthy
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
context 'git is not installed' do
|
181
|
+
before { allow(Nvvm::Validator).to receive(:find_executable).and_return(false) }
|
182
|
+
|
183
|
+
it 'cannot run the method' do
|
184
|
+
expect(proc { Nvvm::Validator.git? }).to raise_error SystemExit
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
describe 'version?' do
|
190
|
+
before(:all) { $* << %w[nvvm install] }
|
191
|
+
|
192
|
+
context 'available tag' do
|
193
|
+
before(:all) { $*[2] = NEW_VERSION }
|
194
|
+
|
195
|
+
it 'success to run the method' do
|
196
|
+
expect(version?).to be_truthy
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
context 'latest' do
|
201
|
+
before(:all) { $*[2] = 'latest' }
|
202
|
+
|
203
|
+
it 'success to run the method' do
|
204
|
+
expect(version?).to be_truthy
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
context 'tag is not available' do
|
209
|
+
before(:all) { $*[2] = '--use' }
|
210
|
+
|
211
|
+
it 'cannot run the method' do
|
212
|
+
expect(proc { version? }).to raise_error SystemExit
|
213
|
+
end
|
214
|
+
end
|
215
|
+
end
|
216
|
+
|
217
|
+
describe 'new_version?' do
|
218
|
+
before do
|
219
|
+
allow(Nvvm::Installer).to receive(:pull).and_return(true)
|
220
|
+
end
|
221
|
+
|
222
|
+
context 'with arg' do
|
223
|
+
context 'new version' do
|
224
|
+
it 'success to run the method' do
|
225
|
+
expect(new_version?(NEW_VERSION)).to be_truthy
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
context 'version is installed' do
|
230
|
+
it 'cannot run the method' do
|
231
|
+
expect(proc { new_version?(VERSION1) }).to raise_error SystemExit
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
context 'without arg' do
|
237
|
+
before(:all) { $* << %w[nvvm install] }
|
238
|
+
|
239
|
+
context 'new version' do
|
240
|
+
before(:all) { $*[2] = NEW_VERSION }
|
241
|
+
|
242
|
+
it 'success to run the method' do
|
243
|
+
expect(new_version?).to be_truthy
|
244
|
+
end
|
245
|
+
end
|
246
|
+
|
247
|
+
context 'version is installed' do
|
248
|
+
before(:all) { $*[2] = VERSION1 }
|
249
|
+
|
250
|
+
it 'cannot run the method' do
|
251
|
+
expect(proc { new_version? }).to raise_error SystemExit
|
252
|
+
end
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
describe 'installed_version?' do
|
258
|
+
context 'with arg' do
|
259
|
+
context 'version is installed' do
|
260
|
+
it 'success to run the method' do
|
261
|
+
expect(installed_version?(VERSION1)).to be_truthy
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
265
|
+
context 'version is not installed' do
|
266
|
+
it 'cannot run the method' do
|
267
|
+
expect(proc { installed_version?(NEW_VERSION) }).to raise_error SystemExit
|
268
|
+
end
|
269
|
+
end
|
270
|
+
end
|
271
|
+
|
272
|
+
context 'without arg' do
|
273
|
+
before(:all) { $* << %w[nvvm install] }
|
274
|
+
|
275
|
+
context 'version is installed' do
|
276
|
+
before(:all) { $*[2] = VERSION1 }
|
277
|
+
|
278
|
+
it 'success to run the method' do
|
279
|
+
expect(installed_version?).to be_truthy
|
280
|
+
end
|
281
|
+
end
|
282
|
+
|
283
|
+
context 'version is not installed' do
|
284
|
+
before(:all) { $*[2] = NEW_VERSION }
|
285
|
+
|
286
|
+
it 'cannot run the method' do
|
287
|
+
expect(proc { installed_version? }).to raise_error SystemExit
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|
292
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'tmpdir'
|
4
|
+
|
5
|
+
describe 'Version' do
|
6
|
+
describe 'list' do
|
7
|
+
it 'repo_dir not found' do
|
8
|
+
allow(File).to receive(:exist?).and_return(false)
|
9
|
+
expect(proc { Nvvm::Version.list }).to raise_error SystemExit
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'echo available vim versions' do
|
13
|
+
expect(Nvvm::Version.list.join("\n")).to match(/\Anightly\n(v\d\..+(\n){0,1})+\z/)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'versions' do
|
18
|
+
context 'src dirctory exists' do
|
19
|
+
it 'echo installed vim versions' do
|
20
|
+
expect(Nvvm::Version.versions.join("\n")).to eq "#{VERSION2}\n#{VERSION1}"
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'echo installed vim versions without current' do
|
24
|
+
Nvvm::Switcher.new(VERSION1).use
|
25
|
+
expect(Nvvm::Version.versions.join("\n")).to eq "#{VERSION2}\n#{VERSION1}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
context 'src dirctory is not found' do
|
29
|
+
before do
|
30
|
+
@tmp_vvmroot = ENV['NVVMROOT']
|
31
|
+
@tmp2 = Dir.mktmpdir
|
32
|
+
ENV['NVVMROOT'] = @tmp2
|
33
|
+
end
|
34
|
+
|
35
|
+
after do
|
36
|
+
ENV['NVVMROOT'] = @tmp_vvmroot
|
37
|
+
FileUtils.rm_rf(@tmp2)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'echo nothing' do
|
41
|
+
expect(Nvvm::Version.versions).to eq []
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
describe 'latest' do
|
47
|
+
it 'return latest vim version' do
|
48
|
+
expect(Nvvm::Version.latest).to match(/\Av\d\..+\z/)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe 'current' do
|
53
|
+
context 'current version is system' do
|
54
|
+
before { Nvvm::Switcher.new('system').use }
|
55
|
+
it 'return current vim version' do
|
56
|
+
expect(Nvvm::Version.current).to eq 'system'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
context 'current version is not system' do
|
61
|
+
before { Nvvm::Switcher.new(VERSION1).use }
|
62
|
+
it 'return current vim version' do
|
63
|
+
expect(Nvvm::Version.current).to eq VERSION1
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe 'convert' do
|
69
|
+
it 'version to tag' do
|
70
|
+
expect(Nvvm::Version.convert('0.2.2')).to eq 'v0.2.2'
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe 'format' do
|
75
|
+
context 'tag' do
|
76
|
+
it 'return formated vim version' do
|
77
|
+
expect(Nvvm::Version.format('v0.2.2')).to eq 'v0.2.2'
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
context 'dicimal version' do
|
82
|
+
it 'return formated vim version' do
|
83
|
+
expect(Nvvm::Version.format('0.2.2')).to eq 'v0.2.2'
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context 'latest' do
|
88
|
+
it 'return latest vim version' do
|
89
|
+
expect(Nvvm::Version.format('latest')).to match(/\Av\d\..+\z/)
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|