Browse Source

Add 'cmd' option for plugin configuration

pull/904/head
Petr Orlov 7 years ago
parent
commit
8266c6b31d
No known key found for this signature in database GPG Key ID: FDBE47F3AA471674
4 changed files with 43 additions and 2 deletions
  1. +4
    -0
      README.md
  2. +23
    -2
      autoload/vundle/installer.vim
  3. +15
    -0
      doc/vundle.txt
  4. +1
    -0
      test/vimrc

+ 4
- 0
README.md View File

@ -85,6 +85,10 @@
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
" Plugin 'ascenator/L9', {'name': 'newL9'}
"
" Run an additional command after installation and updates. Some plugins
" require running build scripts to work properly.
Plugin 'workspace/custom', {'cmd': 'make'}
" All of your Plugins must be added before the following line
call vundle#end() " required


+ 23
- 2
autoload/vundle/installer.vim View File

@ -364,6 +364,27 @@ func! s:get_current_sha(bundle)
endf
" ---------------------------------------------------------------------------
" Run user command script for a given bundle if defined
"
" bundle -- a bundle object
" return -- True if script succeed, False otherwise
" ---------------------------------------------------------------------------
func! s:run_user_cmd(bundle)
if has_key(a:bundle, 'cmd')
let cmd = [
\ 'cd '.vundle#installer#shellesc(a:bundle.path()),
\ a:bundle.cmd,
\ ]
let cmd = join(cmd, ' && ')
let out = s:system(vundle#installer#shellesc_cd(cmd))
call s:log(cmd, '$ ')
call s:log(out, '> ')
endif
return 0 == v:shell_error
endf
" ---------------------------------------------------------------------------
" Create the appropriate sync command to run according to the current state of
" the local repository (clone, pull, reset, etc).
@ -457,7 +478,7 @@ func! s:sync(bang, bundle) abort
end
if empty(initial_sha)
return 'new'
return s:run_user_cmd(a:bundle) ? 'new' : 'error'
endif
let updated_sha = s:get_current_sha(a:bundle)
@ -467,7 +488,7 @@ func! s:sync(bang, bundle) abort
endif
call add(g:vundle#updated_bundles, [initial_sha, updated_sha, a:bundle])
return 'updated'
return s:run_user_cmd(a:bundle) ? 'updated' : 'error'
endf


+ 15
- 0
doc/vundle.txt View File

@ -96,6 +96,8 @@ more information.
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
" Avoid a name conflict with L9
Plugin 'user/L9', {'name': 'newL9'}
" Run an additional command after installation and updates
Plugin 'workspace/custom', {'cmd': 'make'}
" All of your Plugins must be added before the following line
call vundle#end() " required
@ -193,6 +195,19 @@ Please note that the URI will be treated the same as for any other plugins, so
only the last part of it will be added to the |runtimepath|. The user is
advised to use this flag only with single word URIs to avoid confusion.
The 'cmd' option
----------------
An additional command script which runs right after installation and update
operation process.
For example:
>
Plugin 'customplugin', {'cmd': './build all'}
This can be usefull for complex plugins with requirements of post-install
builds, data importing, etc. All operations must not depend on user input.
3.2 SUPPORTED URIS ~
*vundle-plugins-uris*


+ 1
- 0
test/vimrc View File

@ -51,6 +51,7 @@ Bundle '~/Dropbox/.gitrepos/utilz.vim.git'
" with options
Bundle 'rstacruz/sparkup.git', {'rtp': 'vim/'}
Bundle 'matchit.zip', {'name': 'matchit'}
Bundle 'Valloric/YouCompleteMe', {'cmd': './install.py --clang-completer'}
" Camel case
Bundle 'vim-scripts/RubySinatra'


Loading…
Cancel
Save