diff --git a/functions/_tide_item_chruby.fish b/functions/_tide_item_chruby.fish deleted file mode 100644 index 02d5fbd9..00000000 --- a/functions/_tide_item_chruby.fish +++ /dev/null @@ -1,3 +0,0 @@ -function _tide_item_chruby - test -n "$RUBY_VERSION" && _tide_print_item chruby $tide_chruby_icon' ' $RUBY_VERSION -end diff --git a/functions/_tide_item_ruby.fish b/functions/_tide_item_ruby.fish new file mode 100644 index 00000000..bde84eb5 --- /dev/null +++ b/functions/_tide_item_ruby.fish @@ -0,0 +1,6 @@ +function _tide_item_ruby + if path is $_tide_parent_dirs/{*.gemspec,Gemfile,Rakefile,.ruby-version} + ruby --version | string match -qr "(?[\d.]+)" + _tide_print_item ruby $tide_ruby_icon' ' $v + end +end diff --git a/functions/_tide_remove_unusable_items.fish b/functions/_tide_remove_unusable_items.fish index a2e56986..2ca028c6 100644 --- a/functions/_tide_remove_unusable_items.fish +++ b/functions/_tide_remove_unusable_items.fish @@ -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 diff --git a/functions/tide/configure/configs/classic.fish b/functions/tide/configure/configs/classic.fish index 9df6ae1d..52ffe1bb 100644 --- a/functions/tide/configure/configs/classic.fish +++ b/functions/tide/configure/configs/classic.fish @@ -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 @@ -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 diff --git a/functions/tide/configure/configs/classic_16color.fish b/functions/tide/configure/configs/classic_16color.fish index 60431175..037ecb0d 100644 --- a/functions/tide/configure/configs/classic_16color.fish +++ b/functions/tide/configure/configs/classic_16color.fish @@ -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 @@ -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 diff --git a/functions/tide/configure/configs/lean.fish b/functions/tide/configure/configs/lean.fish index d165446a..02b782ff 100644 --- a/functions/tide/configure/configs/lean.fish +++ b/functions/tide/configure/configs/lean.fish @@ -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 @@ -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 diff --git a/functions/tide/configure/configs/lean_16color.fish b/functions/tide/configure/configs/lean_16color.fish index 546868da..49e48b42 100644 --- a/functions/tide/configure/configs/lean_16color.fish +++ b/functions/tide/configure/configs/lean_16color.fish @@ -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 @@ -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 diff --git a/functions/tide/configure/configs/rainbow.fish b/functions/tide/configure/configs/rainbow.fish index 55834ae2..9e819bcc 100644 --- a/functions/tide/configure/configs/rainbow.fish +++ b/functions/tide/configure/configs/rainbow.fish @@ -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 @@ -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 diff --git a/functions/tide/configure/configs/rainbow_16color.fish b/functions/tide/configure/configs/rainbow_16color.fish index 78035961..d6097615 100644 --- a/functions/tide/configure/configs/rainbow_16color.fish +++ b/functions/tide/configure/configs/rainbow_16color.fish @@ -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 @@ -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 diff --git a/functions/tide/configure/icons.fish b/functions/tide/configure/icons.fish index cde0aa9c..7b1c2902 100644 --- a/functions/tide/configure/icons.fish +++ b/functions/tide/configure/icons.fish @@ -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 ▼ @@ -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 ✔ diff --git a/tests/_tide_item_chruby.test.fish b/tests/_tide_item_chruby.test.fish deleted file mode 100644 index 456c4bbd..00000000 --- a/tests/_tide_item_chruby.test.fish +++ /dev/null @@ -1,15 +0,0 @@ -# RUN: %fish %s -_tide_parent_dirs - -function _chruby - _tide_decolor (_tide_item_chruby) -end - -set -lx RUBY_VERSION - -_chruby # CHECK: - -set -lx RUBY_VERSION 3.0.0 -set -lx tide_chruby_icon  - -_chruby # CHECK:  3.0.0 diff --git a/tests/_tide_item_ruby.test.fish b/tests/_tide_item_ruby.test.fish new file mode 100644 index 00000000..58396205 --- /dev/null +++ b/tests/_tide_item_ruby.test.fish @@ -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