Skip to content

Commit fc156c6

Browse files
committed
Run :Rails with rails compiler
1 parent db12c6d commit fc156c6

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

autoload/rails.vim

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,10 +1651,20 @@ function! s:app_script_command(bang,...) dict
16511651
return
16521652
endif
16531653
let str = join(map(copy(a:000), 's:rquote(v:val)'), ' ')
1654-
if a:bang || str =~# '^\%(c\|console\|db\|dbconsole\|s\|server\)\>'
1654+
if str =~# '^\%(c\|console\|db\|dbconsole\|s\|server\)\S\@!' && str !~# ' -d\| --daemon\| --help'
16551655
return self.start_rails_command(str, a:bang)
16561656
else
1657-
return self.execute_rails_command(str)
1657+
let [mp, efm, cc] = [&l:mp, &l:efm, get(b:, 'current_compiler', '')]
1658+
try
1659+
compiler rails
1660+
let &l:makeprg = self.prepare_rails_command(str)
1661+
let &l:errorformat .= ',chdir '.escape(self.path(), ',')
1662+
call s:make(a:bang, '')
1663+
finally
1664+
let [&l:mp, &l:efm, b:current_compiler] = [mp, efm, cc]
1665+
if empty(cc) | unlet! b:current_compiler | endif
1666+
endtry
1667+
return ''
16581668
endif
16591669
endfunction
16601670

0 commit comments

Comments
 (0)