1
0
Fork 0
mirror of synced 2024-11-18 23:05:34 -05:00
ultimate-vim/sources_non_forked/ale/autoload/ale/ruby.vim
2018-03-31 11:55:20 -03:00

22 lines
651 B
VimL

" Author: Eddie Lebow https://github.com/elebow
" Description: Functions for integrating with Ruby tools
" Find the nearest dir contining "app", "db", and "config", and assume it is
" the root of a Rails app.
function! ale#ruby#FindRailsRoot(buffer) abort
for l:name in ['app', 'config', 'db']
let l:dir = fnamemodify(
\ ale#path#FindNearestDirectory(a:buffer, l:name),
\ ':h:h'
\)
if l:dir isnot# '.'
\&& isdirectory(l:dir . '/app')
\&& isdirectory(l:dir . '/config')
\&& isdirectory(l:dir . '/db')
return l:dir
endif
endfor
return ''
endfunction