Skip to content

Commit

Permalink
Merge pull request #451 from machupicchubeta/move_apps_config_and_or_…
Browse files Browse the repository at this point in the history
…data_dir_under_xdg_base_directory

Move apps config and/or data directory under XDG Base Directory
  • Loading branch information
machupicchubeta authored Oct 29, 2023
2 parents b4d3779 + 7565785 commit 557a85d
Show file tree
Hide file tree
Showing 18 changed files with 137 additions and 58 deletions.
41 changes: 30 additions & 11 deletions .bash/variables.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"

if [ "$(uname -m)" = "x86_64" ]; then
export ARCHFLAGS="-arch x86_64"
export HOMEBREW_PREFIX="/usr/local"
export HOMEBREW_CELLAR="/usr/local/Cellar"
export HOMEBREW_REPOSITORY="/usr/local/Homebrew"
export BUNDLE_USER_HOME="$HOME/.bundle_x86_64"

export BUNDLE_USER_HOME="$XDG_DATA_HOME/bundle/x86_64"
export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME/bundle/x86_64/config"
export BUNDLE_USER_CACHE="$XDG_CACHE_HOME/bundle/x86_64"
export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME/bundle/x86_64/plugin"
elif [ "$(uname -m)" = "arm64" ]; then
export ARCHFLAGS="-arch arm64"
export HOMEBREW_PREFIX="/opt/homebrew"
export HOMEBREW_CELLAR="/opt/homebrew/Cellar"
export HOMEBREW_REPOSITORY="/opt/homebrew"
export BUNDLE_USER_HOME="$HOME/.bundle_arm64"

export BUNDLE_USER_HOME="$XDG_DATA_HOME/bundle/arm64"
export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME/bundle/arm64/config"
export BUNDLE_USER_CACHE="$XDG_CACHE_HOME/bundle/arm64"
export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME/bundle/arm64/plugin"
fi

# Make vim the default editor
Expand All @@ -24,8 +37,21 @@ export LESSOPEN="| $HOMEBREW_PREFIX/bin/src-hilite-lesspipe.sh %s"
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$HOME/.cargo/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin"
export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml"
export STARSHIP_CACHE="$XDG_CACHE_HOME/starship"
export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc"
export RBENV_ROOT="$XDG_DATA_HOME/rbenv"
export IRBRC="$XDG_CONFIG_HOME/irb/irbrc"
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export _Z_DATA="$XDG_DATA_HOME/z/data"
export NODENV_ROOT="$XDG_DATA_HOME/nodenv"
export PYENV_ROOT="$XDG_DATA_HOME/pyenv"
export GOENV_ROOT="$XDG_DATA_HOME/goenv"
export GOENV_GOPATH_PREFIX="$XDG_DATA_HOME/goenv/modules"
export ENHANCD_DIR="$XDG_DATA_HOME/enhancd"

export PATH="$GOENV_ROOT/shims:$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$CARGO_HOME/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin"
if [ -n "$(echo $CPU_BRAND | grep -o 'Apple')" -a "$(uname -m)" = "arm64" ]; then
export PATH="$PATH:/usr/local/bin"
fi
Expand All @@ -49,11 +75,6 @@ export AWS_PROFILE=default

export DISABLE_SPRING=1

export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"

export PYTHONPATH=$(if [ -d "$PYENV_ROOT/shims" ]; then echo "$PYENV_ROOT/shims"; elif [ -d "$HOMEBREW_PREFIX/opt/python/libexec/bin" ]; then echo "$HOMEBREW_PREFIX/opt/python/libexec/bin"; else echo '/usr/bin/python'; fi)

export ENHANCD_FILTER=fzf
Expand All @@ -65,6 +86,4 @@ export GUILE_TLS_CERTIFICATE_DIRECTORY="$HOMEBREW_PREFIX/etc/gnutls/"

export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$HOMEBREW_PREFIX/opt/[email protected]"

export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml"

export GPG_TTY=$(tty)
4 changes: 2 additions & 2 deletions .bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if [ "$(uname -m)" = "arm64" ]; then
fi

if which sheldon > /dev/null; then
export SHELDON_CONFIG_DIR="$XDG_CONFIG_HOME/sheldon_bash"
export SHELDON_DATA_DIR="$XDG_DATA_HOME/sheldon_bash"
export SHELDON_CONFIG_DIR="$XDG_CONFIG_HOME/sheldon/bash"
export SHELDON_DATA_DIR="$XDG_DATA_HOME/sheldon/bash"
eval "$(sheldon source)"
fi
5 changes: 4 additions & 1 deletion .zsh/completions.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ elif [ "$(uname -m)" = "arm64" ]; then
: "${HOMEBREW_PREFIX:=/opt/homebrew}"
fi

