Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/robotdana/dotfiles
Browse files Browse the repository at this point in the history
# Conflicts:
#	scripts/update.sh
  • Loading branch information
robotdana committed Nov 26, 2023
2 parents 0835c99 + 27ef476 commit d378a36
Show file tree
Hide file tree
Showing 32 changed files with 614 additions and 219 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
bats:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true
- uses: ruby/setup-ruby@v1
Expand All @@ -17,7 +17,7 @@ jobs:
spellr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0.1
3.1.1
8 changes: 8 additions & 0 deletions .spellr_wordlists/english.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ changelog
chmod
chromedriver
chruby
chusaku
cmd
cmdexit
cnf
Expand All @@ -40,6 +41,7 @@ cppflags
cruisecontrol
cwd
diffr
difftool
direnv
dirname
dirs
Expand Down Expand Up @@ -93,12 +95,15 @@ gmc
gmm
gnupg
gpf
gpfr
gpg
gpgconf
gpgsign
gpr
grb
grc
grce
grcr
grep
grm
grmp
Expand Down Expand Up @@ -137,6 +142,7 @@ mailmap
makefile
marketfacer
mergeoptions
mergetool
mkdir
mycnf
mysql
Expand All @@ -147,6 +153,7 @@ nodejs
nomatch
noninteractively
noprefix
norc
numstat
nvm
ocommand
Expand Down Expand Up @@ -233,6 +240,7 @@ untrack
urls
usr
vimrc
vscode
webpack
wget
wip
Expand Down
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
source 'https://rubygems.org'

gem 'spellr'

23 changes: 23 additions & 0 deletions LaunchAgents/sh.dana.dim_when_not_working.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?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>
</dict>
<key>Label</key>
<string>sh.dana.dim_when_not_working</string>
<key>ProgramArguments</key>
<array><string>$HOME/.dotfiles/scripts/dim_when_not_working.applescript</string></array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/sh.dana.dim_when_not_working.err</string>
<key>StandardOutPath</key>
<string>/tmp/sh.dana.dim_when_not_working.out</string>
</dict>
</plist>
23 changes: 23 additions & 0 deletions LaunchAgents/sh.dana.dont_sit_in_silence.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?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>
</dict>
<key>Label</key>
<string>sh.dana.dont_sit_in_silence</string>
<key>ProgramArguments</key>
<array><string>$HOME/.dotfiles/scripts/dont_sit_in_silence.sh</string></array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardErrorPath</key>
<string>/tmp/sh.dana.dont_sit_in_silence.err</string>
<key>StandardOutPath</key>
<string>/tmp/sh.dana.dont_sit_in_silence.out</string>
</dict>
</plist>
20 changes: 5 additions & 15 deletions bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,16 @@ set +H

