From d661baf4d2402d7d53a412dd3ced5cc4a07e17f9 Mon Sep 17 00:00:00 2001 From: gmarik Date: Sun, 1 May 2011 11:23:19 -0500 Subject: [PATCH 01/19] FAQ --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 8376f28..3a2a791 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,18 @@ see [`:h vundle`](vundle/blob/master/doc/vundle.txt#L1) vimdoc for more details. See [gmarik's vimrc](https://github.com/gmarik/vimfiles/blob/1f4f26d42f54443f1158e0009746a56b9a28b053/vimrc#L136) for working example. +## FAQ + +- **Q** i'm aked for username/pass, why? + **A** Correct invalid bundle name. + this is the case of invalid name used with `Bundle`, which leads to attemt to clone nonexisting repo: + + git clone http://github.com/gmarik/non_existin_repo + Cloning into non_existin_repo... + Username: + Password: + fatal: Authentication failed + ## Contributors * [redlinesoftware](http://redlinesoftware.com) - for lending me 24" monitor! From b133de8d93e2a2b4a0a1e0161b89d2affb4674ef Mon Sep 17 00:00:00 2001 From: gmarik Date: Sat, 30 Apr 2011 16:01:13 -0500 Subject: [PATCH 02/19] rename vundle global variables --- autoload/vundle.vim | 4 ++-- autoload/vundle/config.vim | 16 ++++++++-------- autoload/vundle/installer.vim | 8 ++++---- test/vimrc | 2 +- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 34ac229..93385c5 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -17,7 +17,7 @@ com! -nargs=? -bang BundleClean \ call vundle#installer#clean('!' == '') com! -nargs=0 BundleDocs -\ call vundle#installer#helptags(g:bundles) +\ call vundle#installer#helptags(g:vundle#bundles) " deprecated in favor of Bundles com! -nargs=? -bang BundleSearch @@ -29,6 +29,6 @@ au Syntax vim syn keyword vimCommand Bundle func! vundle#rc(...) abort - let g:bundle_dir = len(a:000) > 0 ? expand(a:1) : expand('$HOME/.vim/bundle') + let g:vundle#bundle_dir = len(a:000) > 0 ? expand(a:1) : expand('$HOME/.vim/bundle') call vundle#config#init() endf diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 9d49dbf..9d761ee 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -1,24 +1,24 @@ func! vundle#config#bundle(arg, ...) let bundle = vundle#config#init_bundle(a:arg, a:000) call s:rtp_rm_a() - call add(g:bundles, bundle) + call add(g:vundle#bundles, bundle) call s:rtp_add_a() endf func! vundle#config#init() - if !exists('g:bundles') | let g:bundles = [] | endif + if !exists('g:vundle#bundles') | let g:vundle#bundles = [] | endif call s:rtp_rm_a() - let g:bundles = [] + let g:vundle#bundles = [] endf func! vundle#config#require(bundles) abort for b in a:bundles call s:rtp_add(b.rtpath()) - call s:rtp_add(g:bundle_dir) + call s:rtp_add(g:vundle#bundle_dir) " TODO: it has to be relative rtpath, not bundle.name exec 'runtime! '.b.name.'/plugin/*.vim' exec 'runtime! '.b.name.'/after/*.vim' - call s:rtp_rm(g:bundle_dir) + call s:rtp_rm(g:vundle#bundle_dir) endfor endf @@ -57,11 +57,11 @@ func! s:parse_name(arg) endf func! s:rtp_rm_a() - call filter(copy(g:bundles), 's:rtp_rm(v:val.rtpath())') + call filter(copy(g:vundle#bundles), 's:rtp_rm(v:val.rtpath())') endf func! s:rtp_add_a() - call filter(reverse(copy(g:bundles)), 's:rtp_add(v:val.rtpath())') + call filter(reverse(copy(g:vundle#bundles)), 's:rtp_add(v:val.rtpath())') endf func! s:rtp_rm(dir) abort @@ -77,7 +77,7 @@ endf let s:bundle = {} func! s:bundle.path() - return join([g:bundle_dir, self.name], '/') + return join([g:vundle#bundle_dir, self.name], '/') endf func! s:bundle.rtpath() diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index e0fbdda..f54a87a 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -1,5 +1,5 @@ func! vundle#installer#install(bang, ...) abort - if !isdirectory(g:bundle_dir) | call mkdir(g:bundle_dir, 'p') | endif + if !isdirectory(g:vundle#bundle_dir) | call mkdir(g:vundle#bundle_dir, 'p') | endif let bundles = (a:1 == '') ? \ s:reload_bundles() : \ map(copy(a:000), 'vundle#config#init_bundle(v:val, {})') @@ -27,8 +27,8 @@ func! vundle#installer#helptags(bundles) abort endf func! vundle#installer#clean(bang) abort - let bundle_dirs = map(copy(g:bundles), 'v:val.path()') - let all_dirs = split(globpath(g:bundle_dir, '*'), "\n") + let bundle_dirs = map(copy(g:vundle#bundles), 'v:val.path()') + let all_dirs = split(globpath(g:vundle#bundle_dir, '*'), "\n") let x_dirs = filter(all_dirs, '0 > index(bundle_dirs, v:val)') if empty(x_dirs) @@ -48,7 +48,7 @@ func! s:reload_bundles() " TODO: obtain Bundles without sourcing .vimrc if filereadable($MYVIMRC)| silent source $MYVIMRC | endif if filereadable($MYGVIMRC)| silent source $MYGVIMRC | endif - return g:bundles + return g:vundle#bundles endf func! s:has_doc(rtp) abort diff --git a/test/vimrc b/test/vimrc index 172679e..8f78c53 100644 --- a/test/vimrc +++ b/test/vimrc @@ -43,7 +43,7 @@ set wildignore+=doc " should not break helptags BundleInstall func! s:assert_bundles() abort - for b in g:bundles + for b in g:vundle#bundles if (!isdirectory(b.path().'/.git')) throw b.name.' not installed' endif From 9269d818f46780e52130d0b8d9438f2563371f00 Mon Sep 17 00:00:00 2001 From: gmarik Date: Tue, 3 May 2011 00:41:56 -0500 Subject: [PATCH 03/19] support sync:no option --- autoload/vundle.vim | 2 +- autoload/vundle/config.vim | 36 ++++++++++++++++++++++++------------ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 93385c5..7982f51 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -5,7 +5,7 @@ " Version: 0.8 com! -nargs=+ Bundle -\ call vundle#config#bundle() +\ call vundle#config#bundle('!' == '', ) com! -nargs=? -bang -complete=custom,vundle#scripts#complete BundleInstall \ call vundle#installer#install('!' == '', ) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 9d761ee..cecc283 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -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, ...) + let bundle = vundle#config#init_bundle(a:bang, a:arg, a:000) call s:rtp_rm_a() call add(g:vundle#bundles, bundle) call s:rtp_add_a() @@ -22,20 +22,25 @@ func! vundle#config#require(bundles) abort endfor 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'))) return extend(opts, copy(s:bundle)) 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 + + return opts endf func! s:parse_name(arg) @@ -77,7 +82,14 @@ endf let s:bundle = {} func! s:bundle.path() - return join([g:vundle#bundle_dir, self.name], '/') + if has_key(self, 'sync') && 'no' == self.sync + if isdirectory(expand(self.uri)) + let path = expand(self.uri) + endif + else + let path = g:vundle#bundle_dir + endif + return join([path, self.name], '/') endf func! s:bundle.rtpath() From 124c5abb85ebe280da5e3715f5cc61fb90b3db4f Mon Sep 17 00:00:00 2001 From: gmarik Date: Tue, 3 May 2011 00:58:11 -0500 Subject: [PATCH 04/19] test plugin --- test/plugin/test_plugin.vim | 3 +++ test/vimrc | 3 +++ 2 files changed, 6 insertions(+) create mode 100644 test/plugin/test_plugin.vim diff --git a/test/plugin/test_plugin.vim b/test/plugin/test_plugin.vim new file mode 100644 index 0000000..98db346 --- /dev/null +++ b/test/plugin/test_plugin.vim @@ -0,0 +1,3 @@ +func! g:vundle_test_plugin() + return 'ok' +endf diff --git a/test/vimrc b/test/vimrc index 8f78c53..32cebb0 100644 --- a/test/vimrc +++ b/test/vimrc @@ -30,6 +30,9 @@ Bundle 'github:mattn/gist-vim.git' Bundle '~/Dropbox/.gitrepos/utilz.vim.git' " Bundle 'file://Dropbox/.gitrepos/utilz.vim.git' +" nosync +Bundle! '~/.vim/vundle.git/test/' + " with options Bundle 'rstacruz/sparkup.git', {'rtp': 'vim/'} From 60a46cd58eec19603afbf3c42470c579386d74ad Mon Sep 17 00:00:00 2001 From: gmarik Date: Tue, 3 May 2011 01:00:03 -0500 Subject: [PATCH 05/19] do not sync when `sync` is set to `no` --- autoload/vundle/config.vim | 6 +++++- autoload/vundle/installer.vim | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index cecc283..9977549 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -81,8 +81,12 @@ endf let s:bundle = {} +func! s:bundle.nosync() + return has_key(self, 'sync') && 'no' == self.sync() +endf + func! s:bundle.path() - if has_key(self, 'sync') && 'no' == self.sync + if self.nosync() if isdirectory(expand(self.uri)) let path = expand(self.uri) endif diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index f54a87a..e909fe3 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -62,6 +62,7 @@ func! s:helptags(rtp) abort endf func! s:sync(bang, bundle) abort + if a:bundle.nosync() | return 0 | endif let git_dir = expand(a:bundle.path().'/.git') if isdirectory(git_dir) if !(a:bang) | return 0 | endif From b32ac42e0629a91ff02290adfbcd22e638889362 Mon Sep 17 00:00:00 2001 From: gmarik Date: Tue, 3 May 2011 01:08:48 -0500 Subject: [PATCH 06/19] check whether bundle installed - just by checking content Conflicts: autoload/vundle/installer.vim --- autoload/vundle/config.vim | 4 ++++ autoload/vundle/installer.vim | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 9977549..82c8723 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -85,6 +85,10 @@ 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() if self.nosync() if isdirectory(expand(self.uri)) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index e909fe3..d1ffdd3 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -61,10 +61,14 @@ func! s:helptags(rtp) abort helptags `=a:rtp.'/doc/'` endf + +func! s:installed(bundle) abort + return !empty(split(globpath(a:bundle.path(), '*'), "\n")) +endf + func! s:sync(bang, bundle) abort if a:bundle.nosync() | return 0 | endif - let git_dir = expand(a:bundle.path().'/.git') - if isdirectory(git_dir) + if a:bundle.installed() if !(a:bang) | return 0 | endif let cmd = 'cd '.shellescape(a:bundle.path()).' && git pull' else From ece8fdccbff9bbb96a47da67e8891fe62ad7ad79 Mon Sep 17 00:00:00 2001 From: gmarik Date: Wed, 4 May 2011 19:57:53 -0500 Subject: [PATCH 07/19] use bundle.installed to check installation --- autoload/vundle/installer.vim | 4 ---- test/vimrc | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index d1ffdd3..5350828 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -62,10 +62,6 @@ func! s:helptags(rtp) abort endf -func! s:installed(bundle) abort - return !empty(split(globpath(a:bundle.path(), '*'), "\n")) -endf - func! s:sync(bang, bundle) abort if a:bundle.nosync() | return 0 | endif if a:bundle.installed() diff --git a/test/vimrc b/test/vimrc index 32cebb0..eca460a 100644 --- a/test/vimrc +++ b/test/vimrc @@ -47,7 +47,7 @@ BundleInstall func! s:assert_bundles() abort for b in g:vundle#bundles - if (!isdirectory(b.path().'/.git')) + if (!b.installed()) throw b.name.' not installed' endif endfor From efec93b0a905af10111e0246ac055659c1288f5e Mon Sep 17 00:00:00 2001 From: gmarik Date: Wed, 4 May 2011 19:59:52 -0500 Subject: [PATCH 08/19] Bundle! (with bang) adds {'sync':'no'} --- autoload/vundle.vim | 2 +- autoload/vundle/config.vim | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/vundle.vim b/autoload/vundle.vim index 7982f51..3132b0c 100644 --- a/autoload/vundle.vim +++ b/autoload/vundle.vim @@ -4,7 +4,7 @@ " Readme: http://github.com/gmarik/vundle/blob/master/README.md " Version: 0.8 -com! -nargs=+ Bundle +com! -nargs=+ -bang Bundle \ call vundle#config#bundle('!' == '', ) com! -nargs=? -bang -complete=custom,vundle#scripts#complete BundleInstall diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 82c8723..c79176e 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -1,4 +1,4 @@ -func! vundle#config#bundle(bang, arg, ...) +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 add(g:vundle#bundles, bundle) @@ -82,7 +82,7 @@ endf let s:bundle = {} func! s:bundle.nosync() - return has_key(self, 'sync') && 'no' == self.sync() + return has_key(self, 'sync') && 'no' == self.sync endf func! s:bundle.installed() From a42550779a31ddd53860820f586d4a6c1d2fda1d Mon Sep 17 00:00:00 2001 From: gmarik Date: Wed, 4 May 2011 20:18:58 -0500 Subject: [PATCH 09/19] use uri as path when nosync is set --- autoload/vundle/config.vim | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index c79176e..ba015fd 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -91,13 +91,11 @@ endf func! s:bundle.path() if self.nosync() - if isdirectory(expand(self.uri)) - let path = expand(self.uri) - endif - else - let path = g:vundle#bundle_dir + let dir = expand(self.uri) + return dif endif - return join([path, self.name], '/') + + return join([g:vundle#bundle_dir, self.name], '/') endf func! s:bundle.rtpath() From c0556355d26fc9bcb892c22c41910923e59df8ba Mon Sep 17 00:00:00 2001 From: gmarik Date: Wed, 4 May 2011 20:19:46 -0500 Subject: [PATCH 10/19] simplify --- autoload/vundle/config.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index ba015fd..2a42077 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -91,8 +91,7 @@ endf func! s:bundle.path() if self.nosync() - let dir = expand(self.uri) - return dif + return expand(self.uri) endif return join([g:vundle#bundle_dir, self.name], '/') From 114779700ef288f529122bfdc3ac54538122f6c0 Mon Sep 17 00:00:00 2001 From: gmarik Date: Wed, 4 May 2011 20:20:16 -0500 Subject: [PATCH 11/19] tests --- test/vimrc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/vimrc b/test/vimrc index eca460a..130eaf6 100644 --- a/test/vimrc +++ b/test/vimrc @@ -30,15 +30,19 @@ Bundle 'github:mattn/gist-vim.git' Bundle '~/Dropbox/.gitrepos/utilz.vim.git' " Bundle 'file://Dropbox/.gitrepos/utilz.vim.git' -" nosync -Bundle! '~/.vim/vundle.git/test/' - " with options Bundle 'rstacruz/sparkup.git', {'rtp': 'vim/'} " Camel case Bundle 'vim-scripts/RubySinatra' +" NOSYNC +" existing directory +Bundle! '~/.vim/vundle.git/test/' + +" just create one +Bundle! 'a_plugin' + filetype plugin indent on " Automatically detect file types. set wildignore+=doc " should not break helptags @@ -53,4 +57,6 @@ func! s:assert_bundles() abort endfor endf +if 'ok' != g:vundle_test_plugin() | throw 'ooops' | endif + call s:assert_bundles() From 25a1d708bdcad09a544fe2b35b047865979c64ae Mon Sep 17 00:00:00 2001 From: gmarik Date: Wed, 4 May 2011 20:21:44 -0500 Subject: [PATCH 12/19] do not clean/install automatically --- test/vimrc | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/vimrc b/test/vimrc index 130eaf6..8a3903f 100644 --- a/test/vimrc +++ b/test/vimrc @@ -7,7 +7,6 @@ set rtp+=~/.vim/vundle.git/ call vundle#rc('/tmp/vundle_bundles') -silent BundleClean! " vim-scripts name Bundle 'molokai' @@ -47,8 +46,6 @@ filetype plugin indent on " Automatically detect file types. set wildignore+=doc " should not break helptags -BundleInstall - func! s:assert_bundles() abort for b in g:vundle#bundles if (!b.installed()) From 658be0b24cf24c341458d8eb8aaffff6a56ce413 Mon Sep 17 00:00:00 2001 From: gmarik Date: Wed, 4 May 2011 23:01:46 -0500 Subject: [PATCH 13/19] consider existing directory a valid uri too --- autoload/vundle/config.vim | 1 + 1 file changed, 1 insertion(+) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 2a42077..cedcbc8 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -52,6 +52,7 @@ func! s:parse_name(arg) elseif arg =~? '^\s*\(git@\|git://\)\S\+' \ || arg =~? '(file|https\?)://' \ || arg =~? '\.git\s*$' + \ || isdirectory(expand(arg)) let uri = arg let name = split( substitute(uri,'/\?\.git\s*$','','i') ,'\/')[-1] else From f5a079deae460e7de15050083c6876e44f94a40f Mon Sep 17 00:00:00 2001 From: gmarik Date: Wed, 4 May 2011 23:29:19 -0500 Subject: [PATCH 14/19] with nosync use existing dir as a DESTINATION path too --- autoload/vundle/config.vim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index cedcbc8..91674b3 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -91,10 +91,10 @@ func! s:bundle.installed() endf func! s:bundle.path() - if self.nosync() - return expand(self.uri) + " 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], '/') endf From 073ddf69650624931e47ce59f6af412e982c03ae Mon Sep 17 00:00:00 2001 From: gmarik Date: Wed, 4 May 2011 23:30:09 -0500 Subject: [PATCH 15/19] with nosync consider bundles installed too --- autoload/vundle/installer.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/vundle/installer.vim b/autoload/vundle/installer.vim index 5350828..25e589a 100644 --- a/autoload/vundle/installer.vim +++ b/autoload/vundle/installer.vim @@ -63,7 +63,7 @@ endf func! s:sync(bang, bundle) abort - if a:bundle.nosync() | return 0 | endif + if a:bundle.nosync() | return a:bang | endif if a:bundle.installed() if !(a:bang) | return 0 | endif let cmd = 'cd '.shellescape(a:bundle.path()).' && git pull' From 625a110af48816cd9fd58f3368b67eff547e75e4 Mon Sep 17 00:00:00 2001 From: gmarik Date: Wed, 4 May 2011 23:30:23 -0500 Subject: [PATCH 16/19] moar tests --- test/vimrc | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/test/vimrc b/test/vimrc index 8a3903f..6d6ef0c 100644 --- a/test/vimrc +++ b/test/vimrc @@ -46,14 +46,37 @@ filetype plugin indent on " Automatically detect file types. set wildignore+=doc " should not break helptags + + +augroup vimrc + au WinEnter * call s:test() +augroup END + +func! s:test() + if 'ok' != g:vundle_test_plugin() != 'ok' + throw 'ooops' + endif + + call s:assert_bundles() + + call s:asser_a_bundle() +endf + +func! s:assert(cond, msg) + if !a:cond + throw a:msg + endif +endf + func! s:assert_bundles() abort for b in g:vundle#bundles - if (!b.installed()) - throw b.name.' not installed' - endif + call assert(b.nosync() || b.installed(), b.name.' not installed') endfor endf -if 'ok' != g:vundle_test_plugin() | throw 'ooops' | endif +func! s:assert_a_bundle() abort + let b = filter(copy(g:vundle#bundles), 'v:var.name = "a_bundle"')[0] + let c = b.path() != expand(g:vundle#bundle_dir.'/'.'a_name') + call s:assert(c, ' a_plugin isnt instaled') +endf -call s:assert_bundles() From 9a0d37beb80acf2b7d8b83ab3a287e60439ce527 Mon Sep 17 00:00:00 2001 From: gmarik Date: Wed, 4 May 2011 23:56:24 -0500 Subject: [PATCH 17/19] let options override name/uri --- autoload/vundle/config.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/autoload/vundle/config.vim b/autoload/vundle/config.vim index 91674b3..8bd2f45 100644 --- a/autoload/vundle/config.vim +++ b/autoload/vundle/config.vim @@ -23,7 +23,7 @@ func! vundle#config#require(bundles) abort endf 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'))) + let opts = extend(s:parse_options(a:bang, a:opts), s:parse_name(substitute(a:name,"['".'"]\+','','g')),'keep') return extend(opts, copy(s:bundle)) endf From be9a50dfe298cd7dac567e3df3712263858cb3dc Mon Sep 17 00:00:00 2001 From: gmarik Date: Thu, 5 May 2011 00:22:27 -0500 Subject: [PATCH 18/19] tests --- test/vimrc | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/test/vimrc b/test/vimrc index 6d6ef0c..a3aa9c0 100644 --- a/test/vimrc +++ b/test/vimrc @@ -1,6 +1,10 @@ " vim -u test/vimrc set nocompatible +syntax on + +silent exec 'e '.expand('') + filetype off runtime macros/matchit.vim set rtp+=~/.vim/vundle.git/ @@ -41,42 +45,49 @@ Bundle! '~/.vim/vundle.git/test/' " just create one Bundle! 'a_plugin' +" +" just create one +Bundle! 'b_plugin', {'name': 'zzz'} filetype plugin indent on " Automatically detect file types. set wildignore+=doc " should not break helptags - - augroup vimrc - au WinEnter * call s:test() + au WinEnter * call Test() augroup END -func! s:test() - if 'ok' != g:vundle_test_plugin() != 'ok' +func! Test() abort + if 'ok' != g:vundle_test_plugin() throw 'ooops' endif - call s:assert_bundles() - - call s:asser_a_bundle() + call Assert_bundles() + call Assert_a_bundle() + call Assert_b_bundle() endf -func! s:assert(cond, msg) - if !a:cond +func! Assert(cond, msg) + if !(a:cond) throw a:msg endif endf -func! s:assert_bundles() abort +func! Assert_bundles() abort for b in g:vundle#bundles - call assert(b.nosync() || b.installed(), b.name.' not installed') + call Assert(b.nosync() || b.installed(), b.name.' not installed') endfor endf -func! s:assert_a_bundle() abort - let b = filter(copy(g:vundle#bundles), 'v:var.name = "a_bundle"')[0] - let c = b.path() != expand(g:vundle#bundle_dir.'/'.'a_name') - call s:assert(c, ' a_plugin isnt instaled') +func! Assert_a_bundle() abort + let b = filter(copy(g:vundle#bundles), 'v:val.name == "a_plugin"')[0] + let c = (b.path() == expand(g:vundle#bundle_dir.'/'.'a_plugin')) + call Assert(c, b.name.' isnt instaled') +endf + +func! Assert_b_bundle() abort + let b = filter(copy(g:vundle#bundles), 'v:val.name == "zzz"')[0] + let c = (b.path() == expand(g:vundle#bundle_dir.'/'.'zzz')) + call Assert(c, b.name.' isnt instaled') endf From 258dd4cf5de5c4b85af8313531716e91b3a45ab1 Mon Sep 17 00:00:00 2001 From: gmarik Date: Thu, 5 May 2011 22:17:48 -0500 Subject: [PATCH 19/19] comment --- test/vimrc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/vimrc b/test/vimrc index a3aa9c0..a2338ba 100644 --- a/test/vimrc +++ b/test/vimrc @@ -46,7 +46,7 @@ Bundle! '~/.vim/vundle.git/test/' " just create one Bundle! 'a_plugin' " -" just create one +" just create one, and override name Bundle! 'b_plugin', {'name': 'zzz'} filetype plugin indent on " Automatically detect file types.