fpath=($HOME/.zfunc $HOMEBREW_PREFIX/opt/zsh-completions/share/zsh-completions $fpath)
: "${XDG_DATA_HOME:=$HOME/.local/share}"
: "${RUSTUP_HOME:=$XDG_DATA_HOME/rustup}"

fpath=("$RUSTUP_HOME" "$HOMEBREW_PREFIX/opt/zsh-completions/share/zsh-completions" $fpath)
_cache_hosts=(`ruby -ne 'if /^Host\s+(.+)$/; print $1.strip, "\n"; end' $HOME/.ssh/config`)

autoload -Uz colors
Expand Down
42 changes: 30 additions & 12 deletions .zsh/variables.zsh
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"

if [ "$(uname -m)" = "x86_64" ]; then
export ARCHFLAGS="-arch x86_64"
export HOMEBREW_PREFIX="/usr/local"
export HOMEBREW_CELLAR="/usr/local/Cellar"
export HOMEBREW_REPOSITORY="/usr/local/Homebrew"
export BUNDLE_USER_HOME="$HOME/.bundle_x86_64"

export BUNDLE_USER_HOME="$XDG_DATA_HOME/bundle/x86_64"
export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME/bundle/x86_64/config"
export BUNDLE_USER_CACHE="$XDG_CACHE_HOME/bundle/x86_64"
export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME/bundle/x86_64/plugin"
elif [ "$(uname -m)" = "arm64" ]; then
export ARCHFLAGS="-arch arm64"
export HOMEBREW_PREFIX="/opt/homebrew"
export HOMEBREW_CELLAR="/opt/homebrew/Cellar"
export HOMEBREW_REPOSITORY="/opt/homebrew"
export BUNDLE_USER_HOME="$HOME/.bundle_arm64"

export BUNDLE_USER_HOME="$XDG_DATA_HOME/bundle/arm64"
export BUNDLE_USER_CONFIG="$XDG_CONFIG_HOME/bundle/arm64/config"
export BUNDLE_USER_CACHE="$XDG_CACHE_HOME/bundle/arm64"
export BUNDLE_USER_PLUGIN="$XDG_DATA_HOME/bundle/arm64/plugin"
fi

export CPU_BRAND="$(/usr/sbin/sysctl -n machdep.cpu.brand_string)"
Expand All @@ -27,8 +40,21 @@ export LESSOPEN="| $HOMEBREW_PREFIX/bin/src-hilite-lesspipe.sh %s"
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$HOME/.docker/bin:$HOME/.cargo/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin"
export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml"
export STARSHIP_CACHE="$XDG_CACHE_HOME/starship"
export INPUTRC="$XDG_CONFIG_HOME/readline/inputrc"
export RBENV_ROOT="$XDG_DATA_HOME/rbenv"
export IRBRC="$XDG_CONFIG_HOME/irb/irbrc"
export RUSTUP_HOME="$XDG_DATA_HOME/rustup"
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export _Z_DATA="$XDG_DATA_HOME/z/data"
export NODENV_ROOT="$XDG_DATA_HOME/nodenv"
export PYENV_ROOT="$XDG_DATA_HOME/pyenv"
export GOENV_ROOT="$XDG_DATA_HOME/goenv"
export GOENV_GOPATH_PREFIX="$XDG_DATA_HOME/goenv/modules"
export ENHANCD_DIR="$XDG_DATA_HOME/enhancd"

