Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converted chruby to generic ruby #437

Merged
merged 12 commits into from
Sep 14, 2023
3 changes: 0 additions & 3 deletions functions/_tide_item_chruby.fish

This file was deleted.

6 changes: 6 additions & 0 deletions functions/_tide_item_ruby.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
function _tide_item_ruby
if path is $_tide_parent_dirs/{*.gemspec,Gemfile,Rakefile,.ruby-version}
ruby --version | string match -qr "(?<v>[\d.]+)"
_tide_print_item ruby $tide_ruby_icon' ' $v
end
end
2 changes: 1 addition & 1 deletion functions/_tide_remove_unusable_items.fish
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
function _tide_remove_unusable_items
# Remove tool-specific items for tools the machine doesn't have installed
set -l removed_items
for item in aws chruby crystal direnv distrobox docker elixir gcloud git go java kubectl nix_shell node php pulumi rustc terraform toolbox virtual_env
for item in aws crystal direnv distrobox docker elixir gcloud git go java kubectl nix_shell node php pulumi ruby rustc terraform toolbox virtual_env
contains $item $tide_left_prompt_items $tide_right_prompt_items || continue

set -l cli_names $item
Expand Down
6 changes: 3 additions & 3 deletions functions/tide/configure/configs/classic.fish
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ tide_aws_bg_color 444444
tide_aws_color FF9900
tide_character_color $_tide_color_green
tide_character_color_failure FF0000
tide_chruby_bg_color 444444
tide_chruby_color B31209
tide_cmd_duration_bg_color 444444
tide_cmd_duration_color 87875F
tide_cmd_duration_decimals 0
Expand Down Expand Up @@ -79,11 +77,13 @@ tide_pwd_color_dirs $_tide_color_dark_blue
tide_pwd_color_truncated_dirs 8787AF
tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform Cargo.toml composer.json CVS go.mod package.json
tide_right_prompt_frame_enabled true
tide_right_prompt_items status cmd_duration context jobs direnv node virtual_env rustc java php pulumi chruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
tide_right_prompt_items status cmd_duration context jobs direnv node virtual_env rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
tide_right_prompt_prefix 
tide_right_prompt_separator_diff_color 
tide_right_prompt_separator_same_color 
tide_right_prompt_suffix ''
tide_ruby_bg_color 444444
tide_ruby_color B31209
tide_rustc_bg_color 444444
tide_rustc_color F74C00
tide_shlvl_bg_color 444444
Expand Down
4 changes: 2 additions & 2 deletions functions/tide/configure/configs/classic_16color.fish
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ tide_aws_bg_color black
tide_aws_color yellow
tide_character_color brgreen
tide_character_color_failure brred
tide_chruby_bg_color black
tide_chruby_color red
tide_cmd_duration_bg_color black
tide_cmd_duration_color brblack
tide_context_bg_color black
Expand Down Expand Up @@ -61,6 +59,8 @@ tide_pwd_bg_color black
tide_pwd_color_anchors brcyan
tide_pwd_color_dirs cyan
tide_pwd_color_truncated_dirs magenta
tide_ruby_bg_color black
tide_ruby_color red
tide_rustc_bg_color black
tide_rustc_color red
tide_shlvl_bg_color black
Expand Down
6 changes: 3 additions & 3 deletions functions/tide/configure/configs/lean.fish
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ tide_aws_bg_color normal
tide_aws_color FF9900
tide_character_color $_tide_color_green
tide_character_color_failure FF0000
tide_chruby_bg_color normal
tide_chruby_color B31209
tide_cmd_duration_bg_color normal
tide_cmd_duration_color 87875F
tide_cmd_duration_decimals 0
Expand Down Expand Up @@ -79,11 +77,13 @@ tide_pwd_color_dirs $_tide_color_dark_blue
tide_pwd_color_truncated_dirs 8787AF
tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform Cargo.toml composer.json CVS go.mod package.json
tide_right_prompt_frame_enabled false
tide_right_prompt_items status cmd_duration context jobs direnv node virtual_env rustc java php pulumi chruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
tide_right_prompt_items status cmd_duration context jobs direnv node virtual_env rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
tide_right_prompt_prefix ' '
tide_right_prompt_separator_diff_color ' '
tide_right_prompt_separator_same_color ' '
tide_right_prompt_suffix ''
tide_ruby_bg_color normal
tide_ruby_color B31209
tide_rustc_bg_color normal
tide_rustc_color F74C00
tide_shlvl_bg_color normal
Expand Down
4 changes: 2 additions & 2 deletions functions/tide/configure/configs/lean_16color.fish
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ tide_aws_bg_color normal
tide_aws_color yellow
tide_character_color brgreen
tide_character_color_failure brred
tide_chruby_bg_color normal
tide_chruby_color red
tide_cmd_duration_bg_color normal
tide_cmd_duration_color brblack
tide_context_bg_color normal
Expand Down Expand Up @@ -61,6 +59,8 @@ tide_pwd_bg_color normal
tide_pwd_color_anchors brcyan
tide_pwd_color_dirs cyan
tide_pwd_color_truncated_dirs magenta
tide_ruby_bg_color normal
tide_ruby_color red
tide_rustc_bg_color normal
tide_rustc_color red
tide_shlvl_bg_color normal
Expand Down
6 changes: 3 additions & 3 deletions functions/tide/configure/configs/rainbow.fish
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ tide_aws_bg_color FF9900
tide_aws_color 232F3E
tide_character_color $_tide_color_green
tide_character_color_failure FF0000
tide_chruby_bg_color B31209
tide_chruby_color 000000
tide_cmd_duration_bg_color C4A000
tide_cmd_duration_color 000000
tide_cmd_duration_decimals 0
Expand Down Expand Up @@ -79,11 +77,13 @@ tide_pwd_color_dirs E4E4E4
tide_pwd_color_truncated_dirs BCBCBC
tide_pwd_markers .bzr .citc .git .hg .node-version .python-version .ruby-version .shorten_folder_marker .svn .terraform Cargo.toml composer.json CVS go.mod package.json
tide_right_prompt_frame_enabled true
tide_right_prompt_items status cmd_duration context jobs direnv node virtual_env rustc java php pulumi chruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
tide_right_prompt_items status cmd_duration context jobs direnv node virtual_env rustc java php pulumi ruby go gcloud kubectl distrobox toolbox terraform aws nix_shell crystal elixir
tide_right_prompt_prefix 
tide_right_prompt_separator_diff_color 
tide_right_prompt_separator_same_color 
tide_right_prompt_suffix ''
tide_ruby_bg_color B31209
tide_ruby_color 000000
tide_rustc_bg_color F74C00
tide_rustc_color 000000
tide_shlvl_bg_color 808000
Expand Down
4 changes: 2 additions & 2 deletions functions/tide/configure/configs/rainbow_16color.fish
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ tide_aws_bg_color yellow
tide_aws_color brblack
tide_character_color brgreen
tide_character_color_failure brred
tide_chruby_bg_color red
tide_chruby_color black
tide_cmd_duration_bg_color yellow
tide_cmd_duration_color black
tide_context_bg_color brblack
Expand Down Expand Up @@ -61,6 +59,8 @@ tide_pwd_bg_color blue
tide_pwd_color_anchors brwhite
tide_pwd_color_dirs brwhite
tide_pwd_color_truncated_dirs white
tide_ruby_bg_color red
tide_ruby_color black
tide_rustc_bg_color red
tide_rustc_color black
tide_shlvl_bg_color yellow
Expand Down
2 changes: 1 addition & 1 deletion functions/tide/configure/icons.fish
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ tide_character_icon ❯
tide_character_vi_icon_default ❮
tide_character_vi_icon_replace ▶
tide_character_vi_icon_visual V
tide_chruby_icon 
tide_cmd_duration_icon
tide_crystal_icon 
tide_direnv_icon ▼
Expand All @@ -26,6 +25,7 @@ tide_pulumi_icon 
tide_pwd_icon
tide_pwd_icon_home
tide_pwd_icon_unwritable 
tide_ruby_icon 
tide_rustc_icon 
tide_shlvl_icon 
tide_status_icon ✔
Expand Down
15 changes: 0 additions & 15 deletions tests/_tide_item_chruby.test.fish

This file was deleted.

21 changes: 21 additions & 0 deletions tests/_tide_item_ruby.test.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# RUN: %fish %s
_tide_parent_dirs

function _ruby
_tide_decolor (_tide_item_ruby)
end

set -l ruby_directory (mktemp -d)
cd $ruby_directory

mock ruby --version "echo 'ruby 3.2.0 (2022-12-25 revision a528908271) +YJIT [arm64-darwin22]'"

set -lx tide_ruby_icon 

_ruby # CHECK:

touch Gemfile

_ruby # CHECK:  3.2.0

command rm -r $ruby_directory