Undo most of the changes to eruby/ruby.
The new proprocess option is not useful here.
This commit is contained in:
parent
af513ff680
commit
4abed35797
@ -15,34 +15,37 @@ if exists("g:loaded_syntastic_eruby_ruby_checker")
|
||||
endif
|
||||
let g:loaded_syntastic_eruby_ruby_checker=1
|
||||
|
||||
if !exists("g:syntastic_erb_exec")
|
||||
let g:syntastic_erb_exec = "erb"
|
||||
endif
|
||||
|
||||
if !exists("g:syntastic_ruby_exec")
|
||||
let g:syntastic_ruby_exec = "ruby"
|
||||
endif
|
||||
|
||||
function! SyntaxCheckers_eruby_ruby_IsAvailable()
|
||||
return executable(expand(g:syntastic_erb_exec)) && executable(expand(g:syntastic_ruby_exec))
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_eruby_ruby_Preprocess(errors)
|
||||
let out = copy(a:errors)
|
||||
for n in range(len(out))
|
||||
let out[n] = substitute(out[n], '\V<%=', '<%', 'g')
|
||||
endfor
|
||||
return out
|
||||
return executable(expand(g:syntastic_ruby_exec))
|
||||
endfunction
|
||||
|
||||
function! SyntaxCheckers_eruby_ruby_GetLocList()
|
||||
" TODO: do something about the encoding
|
||||
let makeprg = syntastic#makeprg#build({
|
||||
\ 'exe': expand(g:syntastic_erb_exec),
|
||||
\ 'args': '-x -T -',
|
||||
\ 'tail': ' | ' . expand(g:syntastic_ruby_exec) . ' -c',
|
||||
\ 'filetype': 'eruby',
|
||||
\ 'subchecker': 'ruby' })
|
||||
let exe = expand(g:syntastic_ruby_exec)
|
||||
if !has('win32')
|
||||
let exe = 'RUBYOPT= ' . exe
|
||||
endif
|
||||
|
||||
let fname = "'" . escape(expand('%'), "\\'") . "'"
|
||||
|
||||
" TODO: encodings became useful in ruby 1.9 :)
|
||||
if syntastic#util#versionIsAtLeast(syntastic#util#parseVersion('ruby --version'), [1, 9])
|
||||
let enc = &fileencoding != '' ? &fileencoding : &encoding
|
||||
let encoding_spec = ', :encoding => "' . (enc ==? 'utf-8' ? 'UTF-8' : 'BINARY') . '"'
|
||||
else
|
||||
let encoding_spec = ''
|
||||
endif
|
||||
|
||||
"gsub fixes issue #7, rails has it's own eruby syntax
|
||||
let makeprg =
|
||||
\ exe . ' -rerb -e ' .
|
||||
\ syntastic#util#shescape('puts ERB.new(File.read(' .
|
||||
\ fname . encoding_spec .
|
||||
\ ').gsub(''<%='',''<%''), nil, ''-'').src') .
|
||||
\ ' | ' . exe . ' -c'
|
||||
|
||||
let errorformat =
|
||||
\ '%-GSyntax OK,'.
|
||||
@ -54,7 +57,6 @@ function! SyntaxCheckers_eruby_ruby_GetLocList()
|
||||
return SyntasticMake({
|
||||
\ 'makeprg': makeprg,
|
||||
\ 'errorformat': errorformat,
|
||||
\ 'preprocess': 'SyntaxCheckers_eruby_ruby_Preprocess',
|
||||
\ 'defaults': { 'bufnr': bufnr(""), 'vcol': 1 } })
|
||||
endfunction
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user