Refactor and clean up of some of the fish and compilation stuffs

This commit is contained in:
ViViDboarder 2017-03-23 15:42:54 -07:00
parent e20e65b648
commit aefd589e0d
24 changed files with 133 additions and 174 deletions

View File

@ -20,21 +20,14 @@ if [ -d /opt/local ]; then
export PATH=/opt/local/bin:/opt/local/sbin:$PATH export PATH=/opt/local/bin:/opt/local/sbin:$PATH
fi fi
export GOROOT=/usr/local/go
if [ -d "$GOROOT" ]; then
export PATH=$PATH:$GOROOT/bin
fi
if [[ "$DET_OS" == "linux" ]]; then if [[ "$DET_OS" == "linux" ]]; then
ANDROID_SDK=$HOME/workspace/adt-bundle-linux/sdk ANDROID_SDK=$HOME/workspace/adt-bundle-linux/sdk
elif [[ "$DET_OS" == "mac" ]]; then elif [[ "$DET_OS" == "mac" ]]; then
ANDROID_SDK=$HOME/workspace/android-sdk-macosx ANDROID_SDK=$HOME/workspace/android-sdk-macosx
go_workspace=$HOME/workspace/go_workspace # Set GOPATH
if [ -d "$go_workspace" ]; then GOROOT=/opt/local/lib/go
export GOPATH=$go_workspace GOPATH=$HOME/workspace/go_path
export PATH=$PATH:$GOPATH/bin
fi
# Fix Python path on OSX to avoid considering System extras over newer versions # Fix Python path on OSX to avoid considering System extras over newer versions
# export PATH=$HOME/Library/Python/2.7/bin:$PATH # export PATH=$HOME/Library/Python/2.7/bin:$PATH
@ -43,8 +36,20 @@ elif [[ "$DET_OS" == "mac" ]]; then
fi fi
# Android paths # Android paths
if [ -d "$ANDROID_SDK" ]; then
export ANDROID_HOME=$ANDROID_SDK export ANDROID_HOME=$ANDROID_SDK
export PATH=$PATH:$ANDROID_SDK/platform-tools:$ANDROID_SDK/tools export PATH=$PATH:$ANDROID_SDK/platform-tools:$ANDROID_SDK/tools
fi
# Go paths
if [ -d "$GOPATH" ]; then
export GOPATH
export PATH=$PATH:$GOPATH/bin
fi
if [ -d "$GOROOT" ]; then
export GOROOT
export PATH=$PATH:$GOROOT/bin
fi
# Home path # Home path
export PATH=$HOME/bin:$PATH export PATH=$HOME/bin:$PATH

1
assets/default/fish/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.local.fish

View File

@ -1,3 +1,5 @@
# Completions for the Force.com cli
function __fish_force_needs_command function __fish_force_needs_command
set cmd (commandline -opc) set cmd (commandline -opc)
if [ (count $cmd) -eq 1 -a $cmd[1] = 'force' ] if [ (count $cmd) -eq 1 -a $cmd[1] = 'force' ]

View File

@ -1,7 +1,7 @@
function source_config function source_synced
# Sources a config file and corresponding local config file if it exists # Sources a config file and corresponding local config file if it exists
set shared_config "$fisher_config/init/$argv[1].fish" set -l shared_config "$fish_synced_dir/$argv[1].fish"
set local_config "$fisher_config/init/$argv[1].local.fish" set -l local_config "$fish_synced_dir/$argv[1].local.fish"
if test -f "$shared_config" if test -f "$shared_config"
source "$shared_config" source "$shared_config"
end end

View File

@ -0,0 +1,5 @@
set -gx fish_function_path "$fish_synced_dir/functions" $fish_function_path
set -gx fish_complete_path "$fish_synced_dir/completions" $fish_complete_path
source_synced 'init/alias'
source_synced 'init/paths'

View File

