summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEddie Lebow <elebow@users.noreply.github.com>2017-11-16 23:02:30 -0500
committerEddie Lebow <elebow@users.noreply.github.com>2017-11-16 23:10:25 -0500
commitb390c696424f51b0d8a198ce252ae14d0b0cd8aa (patch)
treeca1ad27977580bb107b51b9177f98a2873ec4fd6
parent1f4f19cbd422e30ae95e63df6fae26d99651dc03 (diff)
downloadale-b390c696424f51b0d8a198ce252ae14d0b0cd8aa.zip
erb, erubis: Redirect file into first command.
The previous version relied on a zsh-specific behavior where `<filename` after a pipe could redirect to the first command. This is the standard way to do it.
-rw-r--r--ale_linters/eruby/erb.vim2
-rw-r--r--ale_linters/eruby/erubis.vim2
-rw-r--r--test/command_callback/test_erb_command_callback.vader2
-rw-r--r--test/command_callback/test_erubis_command_callback.vader2
4 files changed, 4 insertions, 4 deletions
diff --git a/ale_linters/eruby/erb.vim b/ale_linters/eruby/erb.vim
index 5d0b4003..65de18ee 100644
--- a/ale_linters/eruby/erb.vim
+++ b/ale_linters/eruby/erb.vim
@@ -11,7 +11,7 @@ function! ale_linters#eruby#erb#GetCommand(buffer) abort
" Rails-flavored eRuby does not comply with the standard as understood by
" ERB, so we'll have to do some substitution. This does not reduce the
" effectiveness of the linter—the translated code is still evaluated.
- return 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . ' | ruby -c'
+ return 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c'
endfunction
call ale#linter#Define('eruby', {
diff --git a/ale_linters/eruby/erubis.vim b/ale_linters/eruby/erubis.vim
index ac356aeb..c9c8ac1e 100644
--- a/ale_linters/eruby/erubis.vim
+++ b/ale_linters/eruby/erubis.vim
@@ -11,7 +11,7 @@ function! ale_linters#eruby#erubis#GetCommand(buffer) abort
" Rails-flavored eRuby does not comply with the standard as understood by
" Erubis, so we'll have to do some substitution. This does not reduce the
" effectiveness of the linter—the translated code is still evaluated.
- return 'ruby -r erubis -e ' . ale#Escape('puts Erubis::Eruby.new($stdin.read.gsub(%{<%=},%{<%})).src') . ' | ruby -c'
+ return 'ruby -r erubis -e ' . ale#Escape('puts Erubis::Eruby.new($stdin.read.gsub(%{<%=},%{<%})).src') . '< %t | ruby -c'
endfunction
call ale#linter#Define('eruby', {
diff --git a/test/command_callback/test_erb_command_callback.vader b/test/command_callback/test_erb_command_callback.vader
index 2cfff7ed..9b1d223c 100644
--- a/test/command_callback/test_erb_command_callback.vader
+++ b/test/command_callback/test_erb_command_callback.vader
@@ -17,5 +17,5 @@ Execute(Executable should filter invalid eRuby when inside a Rails project):
call ale#test#SetFilename('../ruby_fixtures/valid_rails_app/app/views/my_great_view.html.erb')
AssertEqual
- \ 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . ' | ruby -c',
+ \ 'ruby -r erb -e ' . ale#Escape('puts ERB.new($stdin.read.gsub(%{<%=},%{<%}), nil, %{-}).src') . '< %t | ruby -c',
\ ale_linters#eruby#erb#GetCommand(bufnr(''))
diff --git a/test/command_callback/test_erubis_command_callback.vader b/test/command_callback/test_erubis_command_callback.vader
index 68624ec6..574dd684 100644
--- a/test/command_callback/test_erubis_command_callback.vader
+++ b/test/command_callback/test_erubis_command_callback.vader
@@ -17,5 +17,5 @@ Execute(Executable should filter invalid eRuby when inside a Rails project):
call ale#test#SetFilename('../ruby_fixtures/valid_rails_app/app/views/my_great_view.html.erb')
AssertEqual
- \ 'ruby -r erubis -e ' . ale#Escape('puts Erubis::Eruby.new($stdin.read.gsub(%{<%=},%{<%})).src') . ' | ruby -c',
+ \ 'ruby -r erubis -e ' . ale#Escape('puts Erubis::Eruby.new($stdin.read.gsub(%{<%=},%{<%})).src') . '< %t | ruby -c',
\ ale_linters#eruby#erubis#GetCommand(bufnr(''))