export PATH="$GOENV_ROOT/shims:$HOMEBREW_PREFIX/opt/libxml2/bin:$HOMEBREW_PREFIX/opt/libxslt/bin:$HOMEBREW_PREFIX/opt/libiconv/bin:$HOMEBREW_PREFIX/opt/openssl/bin:$HOMEBREW_PREFIX/opt/libressl/bin:$HOMEBREW_PREFIX/opt/curl/bin:$HOMEBREW_PREFIX/opt/sqlite/bin:$HOMEBREW_PREFIX/opt/nss/bin:$HOMEBREW_PREFIX/opt/ruby/bin:$HOMEBREW_PREFIX/opt/go/bin:$HOMEBREW_PREFIX/opt/python/bin:$HOMEBREW_PREFIX/opt/python/libexec/bin:$HOMEBREW_PREFIX/opt/openjdk/bin:$HOMEBREW_PREFIX/opt/coreutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/libexec/gnubin:$HOMEBREW_PREFIX/opt/ed/bin:$HOMEBREW_PREFIX/opt/findutils/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-indent/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-sed/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-tar/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-which/libexec/gnubin:$HOMEBREW_PREFIX/opt/gnu-getopt/bin:$HOMEBREW_PREFIX/opt/grep/libexec/gnubin:$HOMEBREW_PREFIX/opt/m4/bin:$HOMEBREW_PREFIX/opt/make/libexec/gnubin:$HOMEBREW_PREFIX/opt/file-formula/bin:$HOMEBREW_PREFIX/opt/apr/bin:$HOMEBREW_PREFIX/opt/unzip/bin:$HOMEBREW_PREFIX/opt/ssh-copy-id/bin:$HOMEBREW_PREFIX/opt/util-linux/bin:$HOMEBREW_PREFIX/opt/util-linux/sbin:$HOMEBREW_PREFIX/opt/postgresql@16/bin:$HOME/bin:$HOME/.docker/bin:$CARGO_HOME/bin:$PYENV_ROOT/bin:$HOMEBREW_PREFIX/bin:$HOMEBREW_PREFIX/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin"
if [ -n "$(echo $CPU_BRAND | grep -o 'Apple')" -a "$(uname -m)" = "arm64" ]; then
export PATH="$PATH:/usr/local/bin"
fi
Expand All @@ -53,12 +79,6 @@ export AWS_PROFILE=default

export DISABLE_SPRING=1

export XDG_CONFIG_HOME="$HOME/.config"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_DATA_HOME="$HOME/.local/share"
export XDG_STATE_HOME="$HOME/.local/state"

export RBENV_ROOT="$HOME/.rbenv"
export GHQ_ROOT="$HOME/Repositories"

export PYTHONPATH=$(if [ -d "$PYENV_ROOT/shims" ]; then echo "$PYENV_ROOT/shims"; elif [ -d "$HOMEBREW_PREFIX/opt/python/libexec/bin" ]; then echo "$HOMEBREW_PREFIX/opt/python/libexec/bin"; else echo '/usr/bin/python'; fi)
Expand All @@ -74,6 +94,4 @@ export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$HOMEBREW_PREFIX/opt/[email protected]"

export ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#F2E6D4,bg=#7E87D6,bold,underline"

export STARSHIP_CONFIG="$XDG_CONFIG_HOME/starship/config.toml"

export GPG_TTY=$(tty)
4 changes: 2 additions & 2 deletions .zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ if [ "$(uname -m)" = "arm64" ]; then
fi

if which sheldon > /dev/null; then
export SHELDON_CONFIG_DIR="$XDG_CONFIG_HOME/sheldon_zsh"
export SHELDON_DATA_DIR="$XDG_DATA_HOME/sheldon_zsh"
export SHELDON_CONFIG_DIR="$XDG_CONFIG_HOME/sheldon/zsh"
export SHELDON_DATA_DIR="$XDG_DATA_HOME/sheldon/zsh"
eval "$(sheldon source)"
fi

Expand Down
45 changes: 24 additions & 21 deletions bin/put_settings.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ find "$SETTINGS_PATH"/.* -maxdepth 0 -type d ! -path "$SETTINGS_PATH/." ! -path

: "${XDG_CONFIG_HOME:=$HOME/.config}"
: "${XDG_DATA_HOME:=$HOME/.local/share}"
: "${XDG_CACHE_HOME:=$HOME/.cache}"

if [ ! -d "$XDG_CONFIG_HOME" ]; then
mkdir "$XDG_CONFIG_HOME"
Expand All @@ -35,7 +36,7 @@ if [ -d "$SETTINGS_PATH/.vim" ]; then
ln -s "$SETTINGS_PATH/.vim" "$XDG_CONFIG_HOME/nvim"
fi

for app in "git" "starship" "lsd" "sheldon"; do
for app in "git" "starship" "lsd" "sheldon" "bundle" "readline" "gem" "irb" "rspec" "tmux"; do
if [ -L "$XDG_CONFIG_HOME/$app" ]; then
unlink "$XDG_CONFIG_HOME/$app"
fi
Expand All @@ -48,23 +49,33 @@ for app in "git" "starship" "lsd" "sheldon"; do