@ -14,37 +14,35 @@ if [ -d /opt/local ]
set -gx PATH /opt/local/bin /opt/local/sbin $PATH set -gx PATH /opt/local/bin /opt/local/sbin $PATH
end end
# Google GO
set -gx GOROOT /usr/local/go
if [ -d "$GOROOT" ]
set -gx PATH $PATH $GOROOT/bin
end
if [ $det_os = "linux" ] if [ $det_os = "linux" ]
set android_sdk $HOME/workspace/adt-bundle-linux/sdk set android_sdk $HOME/workspace/adt-bundle-linux/sdk
else if [ $det_os = "mac" ] else if [ $det_os = "mac" ]
set android_sdk $HOME/workspace/android-sdk-macosx set android_sdk $HOME/workspace/android-sdk-macosx
set go_workspace $HOME/workspace/go_workspace # Set go paths
if [ -d "$go_workspace" ] set goroot /opt/local/lib/go
set -gx GOPATH $go_workspace set gopath $HOME/workspace/go_path
set -gx PATH $PATH $GOPATH/bin
end
# set PATH $HOME/Library/Python/2.7/bin $PATH # set PATH $HOME/Library/Python/2.7/bin $PATH
# Fix Python path on OSX to avoid considering System extras over newer versions # Fix Python path on OSX to avoid considering System extras over newer versions
set -gx PYTHONPATH /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages /Library/Python/2.7/site-packages $PYTHONPATH set -gx PYTHONPATH /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages /Library/Python/2.7/site-packages $PYTHONPATH
end end
# Google cloud sdk # Google GO
# set sdk_dir "$HOME/workspace/google-cloud-sdk" if [ -d "$goroot" ]
# set bin_path "$sdk_dir/bin" set -gx GOROOT $goroot
# set -gx PATH $bin_path $PATH set -gx PATH $PATH $GOROOT/bin
# set -gx PYTHONPATH "$sdk_dir/platform/google_appengine" $PYTHONPATH end
if [ -d "$gopath" ]
set -gx GOPATH $gopath
set -gx PATH $PATH $GOPATH/bin
end
# Android paths # Android paths
if [ -d "$android_sdk" ]
set -gx ANDROID_HOME $android_sdk set -gx ANDROID_HOME $android_sdk
set -gx PATH $PATH $android_sdk/platform-tools $android_sdk/tools set -gx PATH $PATH $android_sdk/platform-tools $android_sdk/tools
end
# Home path # Home path
set -gx PATH $HOME/bin $PATH set -gx PATH $HOME/bin $PATH
@ -53,3 +51,7 @@ set -gx PATH $HOME/bin $PATH
# Increase memory sizes for java using Ant # Increase memory sizes for java using Ant
set -gx ANT_OPTS "-Xmx2048m -Xms512m" set -gx ANT_OPTS "-Xmx2048m -Xms512m"
# FZF
set -gx FZF_DEFAULT_COMMAND 'ag -g ""'
set -gx FZF_CTRL_T_COMMAND "$FZF_DEFAULT_COMMAND \$dir"

View File

