Replace custom package management with Gnu Stow support
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,3 +1 @@
|
||||
packages
|
||||
env
|
||||
.DS_Store
|
||||
2
dependencies/git.txt
vendored
2
dependencies/git.txt
vendored
@@ -1,2 +0,0 @@
|
||||
git@github.com:geometry-zsh/geometry.git
|
||||
git@github.com:rbenv/rbenv-default-gems.git
|
||||
13
dependencies/homebrew.txt
vendored
13
dependencies/homebrew.txt
vendored
@@ -1,9 +1,12 @@
|
||||
fzf
|
||||
git
|
||||
gnupg
|
||||
nodenv
|
||||
pinentry-mac
|
||||
rbenv
|
||||
ruby-build
|
||||
stow
|
||||
zoxide
|
||||
zsh
|
||||
zsh-completions
|
||||
zsh-autosuggestions
|
||||
rbenv
|
||||
ruby-build
|
||||
nodenv
|
||||
gnupg
|
||||
pinentry-mac
|
||||
|
||||
59
install.zsh
59
install.zsh
@@ -1,54 +1,25 @@
|
||||
#!/bin/zsh
|
||||
|
||||
function git_check_installed() {
|
||||
ls . | grep $1 > /dev/null
|
||||
result=$?
|
||||
return $result
|
||||
}
|
||||
|
||||
INSTALL_DIR=$HOME/.files
|
||||
|
||||
which brew > /dev/null
|
||||
if (( $? == 0 )); then
|
||||
brew install -q $(< ./dependencies/homebrew.txt)
|
||||
else
|
||||
echo "Install homebrew before continuing"
|
||||
exit 1
|
||||
if (( $? != 0 )); then
|
||||
echo "First installing Homebrew"
|
||||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||||
fi
|
||||
|
||||
mkdir -p packages
|
||||
pushd packages
|
||||
|
||||
while IFS= read -r line; do
|
||||
directory=${${line%.git}#*/}
|
||||
git_check_installed $directory
|
||||
|
||||
if [[ $? != 0 ]]; then
|
||||
echo "Cloning $line into packages..."
|
||||
git clone -q $line
|
||||
else
|
||||
echo "$directory already installed"
|
||||
fi
|
||||
done < ../dependencies/git.txt
|
||||
echo "Installing dependencies from Homebrew"
|
||||
brew install -q $(< ./dependencies/homebrew.txt)
|
||||
|
||||
echo "Installing rbenv plugins"
|
||||
pushd ruby/.rbenv/plugins
|
||||
git -C rbenv-default-gems pull || git clone git@github.com:rbenv/rbenv-default-gems.git rbenv-default-gems
|
||||
popd
|
||||
|
||||
# Post-install
|
||||
touch ./env
|
||||
mkdir -p $INSTALL_DIR
|
||||
cp -rf packages $INSTALL_DIR/
|
||||
cp -f zshrc $INSTALL_DIR/zshrc
|
||||
cp -rf functions $INSTALL_DIR/functions
|
||||
cp -f env $INSTALL_DIR/.env
|
||||
cp -f pryrc $INSTALL_DIR/.pryrc
|
||||
mkdir -p $(rbenv root)/plugins
|
||||
ln -sf $INSTALL_DIR/packages/rbenv-default-gems $(rbenv root)/plugins/rbenv-default-gems
|
||||
ln -sf $INSTALL_DIR/dependencies/gems.txt $(rbenv root)/default-gems
|
||||
echo "Installing Zsh plugins"
|
||||
pushd zsh/dot-scripts
|
||||
git -C geometry pull || git clone git@github.com:geometry-zsh/geometry.git geometry
|
||||
popd
|
||||
|
||||
# Insert the INSTALL_DIR variable into the installed run control file
|
||||
sed -i "" -e "1 i\\
|
||||
INSTALL_DIR=$INSTALL_DIR\\
|
||||
" $INSTALL_DIR/zshrc
|
||||
|
||||
ln -sf $INSTALL_DIR/zshrc ~/.zshrc
|
||||
ln -sf $INSTALL_DIR/.pryrc ~/.pryrc
|
||||
echo "Linking files"
|
||||
stow --dotfiles -t ~ zsh
|
||||
stow --dotfiles -t ~ ruby
|
||||
|
||||
1
ruby/.rbenv/plugins/.gitignore
vendored
Normal file
1
ruby/.rbenv/plugins/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
rbenv-default-gems
|
||||
@@ -15,4 +15,29 @@ else
|
||||
Pry.print = proc { |output, value| output.puts value.ai({ limit: true }) }
|
||||
puts 'AwesomePrint available in this session'
|
||||
end
|
||||
Pry.config.editor = proc { |file, line| "code --wait --goto #{file}:#{line} --disable-workspace-trust" }
|
||||
Pry.config.editor = proc { |file, line| "nvim +'#{line}|norm! zt' file" }
|
||||
|
||||
# Pry::Commands.create_command 'benchmark' do
|
||||
# description <<~DESCRIPTION
|
||||
# Benchmark a block of code. The block is executed 100 times and the average
|
||||
# time is displayed. The result of the block is also returned.
|
||||
#
|
||||
# Usage: benchmark do
|
||||
# # code to benchmark
|
||||
# end
|
||||
# DESCRIPTION
|
||||
#
|
||||
# banner <<~BANNER
|
||||
# Usage: benchmark do
|
||||
# # code to benchmark
|
||||
# end
|
||||
# BANNER
|
||||
#
|
||||
# command_options takes_block: true
|
||||
#
|
||||
# def process
|
||||
# start = Time.now
|
||||
# command_block
|
||||
# output.puts "Time elapsed #{Time.now - start} seconds"
|
||||
# end
|
||||
# end
|
||||
1
zsh/.gitignore
vendored
Normal file
1
zsh/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
dot-env
|
||||
1
zsh/dot-scripts/.gitignore
vendored
Normal file
1
zsh/dot-scripts/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
geometry
|
||||
@@ -1,11 +1,8 @@
|
||||
source ~/.env
|
||||
|
||||
eval "$(rbenv init -)"
|
||||
eval "$(nodenv init -)"
|
||||
|
||||
while IFS= read -r line; do
|
||||
export $line
|
||||
done <$INSTALL_DIR/.env
|
||||
|
||||
source $INSTALL_DIR/packages/geometry/geometry.zsh
|
||||
eval "$(zoxide init --cmd cd zsh)"
|
||||
|
||||
if type brew &>/dev/null; then
|
||||
FPATH=$(brew --prefix)/share/zsh/site-functions:$FPATH
|
||||
@@ -16,11 +13,7 @@ fi
|
||||
|
||||
source /usr/local/share/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
# heroku autocomplete setup
|
||||
HEROKU_AC_ZSH_SETUP_PATH=/Users/myockey/Library/Caches/heroku/autocomplete/zsh_setup && test -f $HEROKU_AC_ZSH_SETUP_PATH && source $HEROKU_AC_ZSH_SETUP_PATH;
|
||||
|
||||
for file in $INSTALL_DIR/functions/*.zsh; do
|
||||
source $file
|
||||
done
|
||||
HEROKU_AC_ZSH_SETUP_PATH=/Users/myockey/Library/Caches/heroku/autocomplete/zsh_setup && test -f $HEROKU_AC_ZSH_SETUP_PATH && source $HEROKU_AC_ZSH_SETUP_PATH
|
||||
|
||||
typeset -U path cdpath fpath
|
||||
setopt auto_cd
|
||||
@@ -34,5 +27,9 @@ export TERM="xterm-256color"
|
||||
export GPG_TTY=$(tty)
|
||||
export EDITOR="code -nw"
|
||||
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"
|
||||
|
||||
export PATH="/usr/local/sbin:$PATH"
|
||||
|
||||
for file in $HOME/.functions/*.zsh; do
|
||||
source $file
|
||||
done
|
||||
source $HOME/.scripts/geometry/geometry.zsh
|
||||
Reference in New Issue
Block a user