if [ "$app" = "sheldon" ]; then
for shell in "bash" "zsh"; do
if [ -L "$XDG_CONFIG_HOME/$app"_"$shell" ]; then
unlink "$XDG_CONFIG_HOME/$app"_"$shell"
if [ ! -d "$XDG_DATA_HOME/$app/$shell" ]; then
mkdir --parents "$XDG_DATA_HOME/$app/$shell"
fi
if [ -d "$XDG_CONFIG_HOME/$app"_"$shell" ]; then
mv "$XDG_CONFIG_HOME/$app"_"$shell" "$XDG_CONFIG_HOME/$app"_"$shell"_"$timestamp"
done
fi

if [ "$app" = "bundle" ]; then
for arch in "x86_64" "arm64"; do
if [ ! -d "$XDG_DATA_HOME/$app/$arch" ]; then
mkdir --parents "$XDG_DATA_HOME/$app/$arch"
fi
if [ -d "$SETTINGS_PATH/config/$app"_"$shell" ]; then
ln -s "$SETTINGS_PATH/config/$app"_"$shell" "$XDG_CONFIG_HOME/$app"_"$shell"
if [ ! -d "$XDG_DATA_HOME/$app/$arch/plugin" ]; then
mkdir --parents "$XDG_DATA_HOME/$app/$arch/plugin"
fi
if [ ! -d "$XDG_DATA_HOME/$app"_"$shell" ]; then
mkdir "$XDG_DATA_HOME/$app"_"$shell"
if [ ! -d "$XDG_CACHE_HOME/$app/$arch" ]; then
mkdir --parents "$XDG_CACHE_HOME/$app/$arch"
fi
done
fi

if [ "$app" = "irb" ] && [ ! -d "$XDG_DATA_HOME/$app" ]; then
mkdir --parents "$XDG_DATA_HOME/$app"
fi
done
unset -v app
unset -v shell
unset -v arch

find "$SETTINGS_PATH"/.* -maxdepth 0 -type f -exec sh -c '
dot_file=$1
Expand All @@ -78,13 +89,6 @@ find "$SETTINGS_PATH"/.* -maxdepth 0 -type f -exec sh -c '
ln -s "$dot_file" "$HOME/$dot_filename"
' sh {} \;

if [ -L "$HOME/.irbrc" ]; then
unlink "$HOME/.irbrc"
fi
if [ -f "$GITHUB_REPOSITORIES_PATH/k0kubun/dotfiles/config/.irbrc" ]; then
ln -s "$GITHUB_REPOSITORIES_PATH/k0kubun/dotfiles/config/.irbrc" "$HOME/.irbrc"
fi

if [ -L /etc/my.cnf ]; then
sudo unlink /etc/my.cnf
fi
Expand All @@ -95,17 +99,16 @@ if [ -f "$SETTINGS_PATH/mysql/my-utf8mb4.cnf" ]; then
sudo ln -s "$SETTINGS_PATH/mysql/my-utf8mb4.cnf" /etc/my.cnf
fi

: "${RBENV_ROOT:=$HOME/.rbenv}"
: "${RBENV_ROOT:=$XDG_DATA_HOME/rbenv}"

if [ ! -d "$RBENV_ROOT" ]; then
mkdir "$RBENV_ROOT"
mkdir --parent "$RBENV_ROOT"
fi

if [ -L "$RBENV_ROOT/default-gems" ]; then
unlink "$RBENV_ROOT/default-gems"
fi
if [ -f "$SETTINGS_PATH/rbenv/default-gems" ]; then
ln -s "$SETTINGS_PATH/rbenv/default-gems" "$RBENV_ROOT/default-gems"
if [ -f "$SETTINGS_PATH/local/share/rbenv/default-gems" ]; then
ln -s "$SETTINGS_PATH/local/share/rbenv/default-gems" "$RBENV_ROOT/default-gems"
fi

unset SETTINGS_PATH
Expand Down
12 changes: 8 additions & 4 deletions bin/setup_rust.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
#!/bin/bash
set -eu

: "${XDG_DATA_HOME:=$HOME/.local/share}"
: "${RUSTUP_HOME:=$XDG_DATA_HOME/rustup}"
: "${CARGO_HOME:=$XDG_DATA_HOME/cargo}"