@ -1,5 +0,0 @@
cache/
fisherman/init/*.local.fish
fisherman/completions/*
fisherman/functions/*
fisherman/man/*

View File

@ -21,24 +21,23 @@ if ! is_installed "packages" || prompt_yn "Reinstall packages?" ; then
install_packages=true install_packages=true
fi fi
install_vim_src=false build_vim=false
if [ "$PACKAGE_MANAGER" == 'apt-get' ]; then if [ "$PACKAGE_MANAGER" == 'apt-get' ]; then
# Optional # Optional
is_installed "vim-from-source" is_installed "build-vim"
if prompt_yn "Compile vim?" ; then if prompt_yn "Compile vim?" ; then
install_vim_src=true build_vim=true
fi fi
fi fi
install_neovim=false build_neovim=false
is_installed "neovim" if ! command_exist 'nvim' && prompt_yn "Build Neovim?" ; then
if prompt_yn "Install Neovim?" ; then build_neovim=true
install_neovim=true
fi fi
install_vim_settings=false build_fish=false
if ! is_installed "vim-settings" || prompt_yn "Reinstall vim-settings?" ; then if ! command_exist 'fish' && prompt_yn "Build Fish?" ; then
install_vim_settings=true build_fish=true
fi fi
# Optional # Optional
@ -55,49 +54,34 @@ if prompt_yn "Install Go?" ; then
install_golang=true install_golang=true
fi fi
# Optional
install_fish=false
install_ohmyfish=false
install_fisherman=false
is_installed "fish"
is_installed "oh-my-fish"
is_installed "fisherman"
if prompt_yn "Install fish?" ; then
install_fish=true
if prompt_yn "Install oh-my-fish?" ; then
install_ohmyfish=true
elif prompt_yn "Install Fisherman?" ; then
install_fisherman=true
fi
fi
### Run recipes ### Run recipes
recipe 'dotfiles'
recipe 'bin'
recipe 'git'
git submodule init
git submodule update
if $install_packages ; then if $install_packages ; then
recipe 'packages' recipe 'packages'
set_installed "packages" set_installed "packages"
fi fi
if $install_vim_src ; then recipe 'dotfiles'
recipe 'compile-install-vim' recipe 'bin'
set_installed "vim-from-source" recipe 'git'
recipe 'vim-settings'
recipe 'fish'
git submodule init
git submodule update
if $build_vim ; then
recipe 'build-vim'
set_installed "build-vim"
fi fi
if $install_neovim ; then if $build_neovim ; then
recipe 'neovim' recipe 'build-neovim'
set_installed "neovim" set_installed "neovim"
fi fi
if $install_vim_settings ; then if $build_fish ; then
recipe 'vim-settings' recipe 'build-fish'
set_installed 'vim-settings' set_installed "build-fish"
fi fi
if $install_sfdc ; then if $install_sfdc ; then
@ -110,21 +94,6 @@ if $install_golang ; then
set_installed 'golang' set_installed 'golang'
fi fi
if $install_fish ; then
recipe 'fish-install'
set_installed 'fish'
fi
if $install_ohmyfish ; then
recipe 'oh-my-fish'
set_installed 'oh-my-fish'
fi
if $install_fisherman ; then
recipe 'fisherman'
set_installed 'fisherman'
fi
### Show the Finished banner ### Show the Finished banner
finished finished

94
no-sudo
View File

@ -13,59 +13,41 @@ PROJECT_DIR=$(pwd)
init_paths_and_vars init_paths_and_vars
install_vim_src=false build_vim=false
is_installed "vim-from-source" is_installed "build-vim"
if prompt_yn "Compile vim?" ; then if prompt_yn "Build Vim from source?" ; then
install_vim_src=true build_vim=true
fi
install_vim_settings=false
if ! is_installed "vim-settings" || prompt_yn "Reinstall vim-settings?" ; then
install_vim_settings=true
fi fi
install_sfdc=false install_sfdc=false
is_installed "salesforce" if is_installed "salesforce" || prompt_yn "Install Salesforce tools?" ; then
if prompt_yn "Install Salesforce tools?" ; then
install_sfdc=true install_sfdc=true
fi fi
install_mosh=false
is_installed "mosh"
if prompt_yn "Install Mosh from source?" ; then
install_mosh=true
fi
install_tmux=false
is_installed "tmux"
if prompt_yn "Install tmux from source?" ; then
install_tmux=true
fi
install_fish=false
install_ohmyfish=false
install_fisherman=false
is_installed "fish"
is_installed "oh-my-fish"
is_installed "fisherman"
if prompt_yn "Install fish?" ; then
install_fish=true
if prompt_yn "Install oh-my-fish?" ; then build_mosh=false
install_ohmyfish=true if ! command_exist 'mosh' && prompt_yn "Install Mosh from source?" ; then
elif prompt_yn "Install Fisherman?" ; then build_mosh=true
install_fisherman=true
fi fi
build_tmux=false
if ! command_exist 'tmux' && prompt_yn "Install tmux from source?" ; then
build_tmux=true
fi
build_fish=false
if ! command_exist 'fish' && prompt_yn "Install fish?" ; then
build_fish=true
fi fi
### Run recipes ### Run recipes
recipe 'dotfiles' recipe 'dotfiles'
recipe 'bin' recipe 'bin'
recipe 'git' recipe 'git'
if $install_vim_src ; then
recipe 'compile-install-vim'
set_installed "vim-from-source"
fi
if $install_vim_settings ; then
recipe 'vim-settings' recipe 'vim-settings'
set_installed 'vim-settings'
if $build_vim ; then
recipe 'build-vim'
set_installed "build-vim"
fi fi
if $install_sfdc ; then if $install_sfdc ; then
@ -73,33 +55,23 @@ if $install_sfdc ; then
set_installed 'salesforce' set_installed 'salesforce'
fi fi
if $install_mosh ; then if $build_mosh ; then
recipe 'mosh' recipe 'build-mosh'
set_installed 'mosh-install' set_installed 'build-mosh'
fi fi
if $install_tmux ; then if $build_tmux ; then
recipe 'tmux-install' recipe 'build-tmux'
set_installed 'tmux' set_installed 'build-tmux'
fi fi
if $install_fish ; then if $build_fish ; then
if ! command_exist fish ; then recipe 'build-fish'
recipe 'fish-install' set_installed "build-fish"
fi
if command_exist fish ; then
set_installed 'fish'
fi
fi fi
if $install_ohmyfish ; then if command_exist 'fish' || is_installed 'build-fish' ; then
recipe 'oh-my-fish' recipe 'fish'
set_installed 'oh-my-fish'
fi
if $install_fisherman ; then
recipe 'fisherman'
set_installed 'fisherman'
fi fi
### Show the Finished banner ### Show the Finished banner

View File

@ -0,0 +1,14 @@
#! /bin/bash
log "Compiling and installing fish-shell"
local fish_shell_dir=$WORKSPACE/fish-shell
if [ ! -d $fish_shell_dir ]; then
log "Cloning fish-shell"
git clone https://github.com/fish-shell/fish-shell $fish_shell_dir
else
(cd $fish_shell_dir && git pull)
fi
(cd $fish_shell_dir && ./configure && make && sudo make install)

5
recipes/default/fish Normal file
View File

@ -0,0 +1,5 @@
#! /bin/bash
try_link $DEFAULT_ASSETS_PATH $XDG_CONFIG_HOME/fish/synced
add_line "set -gx fish_synced_dir $XDG_CONFIG_HOME/fish/synced " $XDG_CONFIG_HOME/fish/config.fish
add_line "source $XDG_CONFIG_HOME/fish/synced/init.fish " $XDG_CONFIG_HOME/fish/config.fish

View File

@ -1,5 +0,0 @@
#! /bin/bash
if ! command_exist fish ; then
sudo_package 'fish'
fi

View File

@ -1,17 +1,11 @@
#! /bin/bash #! /bin/bash
if [ ! -d "$fisher_home" ]; then # Install fisherman
curl -L install.fisherman.sh | fish curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs git.io/fisher
fi
# Link fisher configs
rm -fr "$XDG_CONFIG_HOME/fisherman" rm -fr "$XDG_CONFIG_HOME/fisherman"
try_link "${DEFAULT_ASSETS_PATH}/fisherman" "$XDG_CONFIG_HOME/fisherman" try_link "${DEFAULT_ASSETS_PATH}/fisherman" "$XDG_CONFIG_HOME/fisherman"
add_line "source_config paths" $XDG_CONFIG_HOME/fish/config.fish # Install from fishfile
add_line "source_config alias" $XDG_CONFIG_HOME/fish/config.fish fish -c 'fisher; exit'
# Link functions
mkdir -p $XDG_CONFIG_HOME/fish/functions
for func in ${DEFAULT_ASSETS_PATH}/fish/functions/*.fish; do
try_link "$func" $XDG_CONFIG_HOME/fish/functions/$(basename $func)
done

View File

@ -1,7 +1,7 @@
#! /bin/bash #! /bin/bash
sudo_package_update sudo_package_update
sudo_package 'screen tmux htop curl wget mercurial ctags tig pv jq' sudo_package 'tmux htop curl wget mercurial ctags tig pv jq fish mosh'
# Manager specific packages # Manager specific packages
case "$PACKAGE_MANAGER" in case "$PACKAGE_MANAGER" in