Make IsVersionAtLeast global

This commit is contained in:
Richard Brown 2012-09-22 19:51:12 +01:00
parent a71048daac
commit 87f10e54d4
2 changed files with 15 additions and 15 deletions

View File

@ -500,6 +500,19 @@ function! SyntasticCheckable(ft)
return exists("*SyntaxCheckers_". a:ft ."_GetLocList")
endfunction
"the args must be arrays of the form [major, minor, macro]
function SyntasticIsVersionAtLeast(installed, required)
if a:installed[0] != a:required[0]
return a:installed[0] > a:required[0]
endif
if a:installed[1] != a:required[1]
return a:installed[1] > a:required[1]
endif
return a:installed[2] >= a:required[2]
endfunction
"return a string representing the state of buffer according to
"g:syntastic_stl_format
"

View File

@ -50,21 +50,8 @@ function! s:PuppetLintVersion()
return s:puppet_lint_version
endfunction
"the args must be arrays of the form [major, minor, macro]
function s:IsVersionAtLeast(installed, required)
if a:installed[0] != a:required[0]
return a:installed[0] > a:required[0]
endif
if a:installed[1] != a:required[1]
return a:installed[1] > a:required[1]
endif
return a:installed[2] >= a:required[2]
endfunction
if !g:syntastic_puppet_lint_disable
if !s:IsVersionAtLeast(s:PuppetLintVersion(), [0,1,10])
if !SyntasticIsVersionAtLeast(s:PuppetLintVersion(), [0,1,10])
let g:syntastic_puppet_lint_disable = 1
endif
end
@ -81,7 +68,7 @@ endfunction
function! s:getPuppetMakeprg()
"If puppet is >= version 2.7 then use the new executable
if s:IsVersionAtLeast(s:PuppetVersion(), [2,7,0])
if SyntasticIsVersionAtLeast(s:PuppetVersion(), [2,7,0])
let makeprg = 'puppet parser validate ' .
\ shellescape(expand('%')) .
\ ' --color=false'