|
|
@ -1,5 +1,5 @@ |
|
|
func! vundle#config#bundle(arg, ...) |
|
|
|
|
|
let bundle = vundle#config#init_bundle(a:arg, a:000) |
|
|
|
|
|
|
|
|
func! vundle#config#bundle(bang, arg, ...) abort |
|
|
|
|
|
let bundle = vundle#config#init_bundle(a:bang, a:arg, a:000) |
|
|
call s:rtp_rm_a() |
|
|
call s:rtp_rm_a() |
|
|
call add(g:vundle#bundles, bundle) |
|
|
call add(g:vundle#bundles, bundle) |
|
|
call s:rtp_add_a() |
|
|
call s:rtp_add_a() |
|
|
@ -22,20 +22,25 @@ func! vundle#config#require(bundles) abort |
|
|
endfor |
|
|
endfor |
|
|
endf |
|
|
endf |
|
|
|
|
|
|
|
|
func! vundle#config#init_bundle(name, opts) |
|
|
|
|
|
let opts = extend(s:parse_options(a:opts), s:parse_name(substitute(a:name,"['".'"]\+','','g'))) |
|
|
|
|
|
|
|
|
func! vundle#config#init_bundle(bang, name, opts) |
|
|
|
|
|
let opts = extend(s:parse_options(a:bang, a:opts), s:parse_name(substitute(a:name,"['".'"]\+','','g')),'keep') |
|
|
return extend(opts, copy(s:bundle)) |
|
|
return extend(opts, copy(s:bundle)) |
|
|
endf |
|
|
endf |
|
|
|
|
|
|
|
|
func! s:parse_options(opts) |
|
|
|
|
|
" TODO: improve this |
|
|
|
|
|
if len(a:opts) != 1 | return {} | endif |
|
|
|
|
|
|
|
|
func! s:parse_options(bang, opts) |
|
|
|
|
|
if len(a:opts) != 1 |
|
|
|
|
|
let opts = {} |
|
|
|
|
|
elseif type(a:opts[0]) == type({}) |
|
|
|
|
|
let opts = a:opts[0] |
|
|
|
|
|
elseif type(a:opts[0]) == type('') |
|
|
|
|
|
let opts = {'rev': a:opts[0]} |
|
|
|
|
|
endif |
|
|
|
|
|
|
|
|
if type(a:opts[0]) == type({}) |
|
|
|
|
|
return a:opts[0] |
|
|
|
|
|
else |
|
|
|
|
|
return {'rev': a:opts[0]} |
|
|
|
|
|
|
|
|
if a:bang |
|
|
|
|
|
let opts = extend({'sync':'no'}, opts) |
|
|
endif |
|
|
endif |
|
|
|
|
|
|
|
|
|
|
|
return opts |
|
|
endf |
|
|
endf |
|
|
|
|
|
|
|
|
func! s:parse_name(arg) |
|
|
func! s:parse_name(arg) |
|
|
@ -47,6 +52,7 @@ func! s:parse_name(arg) |
|
|
elseif arg =~? '^\s*\(git@\|git://\)\S\+' |
|
|
elseif arg =~? '^\s*\(git@\|git://\)\S\+' |
|
|
\ || arg =~? '(file|https\?)://' |
|
|
\ || arg =~? '(file|https\?)://' |
|
|
\ || arg =~? '\.git\s*$' |
|
|
\ || arg =~? '\.git\s*$' |
|
|
|
|
|
\ || isdirectory(expand(arg)) |
|
|
let uri = arg |
|
|
let uri = arg |
|
|
let name = split( substitute(uri,'/\?\.git\s*$','','i') ,'\/')[-1] |
|
|
let name = split( substitute(uri,'/\?\.git\s*$','','i') ,'\/')[-1] |
|
|
else |
|
|
else |
|
|
@ -76,7 +82,20 @@ endf |
|
|
|
|
|
|
|
|
let s:bundle = {} |
|
|
let s:bundle = {} |
|
|
|
|
|
|
|
|
|
|
|
func! s:bundle.nosync() |
|
|
|
|
|
return has_key(self, 'sync') && 'no' == self.sync |
|
|
|
|
|
endf |
|
|
|
|
|
|
|
|
|
|
|
func! s:bundle.installed() |
|
|
|
|
|
return !empty(split(globpath(self.path(), '*'), "\n")) |
|
|
|
|
|
endf |
|
|
|
|
|
|
|
|
func! s:bundle.path() |
|
|
func! s:bundle.path() |
|
|
|
|
|
" TODO: should lcd to tmpdir here |
|
|
|
|
|
if self.nosync() && isdirectory(expand(self.uri)) |
|
|
|
|
|
return self.uri |
|
|
|
|
|
endif |
|
|
|
|
|
|
|
|
return join([g:vundle#bundle_dir, self.name], '/') |
|
|
return join([g:vundle#bundle_dir, self.name], '/') |
|
|
endf |
|
|
endf |
|
|
|
|
|
|
|
|
|