mirror of
https://github.com/dense-analysis/ale.git
synced 2026-02-08 02:41:05 +08:00
* Move FindRailsRoot() to more general location * Add rails_best_practices handler (resolves #655) * Update documentation for rails_best_practices Also add brakeman to *ale* documentation. * rails_best_practices: allow overriding the executable * rails_best_practices: format help correctly * rails_best_practices: capture tool output on Windows
This commit is contained in:
22
autoload/ale/ruby.vim
Normal file
22
autoload/ale/ruby.vim
Normal file
@@ -0,0 +1,22 @@
|
||||
" 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 !=# '.'
|
||||
\&& isdirectory(l:dir . '/app')
|
||||
\&& isdirectory(l:dir . '/config')
|
||||
\&& isdirectory(l:dir . '/db')
|
||||
return l:dir
|
||||
endif
|
||||
endfor
|
||||
|
||||
return ''
|
||||
endfunction
|
||||
Reference in New Issue
Block a user