# if [[ ! -d "$HOME/.cargo/bin" ]]; then RUSTUP_INIT_SKIP_PATH_CHECK=yes rustup-init -y --no-modify-path --default-host x86_64-apple-darwin --default-toolchain stable --profile default; fi
if [[ ! -d "$HOME/.cargo/bin" ]]; then RUSTUP_INIT_SKIP_PATH_CHECK=yes rustup-init -y --no-update-default-toolchain --no-modify-path; fi
if [[ ! -d "$CARGO_HOME/bin" ]]; then RUSTUP_INIT_SKIP_PATH_CHECK=yes rustup-init -y --no-update-default-toolchain --no-modify-path; fi
rustup update

if [ "$(uname -m)" = "x86_64" ]; then
: "${HOMEBREW_PREFIX:=/usr/local}"
elif [ "$(uname -m)" = "arm64" ]; then
: "${HOMEBREW_PREFIX:=/opt/homebrew}"
fi
if [[ ! -f $HOMEBREW_PREFIX/etc/bash_completion.d/rustup.bash-completion ]]; then rustup completions bash > $HOMEBREW_PREFIX/etc/bash_completion.d/rustup.bash-completion; fi
if [[ ! -d "$HOME/.zfunc" ]]; then mkdir -p "$HOME/.zfunc"; fi
if [[ ! -f $HOME/.zfunc/_rustup ]]; then rustup completions zsh > $HOME/.zfunc/_rustup; fi
if [[ ! -f "$HOMEBREW_PREFIX/etc/bash_completion.d/rustup.bash-completion" ]]; then rustup completions bash > "$HOMEBREW_PREFIX/etc/bash_completion.d/rustup.bash-completion"; fi
if [[ ! -d "$RUSTUP_HOME" ]]; then mkdir -p "$RUSTUP_HOME"; fi
if [[ ! -f "$RUSTUP_HOME/completions" ]]; then rustup completions zsh > "$RUSTUP_HOME/completions"; fi
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions config/git/ignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@ tags.lock
**/.private
**/private.*
.bundle/*
.bundle_arm64/*
.bundle_x86_64/*
vendor/bundle/**

!.bundle/config
!.bundle_arm64/config
!.bundle_x86_64/config
!**/.keep
36 changes: 36 additions & 0 deletions config/irb/irbrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# frozen_string_literal: true

autoload :Base64, 'base64'
autoload :CGI, 'cgi'
autoload :CSV, 'csv'
autoload :Digest, 'digest'
autoload :ERB, 'erb'
autoload :FileUtils, 'fileutils'
autoload :JSON, 'json'
autoload :Pathname, 'pathname'
autoload :Psych, 'psych'
autoload :Ripper, 'ripper'
autoload :SecureRandom, 'securerandom'
autoload :Shellwords, 'shellwords'
autoload :StringIO, 'stringio'
autoload :URI, 'uri/generic' # `autoload :URI, 'uri'` breaks Rails
autoload :YAML, 'yaml'
autoload :Zlib, 'zlib'

IRB.conf[:USE_AUTOCOMPLETE] = false
IRB.conf[:SAVE_HISTORY] = 1000
IRB.conf[:HISTORY_FILE] = File.join(ENV['XDG_DATA_HOME'], 'irb', 'history')
if defined?(IRB::Color) # just for consistency
clear = "\e[0m"
bold = "\e[1m"
green = "\e[32m"
blue = "\e[34m"
cyan = "\e[36m"
IRB.conf[:PROMPT][:DEFAULT] = {
PROMPT_I: "#{cyan}#{bold}%N#{clear}(#{green}#{bold}%m#{clear})[#{blue}%02n#{clear}:%i]> ",
PROMPT_N: "#{cyan}#{bold}%N#{clear}(#{green}#{bold}%m#{clear})[#{blue}%02n#{clear}:%i]> ",
PROMPT_S: "#{cyan}#{bold}%N#{clear}(#{green}#{bold}%m#{clear})[#{blue}%02n#{clear}:%i]%l ",
PROMPT_C: "#{cyan}#{bold}%N#{clear}(#{green}#{bold}%m#{clear})[#{blue}%02n#{clear}:%i]* ",
RETURN: "=> %s\n",
}
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply = ["source"]
[plugins.ohmyzsh-plugins]
github = "ohmyzsh/ohmyzsh"
dir = "plugins"
use = ["{bundler/bundler,docker/docker,docker-compose/docker-compose,git/git,history/history,macos/macos,terraform/terraform,z/z}.plugin.zsh"]
use = ["{bundler/bundler,docker-compose/docker-compose,git/git,history/history,macos/macos,terraform/terraform,z/z}.plugin.zsh"]
apply = ["source"]

[plugins.ohmyzsh-plugin-redis-cli]
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 557a85d

Please sign in to comment.