export PYENV_SHELL=bash
export PATH="$HOME/.cargo/bin:/Users/dana/.pyenv/shims:/usr/local/heroku/bin:/usr/local/bin:/usr/local/sbin:/usr/local/lib/node:$PATH"
export EDITOR='/usr/local/bin/code --wait'
export EDITOR='code --wait'
export GUI_EDITOR=$EDITOR
export THOR_MERGE=$EDITOR' -d $1 $2'
export GPG_TTY=$(tty)
export BASH_SILENCE_DEPRECATION_WARNING=1
if [[ -f /opt/homebrew/bin/brew ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)"
fi

RUBIES=( $(command ls -d1 ~/.rubies/*) )
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

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

if [[ -d opt/homebrew/opt/libffi ]]; then
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"
Expand All @@ -45,7 +35,7 @@ source ~/.dotfiles/functions/hosts_support.sh
source ~/.dotfiles/functions/prompt_support.sh
source ~/.dotfiles/functions/server_support.sh
source ~/.dotfiles/functions/cc_menu_support.sh
source ~/.dotfiles/functions/rails_support.sh
source ~/.dotfiles/functions/chruby_support.sh
source ~/.dotfiles/functions/less_support.sh

source ~/.dotfiles/functions/git_aliases.sh
Expand All @@ -71,4 +61,4 @@ if [ -f /usr/local/bin/direnv ]; then
fi

export PS2="\[$C_PINK\]» \[$C_RESET\]"
export PS1="\[\$(last_command_style)\]\[$C_PINK\]\w\[$C_LIGHT_PINK\]\$(ruby_version_prompt)\[\$(git_status_color)\]\$(git_prompt_current_ref :)$PS2"
export PS1="\[\$(last_command_style)\]\[$C_PINK\]\w\[$C_LIGHT_PINK\]\$(version_prompt)\[\$(git_status_color)\]\$(git_prompt_current_ref :)$PS2"
1 change: 1 addition & 0 deletions bundle_config
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ 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__PUMA: "--with-pkg-config=/opt/homebrew/opt/[email protected]/lib/pkgconfig"
17 changes: 16 additions & 1 deletion functions/bash_support.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,25 @@ function check_untested_bash_profile {
fi
}

function version_prompt {
ruby_version=$(ruby_version_prompt)
node_version=$(node_version_prompt)
if [[ ! -z "$ruby_version" ]] && [[ ! -z "$node_version" ]]; then
echo "{$ruby_version,$node_version}"
elif [[ ! -z "$ruby_version" ]] || [[ ! -z "$node_version" ]]; then
echo "{$ruby_version$node_version}"
fi
}

function ruby_version_prompt {
if [ -f Gemfile ]; then
echo "{r$(ruby --version | cut -d' ' -f 2 | cut -dp -f1 )}"
echo "r$(ruby --version | cut -d' ' -f 2 | cut -dp -f1 | cut -d. -f1,2 )"
fi
}

function node_version_prompt {
if [ -f package.json ]; then
echo "n$(nvm current | colrm 1 1 | cut -d. -f1,2 )"
fi
}

Expand Down
7 changes: 4 additions & 3 deletions functions/cc_menu_support.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function cc_menu_github_actions_urls {
local repo=$(git_current_repo_with_org)
local branch="${1:-"$(git_current_branch)"}"

while IFS= read -r worflow; do
while IFS= read -r workflow; do
echo "http://localhost:45454/$repo/$workflow?branch=$branch&token=$GITHUB_ACTIONS_TOKEN"
done < <(ls -1 .github/workflows)
}
Expand Down Expand Up @@ -79,7 +79,8 @@ function cc_menu_project_url {
}

function cc_menu_github_actions_server {
( cd ~/.dotfiles/locals/github-cctray && chruby 3.0.0 && bundle && bundle exec rackup -p 45454 -D config.ru && wait_for_ports 45454 )
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 {
Expand All @@ -94,7 +95,7 @@ function cc_menu_add_item {
while IFS= read -r server_url; do
defaults write net.sourceforge.cruisecontrol.CCMenu Projects -array-add "
{
displayName = \"$repo : $branch\";
displayName = \"$repo : $branch$label\";
projectName = \"$project_name\";
serverUrl = \"$server_url\";
Expand Down
36 changes: 36 additions & 0 deletions functions/chruby_support.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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

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
}
37 changes: 20 additions & 17 deletions functions/git_aliases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ function gcf() {
local commit
commit=$(git_find_sha $*)
if (( $? < 1 )); then
if git_rebasable_quick "$commit^" && ga; then
echodo git commit --fixup "$commit" && git_autolint_head && git_rebase_i "$commit^"
if git_rebasable "$commit^" && ga; then
echodo git commit --fixup "$commit" && ( ! git_rebasing && git_autolint_head && git_rebase_i "$commit^" )
fi
else
return 1
Expand All @@ -118,10 +118,10 @@ function gcpf() {
# `gc [<message>]` git commit
# patch add, then commit with <message> or open editor for a message
function gc() {
if [ -z "$1" ]; then
ga && echodo git commit --verbose && git_autolint_head
if (( $# == 0 )); then
ga && echodo git commit --verbose && ( git_rebasing || git_autolint_head )
else
ga && echodo git commit -m "$*" && git_autolint_head
ga && echodo git commit -m "$*" && ( git_rebasing || git_autolint_head )
fi
}

Expand Down Expand Up @@ -182,6 +182,10 @@ function gpr(){
gp && git_pr
}

function gpfr() {
gpf && git_pr
}

# `gl [<remote>] [<branch>]` git pull
# pull <branch> or the current branch from <remote> or origin
function gl(){
Expand Down Expand Up @@ -247,19 +251,22 @@ function grm() {
# TODO: only allow to run during a rebase
# TODO: more tests
function grc() {
git_handle_conflicts
GIT_EDITOR=true echodo git rebase --continue || grc
if git_rebasing; then
git_handle_conflicts &&
git_commit_during_rebase &&
GIT_EDITOR=true echodo git rebase --continue
else
echoerr "Not rebasing"
fi
}

function grce() {
[[ -z "$(git diff --name-only)" ]] &&
( git commit --amend --no-edit --no-verify || true ) &&
( GIT_EDITOR=true echodo git rebase --continue || grce )
function grcr {
grc || grcr
}

# git rebase branch
function grb() {
git_no_untracked && (
git_can_autostash && (
git rebase --interactive --autostash --autosquash $(git_branch_fork_point) || grc
)
}
Expand All @@ -269,11 +276,7 @@ function gbr() {

function gs() {
[[ -e .git/MERGE_HEAD ]] && git merge --abort
git_untrack_new_unstaged && git stash -u "$@"
}

function gbt() {
gbc bundle exec rspec --format documentation --fail-fast "$@"
git_stash "$@"
}

# TODO: test
Expand Down
Loading

0 comments on commit d378a36

Please sign in to comment.