Skip to content

Commit

Permalink
Use asdf instead of chruby and fix github-cctray
Browse files Browse the repository at this point in the history
  • Loading branch information
robotdana committed Nov 27, 2023
1 parent e4705f2 commit e4660ac
Show file tree
Hide file tree
Showing 19 changed files with 103 additions and 149 deletions.
4 changes: 0 additions & 4 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,3 @@
[submodule "github-cctray"]
path = github-cctray
url = [email protected]:robotdana/github-cctray.git
[submodule "asdf"]
path = asdf
url = https://github.com/asdf-vm/asdf.git
branch = v0.13.1
8 changes: 7 additions & 1 deletion .spellr_wordlists/english.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ an'd
applescript
argf
asc
asdf
asdfrc
autocorrect
autolint
automain
Expand All @@ -27,7 +29,6 @@ cdp
changelog
chmod
chromedriver
chruby
chusaku
cmd
cmdexit
Expand All @@ -41,6 +42,7 @@ committerdate
config
conflictstyle
contentclicked
contributers
coreaudiod
cppflags
cruisecontrol
Expand Down Expand Up @@ -129,13 +131,15 @@ gzip
i'm
idk
inconsolata
inflight
irb
irbrc
istat
istatmenus
itemexit
jbuilder
jeks
joejag
json
jsx
kaos
Expand All @@ -148,6 +152,7 @@ launchctl
ldflags
ldot
lfs
libexec
libffi
localhost
lsof
Expand All @@ -162,6 +167,7 @@ mkdir
mktemp
mycnf
mysql
nevergreen
newblank
nginx
nocasematch
Expand Down
14 changes: 5 additions & 9 deletions Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
36 changes: 36 additions & 0 deletions LaunchAgents/sh.dana.github-cctray.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>$PATH</string>
<key>BUNDLE_GEMFILE</key>
<string>$HOME/.dotfiles/github-cctray/Gemfile</string>
<key>ASDF_RUBY_VERSION</key>
<string>3.2.2</string>
<key>ASDF_DIR</key>
<string>/usr/local/opt/asdf/libexec</string>
</dict>
<key>Label</key>
<string>sh.dana.github-cctray</string>
<key>ProgramArguments</key>
<array>
<string>$HOME/.asdf/shims/bundle</string>
<string>exec</string>
<string>rackup</string>
<string>-p</string>
<string>45454</string>
<string>$HOME/.dotfiles/github-cctray/config.ru</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/sh.dana.github-cctray.err</string>
<key>StandardOutPath</key>
<string>/tmp/sh.dana.github-cctray.out</string>
</dict>
</plist>
1 change: 0 additions & 1 deletion asdf
Submodule asdf deleted from 0586b3
1 change: 1 addition & 0 deletions asdfrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
legacy_version_file = yes
18 changes: 12 additions & 6 deletions bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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=$?;
Expand Down
4 changes: 0 additions & 4 deletions bashrc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion bundle_config
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]"
BUNDLE_GEM__CI: "github"
BUNDLE_GEM__CHANGELOG: "true"
BUNDLE_GEM__LINTER: "rubocop"
BUNDLE_BUILD__MYSQL2: "--with-opt-dir=/opt/homebrew/opt/[email protected]"
BUNDLE_BUILD__PUMA: "--with-pkg-config=/opt/homebrew/opt/[email protected]/lib/pkgconfig"
49 changes: 27 additions & 22 deletions functions/cc_menu_support.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand All @@ -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
}

Expand All @@ -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 {
Expand Down Expand Up @@ -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
}
6 changes: 2 additions & 4 deletions functions/nvm_support.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
35 changes: 0 additions & 35 deletions functions/ruby_support.sh
Original file line number Diff line number Diff line change
@@ -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
}
2 changes: 1 addition & 1 deletion github-cctray
2 changes: 1 addition & 1 deletion hooks/post-merge
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 0 additions & 18 deletions scripts/block.sh

This file was deleted.

5 changes: 1 addition & 4 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Loading

0 comments on commit e4660ac

Please sign in to comment.