Browse Source

Merge 111e0185d7 into 5d9b059701

pull/681/merge
Daniele Megna 9 years ago
committed by GitHub
parent
commit
7fa2f43474
9 changed files with 155 additions and 6 deletions
  1. +1
    -0
      .gitignore
  2. +2
    -0
      README.md
  3. +30
    -6
      autoload/vundle/installer.vim
  4. +1
    -0
      test/end2end/.gitignore
  5. +10
    -0
      test/end2end/README.md
  6. +36
    -0
      test/end2end/installSpecificPluginTagVersionTest.sh
  7. +48
    -0
      test/end2end/testUtils.sh
  8. +14
    -0
      test/end2end/vimrc1
  9. +13
    -0
      test/end2end/vimrc2

+ 1
- 0
.gitignore View File

@ -1,2 +1,3 @@
doc/tags
.netrwhist
*.swp

+ 2
- 0
README.md View File

@ -73,6 +73,8 @@
" Install L9 and avoid a Naming conflict if you've already installed a
" different version somewhere else.
Plugin 'ascenator/L9', {'name': 'newL9'}
" Specific a plugin version (works with releases and tags)
Plugin 'kien/ctrlp.vim', {'version': '1.79'}
" All of your Plugins must be added before the following line
call vundle#end() " required


+ 30
- 6
autoload/vundle/installer.vim View File

