diff --git a/.gitmodules b/.gitmodules index d9b8650..0fe7760 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,7 +13,3 @@ [submodule "github-cctray"] path = github-cctray url = git@github.com:robotdana/github-cctray.git -[submodule "asdf"] - path = asdf - url = https://github.com/asdf-vm/asdf.git - branch = v0.13.1 diff --git a/.spellr_wordlists/english.txt b/.spellr_wordlists/english.txt index af2b23b..1593841 100644 --- a/.spellr_wordlists/english.txt +++ b/.spellr_wordlists/english.txt @@ -5,6 +5,8 @@ an'd applescript argf asc +asdf +asdfrc autocorrect autolint automain @@ -27,7 +29,6 @@ cdp changelog chmod chromedriver -chruby chusaku cmd cmdexit @@ -41,6 +42,7 @@ committerdate config conflictstyle contentclicked +contributers coreaudiod cppflags cruisecontrol @@ -129,6 +131,7 @@ gzip i'm idk inconsolata +inflight irb irbrc istat @@ -136,6 +139,7 @@ istatmenus itemexit jbuilder jeks +joejag json jsx kaos @@ -148,6 +152,7 @@ launchctl ldflags ldot lfs +libexec libffi localhost lsof @@ -162,6 +167,7 @@ mkdir mktemp mycnf mysql +nevergreen newblank nginx nocasematch diff --git a/Brewfile b/Brewfile index fff869f..27d8292 100644 --- a/Brewfile +++ b/Brewfile @@ -4,29 +4,25 @@ tap "homebrew/cask" tap "homebrew/cask-fonts" tap "homebrew/core" tap "homebrew/services" -brew "chruby" -brew "direnv" -brew "readline" -brew "sqlite" -brew "docker-compose" +brew "asdf" brew "exercism" +brew "diffr" +brew "git" brew "git-lfs" brew "gnupg" -brew "gzip" brew "jq" brew "pinentry-mac" brew "pkg-config" brew "rbspy" -brew "ruby-build" -brew "ruby-install" brew "shellcheck" brew "wget" -brew "xz" +brew "yq" cask "finicky" cask "textmate" cask "1password" cask "docker" cask "dropbox" +cask "firefox" cask "font-inconsolata" cask "google-chrome" cask "istat-menus" diff --git a/LaunchAgents/sh.dana.github-cctray.plist b/LaunchAgents/sh.dana.github-cctray.plist new file mode 100644 index 0000000..6655042 --- /dev/null +++ b/LaunchAgents/sh.dana.github-cctray.plist @@ -0,0 +1,36 @@ + + + + + EnvironmentVariables + + PATH + $PATH + BUNDLE_GEMFILE + $HOME/.dotfiles/github-cctray/Gemfile + ASDF_RUBY_VERSION + 3.2.2 + ASDF_DIR + /usr/local/opt/asdf/libexec + + Label + sh.dana.github-cctray + ProgramArguments + + $HOME/.asdf/shims/bundle + exec + rackup + -p + 45454 + $HOME/.dotfiles/github-cctray/config.ru + + RunAtLoad + + KeepAlive + + StandardErrorPath + /tmp/sh.dana.github-cctray.err + StandardOutPath + /tmp/sh.dana.github-cctray.out + + diff --git a/asdf b/asdf deleted file mode 160000 index 0586b37..0000000 --- a/asdf +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 0586b37d03031ae8c3110ea2b51cacaad46c7cdc diff --git a/asdfrc b/asdfrc new file mode 100644 index 0000000..e600bd0 --- /dev/null +++ b/asdfrc @@ -0,0 +1 @@ +legacy_version_file = yes diff --git a/bash_profile b/bash_profile index 08a9de5..80f7f24 100755 --- a/bash_profile +++ b/bash_profile @@ -16,17 +16,23 @@ if [[ -f /opt/homebrew/bin/brew ]]; then eval "$(/opt/homebrew/bin/brew shellenv)" fi -if [[ -d opt/homebrew/opt/libffi ]]; then - export LDFLAGS="-L/opt/homebrew/opt/libffi/lib" - export CPPFLAGS="-I/opt/homebrew/opt/libffi/include" - export PKG_CONFIG_PATH="/opt/homebrew/opt/libffi/lib/pkgconfig" +# Brew doesn't finish setting this up, so i must do it +if [[ -d "$(brew --prefix libffi)" ]]; then + export LDFLAGS="-L$(brew --prefix libffi)/lib" + export CPPFLAGS="-I$(brew --prefix libffi)/include" + export PKG_CONFIG_PATH="$(brew --prefix libffi)/lib/pkgconfig" fi -if [ -f ~/.cargo/env ]; then +if [[ -f ~/.cargo/env ]]; then source /Users/dana/.cargo/env fi +if [[ -f "$(brew --prefix asdf)/libexec/asdf.sh" ]]; then + source "$(brew --prefix asdf)/libexec/asdf.sh" + source "$(brew --prefix asdf)/etc/bash_completion.d/asdf.bash" +fi + source ~/.dotfiles/locals/secrets.sh source ~/.dotfiles/functions/nvm_support.sh source ~/.dotfiles/functions/bash_support.sh @@ -47,7 +53,7 @@ source ~/.dotfiles/functions/webpack_aliases.sh PROMPT_COMMAND="maybe_update_terminal_cwd; resource_if_modified_since $(last_bash_profile_modification); check_untested_bash_profile; nvm_use_node_version" -if [ -f /usr/local/bin/direnv ]; then +if [ -d /usr/local/bin ] && [[ -f /usr/local/bin/direnv ]]; then # direnv hook bash. idk what it's doing but i'm sure it's fine _direnv_hook() { local previous_exit_status=$?; diff --git a/bashrc b/bashrc index f07fdba..645d580 100644 --- a/bashrc +++ b/bashrc @@ -2,8 +2,4 @@ source ~/.dotfiles/functions/bash_support.sh source ~/.dotfiles/functions/git_support.sh export PS2="\[$C_PINK\]ยป \[$C_RESET\]" export PS1="\$(last_command_style)$C_PINK\w\$(prompt_version)\$(prompt_git)$PS2" - -export NVM_DIR="$HOME/.nvm" -[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm -[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion export GPG_TTY=$(tty) diff --git a/bundle_config b/bundle_config index dd1471e..6b3d551 100644 --- a/bundle_config +++ b/bundle_config @@ -2,8 +2,8 @@ BUNDLE_GEM__COC: "false" BUNDLE_GEM__TEST: "rspec" BUNDLE_GEM__MIT: "true" -BUNDLE_BUILD__MYSQL2: "--with-opt-dir=/usr/local/opt/openssl@1.1" BUNDLE_GEM__CI: "github" BUNDLE_GEM__CHANGELOG: "true" BUNDLE_GEM__LINTER: "rubocop" +BUNDLE_BUILD__MYSQL2: "--with-opt-dir=/opt/homebrew/opt/openssl@1.1" BUNDLE_BUILD__PUMA: "--with-pkg-config=/opt/homebrew/opt/openssl@1.1/lib/pkgconfig" diff --git a/functions/cc_menu_support.sh b/functions/cc_menu_support.sh index f7d5bc6..25c29af 100644 --- a/functions/cc_menu_support.sh +++ b/functions/cc_menu_support.sh @@ -18,16 +18,17 @@ function cc_menu_travis_url { } function cc_menu_github_actions_urls { - if ! ports_respond 45454; then - cc_menu_github_actions_server + if [[ -z "$GITHUB_ACTIONS_TOKEN" ]]; then + echoerr "No \$GITHUB_ACTIONS_TOKEN" + return false + else + local repo=$(git_current_repo_with_org) + local branch="${1:-"$(git_current_branch)"}" + + while IFS= read -r workflow; do + echo "http://localhost:45454/$repo/$workflow?branch=$branch&token=$GITHUB_ACTIONS_TOKEN" + done < <(ls -1 .github/workflows) fi - - local repo=$(git_current_repo_with_org) - local branch="${1:-"$(git_current_branch)"}" - - while IFS= read -r workflow; do - echo "http://localhost:45454/$repo/$workflow?branch=$branch&token=$GITHUB_ACTIONS_TOKEN" - done < <(ls -1 .github/workflows) } function cc_menu_buildkite_url { @@ -45,9 +46,9 @@ function cc_menu_add { if [[ ! -z "$(cc_menu_item_server_urls $branch)" ]]; then if ! cc_menu_present "$branch"; then - killall CCMenu 2>/dev/null + cc_menu_stop cc_menu_add_item "$branch" - open -g /Applications/CCMenu.app + cc_menu fi fi } @@ -56,9 +57,9 @@ function cc_menu_remove { local branch="${1:-"$(git_current_branch)"}" if cc_menu_present "$branch"; then - killall CCMenu 2>/dev/null + cc_menu_stop cc_menu_remove_item "$branch" - open -g /Applications/CCMenu.app + cc_menu fi } @@ -78,13 +79,9 @@ function cc_menu_project_url { curl "$(cc_menu_item_server_urls "$branch" | head -n 1)" 2>/dev/null | xmllint --xpath "string(//Projects/Project/@webUrl)" - } -function cc_menu_github_actions_server { - return 1; - # ( cd ~/.dotfiles/locals/github-cctray && chruby 3.0.0 && bundle --quiet && be rackup -p 45454 -D config.ru ) -} - function cc_menu_github_actions_server_restart { - kill_port 45454 && cc_menu_github_actions_server + kill_port 45454 + cc_menu } function cc_menu_add_item { @@ -127,18 +124,26 @@ function cc_menu_repo_present { } function cc_menu_init { - killall CCMenu 2>/dev/null + cc_menu_stop defaults write net.sourceforge.cruisecontrol.CCMenu Projects '()' } function cc_menu_remove_branches { - killall CCMenu 2>/dev/null + cc_menu_stop for branch in "$@"; do cc_menu_remove_item "$branch" done - open -g /Applications/CCMenu.app + cc_menu } function cc_menu_list { defaults read net.sourceforge.cruisecontrol.CCMenu Projects | grep -F "displayName = " | cut -f 2 -d\" } + +function cc_menu_stop { + killall CCMenu 2>/dev/null +} + +function cc_menu { + open -g /Applications/CCMenu.app +} diff --git a/functions/nvm_support.sh b/functions/nvm_support.sh index cbbc6c2..14c2388 100644 --- a/functions/nvm_support.sh +++ b/functions/nvm_support.sh @@ -1,8 +1,6 @@ export NVM_DIR="$HOME/.nvm" -[ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm -[ -s "/usr/local/opt/nvm/etc/bash_completion.d/nvm" ] && . "/usr/local/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion -[ -s "/opt/homebrew/opt/nvm/nvm.sh" ] && \. "/opt/homebrew/opt/nvm/nvm.sh" # This loads nvm -[ -s "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" ] && \. "/opt/homebrew/opt/nvm/etc/bash_completion.d/nvm" # This loads nvm bash_completion +[ -s "$(brew --prefix nvm)/nvm.sh" ] && . "$(brew --prefix nvm)/nvm.sh" # This loads nvm +[ -s "$(brew --prefix nvm)/etc/bash_completion.d/nvm" ] && . "$(brew --prefix nvm)/etc/bash_completion.d/nvm" # This loads nvm bash_completion function nvm_use_node_version { if nvm --version >/dev/null 2>/dev/null; then diff --git a/functions/ruby_support.sh b/functions/ruby_support.sh index c3a1d96..c14b83f 100644 --- a/functions/ruby_support.sh +++ b/functions/ruby_support.sh @@ -1,38 +1,3 @@ -if [[ -f /usr/local/opt/chruby/share/chruby/chruby.sh ]]; then - source /usr/local/opt/chruby/share/chruby/chruby.sh - source /usr/local/opt/chruby/share/chruby/auto.sh -fi - -# source $(brew --prefix)/opt/asdf/libexec/asdf.sh - -if [[ -f /opt/homebrew/opt/chruby/share/chruby/chruby.sh ]]; then - source /opt/homebrew/opt/chruby/share/chruby/chruby.sh - source /opt/homebrew/opt/chruby/share/chruby/auto.sh -fi - -function reinstall_ruby { - [[ -z "$(type chruby 2>/dev/null)" ]] && echoerr "chruby is missing" && return 1 - which -s ruby-install || ( echoerr "ruby-install is missing" && return 1 ) - - ruby_path=$(which ruby) - - if [[ ! "$ruby_path" = *.rubies* ]]; then - echoerr "existing ruby isn't installed with chruby" && return 1 - fi - - chruby_identifier=$(chruby | grep '\*' | cut -d' ' -f3) - - rm -rf "${ruby_path%/bin/ruby}" - ruby-install "$chruby_identifier" - install_bundler - bundle -} - function install_bundler { gem install --no-doc --silent --norc bundler:"$(echo $(tail -n 1 Gemfile.lock))" } - -function reload_chruby { - export RUBIES=( $(command ls -d1 ~/.rubies/*) ) - chruby -} diff --git a/github-cctray b/github-cctray index 3acd333..b3ca8dd 160000 --- a/github-cctray +++ b/github-cctray @@ -1 +1 @@ -Subproject commit 3acd3330895551c4373d2af55ae43dacdf3a7bd4 +Subproject commit b3ca8ddb75251a910126b455d4d73c9c4e4313bf diff --git a/hooks/post-merge b/hooks/post-merge index cc09ee6..1cdf1fe 100755 --- a/hooks/post-merge +++ b/hooks/post-merge @@ -3,7 +3,7 @@ source ~/.dotfiles/functions/bash_support.sh source ~/.dotfiles/functions/git_support.sh source ~/.dotfiles/functions/server_support.sh -source ~/.dotfiles/functions/chruby_support.sh +source ~/.dotfiles/functions/ruby_support.sh git_system && exit 0 diff --git a/scripts/block.sh b/scripts/block.sh deleted file mode 100755 index fc50f66..0000000 --- a/scripts/block.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -if [ "$1" == "" ]; then - echo "Usage:" - echo "block twitter.com facebook.com" - echo "redirects twitter.com & facebook.com to localhost" - exit 1 -fi -for url in "$@"; do - cat /etc/hosts | grep $url &>/dev/null - if [[ $? == 0 ]]; then - echo "Already blocking $url" - else - echo "127.0.0.1 $url" | sudo tee -a /etc/hosts &>/dev/null - echo "127.0.0.1 www.$url" | sudo tee -a /etc/hosts &>/dev/null - fi -done -dscacheutil -flushcache -sudo killall mDNSResponder diff --git a/scripts/install.sh b/scripts/install.sh index 018a26c..fdb9d03 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -14,6 +14,7 @@ echodo ln -sf ~/.dotfiles/gemrc ~/.gemrc echodo ln -sf ~/.dotfiles/irbrc ~/.irbrc echodo ln -sf ~/.dotfiles/finicky.js ~/.finicky.js echodo ln -sf ~/.dotfiles/vimrc ~/.vimrc +echodo ln -sf ~/.dotfiles/asdfrc ~/.asdfrc echodo mkdir -p ~/.ssh echodo ln -sf ~/.dotfiles/ssh_config ~/.ssh/config echodo mkdir -p ~/.bundle @@ -30,7 +31,3 @@ if [[ -z "$CI" ]]; then fi ~/.dotfiles/scripts/update.sh - -if [[ -z "$CI" ]]; then - ruby-install ruby-3.0.0 # the ruby used by bash tests -fi diff --git a/scripts/unblock.sh b/scripts/unblock.sh deleted file mode 100755 index 2e3130c..0000000 --- a/scripts/unblock.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -if [ "$1" == "" ]; then - echo "Usage:" - echo "unblock twitter.com facebook.com" - echo "stops redirecting twitter.com & facebook.com to localhost" - exit 1 -fi - -for url in "$@"; do - cat /etc/hosts | grep -vF $url | sudo tee /etc/hosts &>/dev/null -done -dscacheutil -flushcache -sudo killall mDNSResponder diff --git a/scripts/update.sh b/scripts/update.sh index 5fda6d7..5bb8032 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -26,35 +26,19 @@ if [[ $(wc -l ~/.dotfiles/locals/git-completion.bash | awk -F' ' '{print $1}') = exit 1 fi -# get diff highlight -mkdir ~/.dotfiles/locals/diff-highlight -echodo curl "https://raw.githubusercontent.com/git/git/v$(git_version_number)/contrib/diff-highlight/DiffHighlight.pm" > ~/.dotfiles/locals/diff-highlight/DiffHighlight.pm -echodo curl "https://raw.githubusercontent.com/git/git/v$(git_version_number)/contrib/diff-highlight/diff-highlight.perl" > ~/.dotfiles/locals/diff-highlight/diff-highlight.perl -echodo curl "https://raw.githubusercontent.com/git/git/v$(git_version_number)/contrib/diff-highlight/Makefile" > ~/.dotfiles/locals/diff-highlight/Makefile - -if [[ $(wc -l ~/.dotfiles/locals/diff-highlight/Makefile | awk -F' ' '{print $1}') = "1" ]]; then - echoerr "diff highlight didn't download correctly" - exit 1 -fi - -( cd ~/.dotfiles/locals/diff-highlight && make -f Makefile & ) -ln -sf ~/.dotfiles/locals/diff-highlight/diff-highlight /usr/local/bin/diff-highlight - git submodule add git@github.com:robotdana/github-cctray.git git_update_submodules ( cd github-cctray && git remote add upstream git@github.com:joejag/github-cctray.git ) -git submodule add git@github.com:asdf-vm/asdf.git -cd ~/.dotfiles/asdf -latest_asdf=$(git fetch --tags origin && git tag -l | sort --version-sort -r | grep -v rc | head -n 1) -cd - -git submodule set-branch -b $latest_asdf asdf -git submodule sync -git_update_submodules +if [[ ! -z "$(which asdf)" ]]; then + asdf plugin add nodejs + asdf plugin add ruby -ruby-install ruby 3.0 -ruby-install ruby 3.1 -ruby-install ruby 3.2 + asdf install ruby latest:3.0 + asdf install ruby latest:3.1 + asdf install ruby latest:3.2 + asdf install ruby 3.3.0-preview3 +end install_launchagents.sh diff --git a/test/git_rubocop.bats b/test/git_rubocop.bats index 75c9e9b..d69b7d7 100644 --- a/test/git_rubocop.bats +++ b/test/git_rubocop.bats @@ -1,7 +1,7 @@ #!/usr/bin/env bats source ~/.dotfiles/functions/git_aliases.sh source ~/.dotfiles/functions/git_support.sh -source ~/.dotfiles/functions/chruby_support.sh +source ~/.dotfiles/functions/ruby_support.sh load helper