Skip to content

Commit

Permalink
Merge pull request spf13#555 from jrobeson/add-app_dir-var
Browse files Browse the repository at this point in the history
add app_dir var to point to root of application
  • Loading branch information
spf13 committed Feb 18, 2014
2 parents 7565039 + 59f9d87 commit 65d344d
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 38 deletions.
10 changes: 5 additions & 5 deletions bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
############################ SETUP PARAMETERS
app_name='spf13-vim'
app_dir="$HOME/.spf13-vim-3"
[ -z "$git_uri" ] && git_uri='https://github.com/spf13/spf13-vim.git'
git_branch='3.0'
debug_mode='0'
Expand Down Expand Up @@ -64,7 +65,7 @@ upgrade_repo() {
msg "trying to update $1"

if [ "$1" = "$app_name" ]; then
cd "$HOME/.$app_name-3" &&
cd "$app_dir" &&
git pull origin "$git_branch"
fi

Expand All @@ -80,10 +81,9 @@ upgrade_repo() {

clone_repo() {
program_exists "git" "Sorry, we cannot continue without GIT, please install it first."
endpath="$HOME/.$app_name-3"

if [ ! -e "$endpath/.git" ]; then
git clone --recursive -b "$git_branch" "$git_uri" "$endpath"
if [ ! -e "$app_dir" ]; then
git clone --recursive -b "$git_branch" "$git_uri" "$app_dir"
ret="$?"
success "$1"
debug
Expand All @@ -104,7 +104,7 @@ clone_vundle() {
}

create_symlinks() {
endpath="$HOME/.$app_name-3"
endpath="$app_dir"

if [ ! -d "$endpath/.vim/bundle" ]; then
mkdir -p "$endpath/.vim/bundle"
Expand Down
32 changes: 16 additions & 16 deletions spf13-vim-windows-install.cmd
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%

@set BASE_DIR=%HOME%\.spf13-vim-3
IF NOT EXIST "%BASE_DIR%" (
call git clone --recursive -b 3.0 https://github.com/spf13/spf13-vim.git "%BASE_DIR%"
@set APP_DIR=%HOME%\.spf13-vim-3
IF NOT EXIST "%APP_DIR%" (
call git clone --recursive -b 3.0 https://github.com/spf13/spf13-vim.git "%APP_DIR%"
) ELSE (
@set ORIGINAL_DIR=%CD%
echo updating spf13-vim
chdir /d "%BASE_DIR%"
chdir /d "%APP_DIR%"
call git pull
chdir /d "%ORIGINAL_DIR%"
call cd "%BASE_DIR%"
call cd "%APP_DIR%"
)

call mklink "%HOME%\.vimrc" "%BASE_DIR%\.vimrc"
call mklink "%HOME%\_vimrc" "%BASE_DIR%\.vimrc"
call mklink "%HOME%\.vimrc.fork" "%BASE_DIR%\.vimrc.fork"
call mklink "%HOME%\.vimrc.bundles" "%BASE_DIR%\.vimrc.bundles"
call mklink "%HOME%\.vimrc.bundles.fork" "%BASE_DIR%\.vimrc.bundles.fork"
call mklink "%HOME%\.vimrc.before" "%BASE_DIR%\.vimrc.before"
call mklink "%HOME%\.vimrc.before.fork" "%BASE_DIR%\.vimrc.before.fork"
call mklink /J "%HOME%\.vim" "%BASE_DIR%\.vim"
call mklink "%HOME%\.vimrc" "%APP_DIR%\.vimrc"
call mklink "%HOME%\_vimrc" "%APP_DIR%\.vimrc"
call mklink "%HOME%\.vimrc.fork" "%APP_DIR%\.vimrc.fork"
call mklink "%HOME%\.vimrc.bundles" "%APP_DIR%\.vimrc.bundles"
call mklink "%HOME%\.vimrc.bundles.fork" "%APP_DIR%\.vimrc.bundles.fork"
call mklink "%HOME%\.vimrc.before" "%APP_DIR%\.vimrc.before"
call mklink "%HOME%\.vimrc.before.fork" "%APP_DIR%\.vimrc.before.fork"
call mklink /J "%HOME%\.vim" "%APP_DIR%\.vim"

IF NOT EXIST "%BASE_DIR%\.vim\bundle" (
call mkdir "%BASE_DIR%\.vim\bundle"
IF NOT EXIST "%APP_DIR%\.vim\bundle" (
call mkdir "%APP_DIR%\.vim\bundle"
)

IF NOT EXIST "%HOME%/.vim/bundle/vundle" (
call git clone https://github.com/gmarik/vundle.git "%HOME%/.vim/bundle/vundle"
)

call vim -u "%BASE_DIR%/.vimrc.bundles" +BundleInstall! +BundleClean +qall
call vim -u "%APP_DIR%/.vimrc.bundles" +BundleInstall! +BundleClean +qall
30 changes: 15 additions & 15 deletions spf13-vim-windows-xp-install.cmd
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@if not exist "%HOME%" @set HOME=%HOMEDRIVE%%HOMEPATH%
@if not exist "%HOME%" @set HOME=%USERPROFILE%

@set BASE_DIR=%HOME%\.spf13-vim-3
@set APP_DIR=%HOME%\.spf13-vim-3

@if not exist "%BASE_DIR%" (
@if not exist "%APP_DIR%" (
echo backing up existing vim config
@set today=%DATE%
@if exist "%HOME%\.vim" call xcopy /s/e/h/y/r/q/i "%HOME%\.vim" "%HOME%\.vim.%today%"
Expand All @@ -12,25 +12,25 @@
@if exist "%HOME%\.gvimrc" call copy "%HOME%\.gvimrc" "%HOME%\.gvimrc.%today%"
)

@if exist "%BASE_DIR%" (
@if exist "%APP_DIR%" (
@set ORIGINAL_DIR=%CD%
echo updating spf13-vim
chdir /d "%BASE_DIR%" && git pull
chdir /d "%APP_DIR%" && git pull
chdir /d "%ORIGINAL_DIR%"
) else (
echo cloning spf13-vim
call git clone --recursive -b 3.0 git://github.com/spf13/spf13-vim.git "%BASE_DIR%"
call git clone --recursive -b 3.0 git://github.com/spf13/spf13-vim.git "%APP_DIR%"
)

@if not exist "%BASE_DIR%\.vim\bundle" call mkdir "%BASE_DIR%\.vim\bundle"
call xcopy /s/e/h/y/r/q/i "%BASE_DIR%\.vim" "%HOME%\.vim"
call copy "%BASE_DIR%\.vimrc" "%HOME%\.vimrc"
call copy "%BASE_DIR%\.vimrc" "%HOME%\_vimrc"
call copy "%BASE_DIR%\.vimrc.fork" "%HOME%\.vimrc.fork"
call copy "%BASE_DIR%\.vimrc.bundles" "%HOME%\.vimrc.bundles"
call copy "%BASE_DIR%\.vimrc.bundles.fork" "%HOME%\.vimrc.bundles.fork"
call copy "%BASE_DIR%\.vimrc.before" "%HOME%\.vimrc.before"
call copy "%BASE_DIR%\.vimrc.before.fork" "%HOME%\.vimrc.before.fork"
@if not exist "%APP_DIR%\.vim\bundle" call mkdir "%APP_DIR%\.vim\bundle"
call xcopy /s/e/h/y/r/q/i "%APP_DIR%\.vim" "%HOME%\.vim"
call copy "%APP_DIR%\.vimrc" "%HOME%\.vimrc"
call copy "%APP_DIR%\.vimrc" "%HOME%\_vimrc"
call copy "%APP_DIR%\.vimrc.fork" "%HOME%\.vimrc.fork"
call copy "%APP_DIR%\.vimrc.bundles" "%HOME%\.vimrc.bundles"
call copy "%APP_DIR%\.vimrc.bundles.fork" "%HOME%\.vimrc.bundles.fork"
call copy "%APP_DIR%\.vimrc.before" "%HOME%\.vimrc.before"
call copy "%APP_DIR%\.vimrc.before.fork" "%HOME%\.vimrc.before.fork"

@if not exist "%HOME%/.vim/bundle/vundle" call git clone https://github.com/gmarik/vundle.git "%HOME%/.vim/bundle/vundle"
call vim -u "%BASE_DIR%/.vimrc.bundles" - +BundleInstall! +BundleClean +qall
call vim -u "%APP_DIR%/.vimrc.bundles" - +BundleInstall! +BundleClean +qall
4 changes: 2 additions & 2 deletions uninstall.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh

endpath="$HOME/.spf13-vim-3"
app_dir="$HOME/.spf13-vim-3"

warn() {
echo "$1" >&2
Expand All @@ -15,4 +15,4 @@ rm $HOME/.vimrc
rm $HOME/.vimrc.bundles
rm $HOME/.vim

rm -rf $endpath
rm -rf $app_dir

0 comments on commit 65d344d

Please sign in to comment.