@ -405,17 +405,41 @@ func! s:make_sync_command(bang, bundle) abort
return ['', '']
endif
let cmd_parts = [
\ 'cd '.vundle#installer#shellesc(a:bundle.path()),
\ 'git pull',
\ 'git submodule update --init --recursive',
\ ]
let cmd_parts = ['cd '.vundle#installer#shellesc(a:bundle.path())]
if (has_key(a:bundle, 'version'))
echo "Processing '".a:bundle.name."' version ".a:bundle.version
call extend(cmd_parts, [
\ 'git fetch',
\ 'git checkout tags/'.vundle#installer#shellesc(a:bundle.version),
\ ])
else
call extend(cmd_parts, [
\ 'git checkout master',
\ 'git pull',
\ ])
endif
call add(cmd_parts, 'git submodule update --init --recursive')
let cmd = join(cmd_parts, ' && ')
let cmd = vundle#installer#shellesc_cd(cmd)
let initial_sha = s:get_current_sha(a:bundle)
else
let cmd = 'git clone --recursive '.vundle#installer#shellesc(a:bundle.uri).' '.vundle#installer#shellesc(a:bundle.path())
let cmd_parts = [
\ 'git clone --recursive '.vundle#installer#shellesc(a:bundle.uri).' '.vundle#installer#shellesc(a:bundle.path()),
\ ]
if (has_key(a:bundle, 'version'))
echo "Processing '".a:bundle.name."' version ".a:bundle.version
call extend(cmd_parts, [
\ 'cd '.vundle#installer#shellesc(a:bundle.path()),
\ 'git checkout tags/'.vundle#installer#shellesc(a:bundle.version),
\ ])
endif
let cmd = join(cmd_parts, ' && ')
let cmd = vundle#installer#shellesc_cd(cmd)
let initial_sha = ''
endif
return [cmd, initial_sha]


+ 1
- 0
test/end2end/.gitignore View File

@ -0,0 +1 @@
.vim

+ 10
- 0
test/end2end/README.md View File

@ -0,0 +1,10 @@
# End To End Tests
#### What is this?!?
These are end to end tests written in bash. They need bash, vim and git to be run.
They use real internet connection to download plugins from github, so you cannot run them without it.
#### To run a specific test:
```bash
$ bash test/end2end/nameOfTest.sh
```

+ 36
- 0
test/end2end/installSpecificPluginTagVersionTest.sh View File

@ -0,0 +1,36 @@
#!/bin/bash
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "${SCRIPT_DIR}/testUtils.sh"
cd $SCRIPT_DIR
# SOME CONSTANTS TO CONSTANTLY BE UPDATED
VIM_FUGITIVE_CURRENT_VERSION="v2.2-71-gaac85a2"
VIM_SURROUND_CURRENT_VERSION="v2.1-9-ge49d6c2"
# 0. CLEAN
clean
# 1. INSTALL VUNDLE LOCALLY
deployThisVundle
# 2.1 INSTALL BUNDLES FROM FIRST LOCAL vimrc
bundlesInstallUsing ${SCRIPT_DIR}/vimrc1
# 2.2 CHECK PLUGINS
checkPluginPresenceAndVersion "vim-surround" "v2.1" # custom specified tag
checkPluginPresenceAndVersion "vim-fugitive" $VIM_FUGITIVE_CURRENT_VERSION # actual master version
checkPluginPresenceAndVersion "customFolderName" "1.79" # custom name and specified tag
checkPluginPresenceAndVersion "vim-javascript" "v0.9.0" # another custom specified tag
# 3.1. INSTALL BUNDLES FROM SECOND LOCAL vimrc
bundlesInstallUsing ${SCRIPT_DIR}/vimrc2
# 3.2 CHECK PLUGINS
checkPluginPresenceAndVersion "vim-surround" $VIM_SURROUND_CURRENT_VERSION # removed specified version
checkPluginPresenceAndVersion "vim-fugitive" "v1.2" # added custom specified version
checkPluginPresenceAndVersion "ctrlp.vim" "1.78" # removed custom name and changed tag version
checkPluginPresenceAndVersion "vim-javascript" "v0.9.0" # nothing changed here
# 4 GREEN BAR AND CLEAN
successPrintAndClean

+ 48
- 0
test/end2end/testUtils.sh View File

@ -0,0 +1,48 @@
NC='\033[0m' # No Color
BUNDLES_FOLDER="${SCRIPT_DIR}/.vim/bundle/"
function successPrintAndClean {
GREEN='\033[42m'
printf "${GREEN} Green bar!! :-) ${NC}\n"
clean
}
function errorPrintAndClean {
RED='\033[41m'
printf "${RED} $1 :-( ${NC}\n"
clean
}
function clean {
rm -rf ${SCRIPT_DIR}/.vim
}
function deployThisVundle {
mkdir -p ${SCRIPT_DIR}/.vim/bundle/vundle
cp -r ${SCRIPT_DIR}/../../* ./.vim/bundle/vundle/ 2> /dev/null
}
function bundlesInstallUsing {
vim -u $1 +BundleInstall! +qall
}
function checkPluginPresenceAndVersion {
name=$1
expectedVersion=$2
pluginFolder=${BUNDLES_FOLDER}${name}
if [ ! -d $pluginFolder ]; then
errorPrintAndClean "No plugin folder for ${name}!!"
exit
fi
cd $pluginFolder
gitDescribe=$(git describe --tags)
if [ "$gitDescribe" != "$expectedVersion" ]; then
errorPrintAndClean "Wrong plugin version for ${name} (${gitDescribe})!"
exit
fi
cd $SCRIPT_DIR
}

+ 14
- 0
test/end2end/vimrc1 View File

@ -0,0 +1,14 @@
set nocompatible
filetype off
set rtp=./.vim/
set rtp+=./.vim/bundle/vundle/
call vundle#begin('./.vim/bundle')
Plugin 'tpope/vim-fugitive'
Plugin 'tpope/vim-surround', {'version': 'v2.1'}
Plugin 'kien/ctrlp.vim', {'name': 'customFolderName', 'version': '1.79'}
Plugin 'pangloss/vim-javascript', {'version': 'v0.9.0'}
call vundle#end()

+ 13
- 0
test/end2end/vimrc2 View File

@ -0,0 +1,13 @@
set nocompatible
filetype off
set rtp=./.vim/
set rtp+=./.vim/bundle/vundle/
call vundle#begin('./.vim/bundle')
Plugin 'tpope/vim-fugitive', {'version': 'v1.2'}
Plugin 'tpope/vim-surround'
Plugin 'kien/ctrlp.vim', {'version': '1.78'}
Plugin 'pangloss/vim-javascript', {'version': 'v0.9.0'}
call vundle#end()

Loading…
Cancel
Save