diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 78ed189..93e3c68 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,14 +4,13 @@ on: [push, pull_request] jobs: bats: - runs-on: ubuntu-latest + runs-on: macos-latest steps: - uses: actions/checkout@v3 with: submodules: true - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 bundler-cache: true - run: test/ci.sh spellr: @@ -20,6 +19,5 @@ jobs: - uses: actions/checkout@v3 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7 bundler-cache: true - run: bundle exec spellr diff --git a/.ruby-version b/.ruby-version index 94ff29c..be94e6f 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -3.1.1 +3.2.2 diff --git a/.spellr_wordlists/english.txt b/.spellr_wordlists/english.txt index d70f14d..00c343d 100644 --- a/.spellr_wordlists/english.txt +++ b/.spellr_wordlists/english.txt @@ -138,6 +138,7 @@ libffi localhost lsof lvh +macos mailmap makefile marketfacer diff --git a/Gemfile.lock b/Gemfile.lock index c48a9da..b7cc4b9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,10 +1,12 @@ GEM remote: https://rubygems.org/ specs: - fast_ignore (0.15.2) - parallel (1.21.0) - spellr (0.9.1) + fast_ignore (0.17.4) + jaro_winkler (1.5.6) + parallel (1.23.0) + spellr (0.11.0) fast_ignore (>= 0.11.0) + jaro_winkler parallel (~> 1.0) PLATFORMS diff --git a/bash_profile b/bash_profile index c7c5b25..000cf07 100755 --- a/bash_profile +++ b/bash_profile @@ -61,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\]\$(version_prompt)\[\$(git_status_color)\]\$(git_prompt_current_ref :)$PS2" +export PS1="\$(last_command_style)$C_PINK\w\$(prompt_version)\$(prompt_git)$PS2" diff --git a/bashrc b/bashrc index 25a9632..f07fdba 100644 --- a/bashrc +++ b/bashrc @@ -1,7 +1,7 @@ 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\[$C_LIGHT_PINK\]\$(ruby_version_prompt)\[\$(git_status_color)\]\$(git_prompt_current_ref :)$PS2" +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 diff --git a/functions/bash_support.sh b/functions/bash_support.sh index b049d66..a25c532 100644 --- a/functions/bash_support.sh +++ b/functions/bash_support.sh @@ -156,25 +156,27 @@ function check_untested_bash_profile { fi } -function version_prompt { - ruby_version=$(ruby_version_prompt) - node_version=$(node_version_prompt) +function prompt_version { + ruby_version="$(prompt_ruby_version | cut -d. -f1,2)" + node_version="$(prompt_node_version | cut -d. -f1,2)" 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}" + echo -ne "$C_LIGHT_PINK{r$ruby_version,n$node_version}" + elif [[ ! -z "$ruby_version" ]]; then + echo -ne "$C_LIGHT_PINK{r$ruby_version}" + elif [[ ! -z "$ruby_version" ]]; then + echo -ne "$C_LIGHT_PINK{n$node_version}" fi } -function ruby_version_prompt { +function prompt_ruby_version { if [ -f Gemfile ]; then - echo "r$(ruby --version | cut -d' ' -f 2 | cut -dp -f1 | cut -d. -f1,2 )" + ruby --version | cut -d' ' -f 2 | cut -dp -f1 fi } -function node_version_prompt { +function prompt_node_version { if [ -f package.json ]; then - echo "n$(nvm current | colrm 1 1 | cut -d. -f1,2 )" + nvm current | colrm 1 1 | cut -d. -f1,2 fi } diff --git a/functions/git_support.sh b/functions/git_support.sh index 919915f..2de6dc6 100644 --- a/functions/git_support.sh +++ b/functions/git_support.sh @@ -289,24 +289,38 @@ function git_current_branch() { } function git_branch_name() { - ref=$(git rev-parse --symbolic-full-name --abbrev-ref "$1") + ref=$(git rev-parse --symbolic-full-name --abbrev-ref "$1" 2>/dev/null) [[ -z "$ref" ]] && echo "$1" || echo "$ref" } # TODO: test -function git_prompt_current_ref() { - local ref - ref=$(git_current_branch) - if [[ $ref == 'HEAD' ]]; then - ref=$(git branch --format='%(refname:short)' --sort=-committerdate --contains HEAD 2>/dev/null | head -n 1) - local subref="$(git rev-parse --short HEAD 2>/dev/null)" - - if [[ ! -z $subref ]]; then - ref="$ref[$subref]" +function prompt_git() { + if git rev-parse --is-inside-work-tree >/dev/null 2>/dev/null; then + local ref + local color + + if git_status_clean; then + if git_head_pushed; then + color="$C_AQUA" + else + color="$C_GREEN" + fi + else + color="$C_YELLOW" + fi + + ref=$(git_current_branch 2>/dev/null) + if [[ $ref == 'HEAD' ]]; then + ref=$(git branch --format='%(refname:short)' --sort=-committerdate --contains HEAD 2>/dev/null | head -n 1) + local subref="$(git rev-parse --short HEAD 2>/dev/null)" + + if [[ ! -z $subref ]]; then + ref="$ref[$subref]" + fi fi - fi - [[ ! -z $ref ]] && echo "$1$ref" + echo -ne "$color:$ref" + fi } function git_current_repo() { @@ -569,18 +583,6 @@ function git_head_pushed() { fi } -function git_status_color() { - if git_status_clean; then - if git_head_pushed; then - echo -en "$C_AQUA" - else - echo -en "$C_GREEN" - fi - else - echo -en "$C_YELLOW" - fi -} - function git_changed_files_after_merge() { git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD } diff --git a/test/bats b/test/bats index a8b8d0d..e9fd17a 160000 --- a/test/bats +++ b/test/bats @@ -1 +1 @@ -Subproject commit a8b8d0dc7a05abe10c8511fe5041c137e06d18bf +Subproject commit e9fd17a70721e447313691f239d297cecea6dfb7 diff --git a/test/test_helper/bats-assert b/test/test_helper/bats-assert index 672ad18..e2d855b 160000 --- a/test/test_helper/bats-assert +++ b/test/test_helper/bats-assert @@ -1 +1 @@ -Subproject commit 672ad1823a4d2f0c475fdbec0c4497498eec5f41 +Subproject commit e2d855bc78619ee15b0c702b5c30fb074101159f diff --git a/test/test_helper/bats-file b/test/test_helper/bats-file index 17fa557..048aa4c 160000 --- a/test/test_helper/bats-file +++ b/test/test_helper/bats-file @@ -1 +1 @@ -Subproject commit 17fa557f6fe28a327933e3fa32efef1d211caa5a +Subproject commit 048aa4c595d4a103d6ec3518ead9e071efc019e2 diff --git a/test/test_helper/bats-support b/test/test_helper/bats-support index d140a65..9bf10e8 160000 --- a/test/test_helper/bats-support +++ b/test/test_helper/bats-support @@ -1 +1 @@ -Subproject commit d140a65044b2d6810381935ae7f0c94c7023c8c3 +Subproject commit 9bf10e876dd6b624fe44423f0b35e064225f7556