Created
September 19, 2013 16:00
-
-
Save eagletmt/6625643 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let s:hook = { | |
\ 'kind': 'hook', | |
\ 'name': 'bundler', | |
\ } | |
function! s:hook.on_module_loaded(session, context) | |
if a:session.config.type !=# 'ruby' | |
return | |
endif | |
if !executable('bundle') | |
return | |
endif | |
let l:lines = split(system(printf('cd %s; ruby -rbundler/shared_helpers -e "puts Bundler::SharedHelpers.in_bundle?"', expand('%:h'))), '\n') | |
if v:shell_error == 0 && !empty(l:lines) && filereadable(l:lines[0]) | |
let a:session.config.exec = 'env BUNDLE_GEMFILE=' . shellescape(l:lines[0]) . ' bundle exec %C %s' | |
endif | |
endfunction | |
call quickrun#module#register(s:hook) | |
unlet s:hook |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment