mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Improve Ruby version check in CheckHealth command
Compare current version number to that of the latest released neovim rubygem, rather than a hard-coded version. Note: The `gem list` command introduced here adds about 4 seconds to the execution time of the CheckHealth command.
This commit is contained in:
parent
e75e9c10dc
commit
d61a50758c
@ -403,7 +403,6 @@ endfunction
|
|||||||
|
|
||||||
function! s:check_ruby() abort
|
function! s:check_ruby() abort
|
||||||
call health#report_start('Ruby provider')
|
call health#report_start('Ruby provider')
|
||||||
let min_version = "0.2.4"
|
|
||||||
let ruby_version = systemlist('ruby -v')[0]
|
let ruby_version = systemlist('ruby -v')[0]
|
||||||
let ruby_prog = provider#ruby#Detect()
|
let ruby_prog = provider#ruby#Detect()
|
||||||
let suggestions =
|
let suggestions =
|
||||||
@ -414,15 +413,20 @@ function! s:check_ruby() abort
|
|||||||
let prog_vers = 'not found'
|
let prog_vers = 'not found'
|
||||||
call health#report_error('Missing Neovim RubyGem', suggestions)
|
call health#report_error('Missing Neovim RubyGem', suggestions)
|
||||||
else
|
else
|
||||||
|
silent let latest_gem = get(systemlist("gem list -ra '^neovim$' 2>/dev/null | " .
|
||||||
|
\ "awk -F'[()]' '{print $2}' | " .
|
||||||
|
\ 'cut -d, -f1'), 0, 'not found')
|
||||||
|
let latest_desc = ' (latest: ' . latest_gem . ')'
|
||||||
|
|
||||||
silent let prog_vers = systemlist(ruby_prog . ' --version')[0]
|
silent let prog_vers = systemlist(ruby_prog . ' --version')[0]
|
||||||
if v:shell_error
|
if v:shell_error
|
||||||
let prog_vers = 'outdated'
|
let prog_vers = 'not found' . latest_desc
|
||||||
call health#report_warn('Neovim RubyGem is not up-to-date', suggestions)
|
call health#report_warn('Neovim RubyGem is not up-to-date.', suggestions)
|
||||||
elseif s:version_cmp(prog_vers, min_version) == -1
|
elseif s:version_cmp(prog_vers, latest_gem) == -1
|
||||||
let prog_vers .= ' (outdated)'
|
let prog_vers .= latest_desc
|
||||||
call health#report_warn('Neovim RubyGem is not up-to-date', suggestions)
|
call health#report_warn('Neovim RubyGem is not up-to-date.', suggestions)
|
||||||
else
|
else
|
||||||
call health#report_ok('Found Neovim RubyGem')
|
call health#report_ok('Found up-to-date neovim RubyGem')
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user