Undo most of the changes to eruby/ruby.

The new proprocess option is not useful here.
This commit is contained in:
LCD 47 2013-08-01 17:26:51 +03:00
parent af513ff680
commit 4abed35797

View File

@ -15,34 +15,37 @@ if exists("g:loaded_syntastic_eruby_ruby_checker")
endif endif
let g:loaded_syntastic_eruby_ruby_checker=1 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") if !exists("g:syntastic_ruby_exec")
let g:syntastic_ruby_exec = "ruby" let g:syntastic_ruby_exec = "ruby"
endif endif
function! SyntaxCheckers_eruby_ruby_IsAvailable() function! SyntaxCheckers_eruby_ruby_IsAvailable()
return executable(expand(g:syntastic_erb_exec)) && executable(expand(g:syntastic_ruby_exec)) return 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
endfunction endfunction
function! SyntaxCheckers_eruby_ruby_GetLocList() function! SyntaxCheckers_eruby_ruby_GetLocList()
" TODO: do something about the encoding let exe = expand(g:syntastic_ruby_exec)
let makeprg = syntastic#makeprg#build({ if !has('win32')
\ 'exe': expand(g:syntastic_erb_exec), let exe = 'RUBYOPT= ' . exe
\ 'args': '-x -T -', endif
\ 'tail': ' | ' . expand(g:syntastic_ruby_exec) . ' -c',
\ 'filetype': 'eruby', let fname = "'" . escape(expand('%'), "\\'") . "'"
\ 'subchecker': 'ruby' })
" 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 = let errorformat =
\ '%-GSyntax OK,'. \ '%-GSyntax OK,'.
@ -54,7 +57,6 @@ function! SyntaxCheckers_eruby_ruby_GetLocList()
return SyntasticMake({ return SyntasticMake({
\ 'makeprg': makeprg, \ 'makeprg': makeprg,
\ 'errorformat': errorformat, \ 'errorformat': errorformat,
\ 'preprocess': 'SyntaxCheckers_eruby_ruby_Preprocess',
\ 'defaults': { 'bufnr': bufnr(""), 'vcol': 1 } }) \ 'defaults': { 'bufnr': bufnr(""), 'vcol': 1 } })
endfunction endfunction