match the output to find out the status

- rename statuses to be:
* error
* uptodate
* updated
This commit is contained in:
gmarik 2011-08-04 21:05:48 -05:00
parent 6c6efeeee5
commit d37ab79841

View File

@ -52,10 +52,10 @@ func! vundle#installer#install(bang, name) abort
redraw! redraw!
if 0 == err_code if 0 == err_code
if 'ok' == status if 'updated' == status
echo b.name.' installed' echo b.name.' installed'
exe ":sign place ".line('.')." line=".line('.')." name=VuOk buffer=" . bufnr("$") exe ":sign place ".line('.')." line=".line('.')." name=VuOk buffer=" . bufnr("$")
elseif 'skip' == status elseif 'uptodate' == status
echo b.name.' already installed' echo b.name.' already installed'
exe ":sign place ".line('.')." line=".line('.')." name=VuOk buffer=" . bufnr("$") exe ":sign place ".line('.')." line=".line('.')." name=VuOk buffer=" . bufnr("$")
endif endif
@ -117,7 +117,7 @@ endf
func! s:sync(bang, bundle) abort func! s:sync(bang, bundle) abort
let git_dir = expand(a:bundle.path().'/.git/') let git_dir = expand(a:bundle.path().'/.git/')
if isdirectory(git_dir) if isdirectory(git_dir)
if !(a:bang) | return [0, 'skip'] | endif if !(a:bang) | return [0, 'uptodate'] | endif
let cmd = 'cd '.shellescape(a:bundle.path()).' && git pull' let cmd = 'cd '.shellescape(a:bundle.path()).' && git pull'
if (has('win32') || has('win64')) if (has('win32') || has('win64'))
@ -128,17 +128,23 @@ func! s:sync(bang, bundle) abort
let cmd = 'git clone '.a:bundle.uri.' '.shellescape(a:bundle.path()) let cmd = 'git clone '.a:bundle.uri.' '.shellescape(a:bundle.path())
endif endif
call s:system(cmd) let out = s:system(cmd)
if 0 != v:shell_error if 0 != v:shell_error
return [v:shell_error, 'error'] return [v:shell_error, 'error']
end end
return [0, 'ok']
if out =~# 'up-to-date'
return [0, 'uptodate']
end
return [0, 'updated']
endf endf
func! s:system(cmd) abort func! s:system(cmd) abort
let output = system(a:cmd) let output = system(a:cmd)
call s:log(output) call s:log(output)
return output
endf endf
func! s:log(str) abort func! s:log(str) abort