Skip to content
This repository has been archived by the owner on Feb 3, 2021. It is now read-only.

Add support for chruby #46

Merged
merged 1 commit into from
Jul 6, 2018
Merged

Add support for chruby #46

merged 1 commit into from
Jul 6, 2018

Conversation

avegancafe
Copy link
Contributor

@avegancafe avegancafe commented Jul 6, 2018

Description

This adds support for chruby in the ruby version section

screen shot 2018-07-06 at 12 15 38 am

Motivation and Context

Helps close #35

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Screenshots (if appropriate):

How Has This Been Tested?

  • I have tested using MacOS
  • I have tested using Linux

Checklist:

  • I have checked that no other PR duplicates mine
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.

@avegancafe
Copy link
Contributor Author

For reference, this is where $RUBY_AUTO_VERSION is set in chruby: https://github.com/postmodern/chruby/blob/83431e73c9e747eb6117496319ec87bb339963f6/share/chruby/auto.sh#L14

Copy link
Collaborator

@tiffafoo tiffafoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution 🐟❤️! Looking good, just small oddities that may need fixing. I also wanted to note we don't have ruby tests yet (spacefish/tests/). If you would like to add those tests, feel free!

@@ -12,7 +12,7 @@ function __sf_section_ruby -d "Show current version of Ruby"
__sf_util_set_default SPACEFISH_RUBY_SHOW true
__sf_util_set_default SPACEFISH_RUBY_PREFIX $SPACEFISH_PROMPT_DEFAULT_PREFIX
__sf_util_set_default SPACEFISH_RUBY_SUFFIX $SPACEFISH_PROMPT_DEFAULT_SUFFIX
__sf_util_set_default SPACEFISH_RUBY_SYMBOL "💎 "
__sf_util_set_default SPACEFISH_RUBY_SYMBOL "💎 "
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason this extra space was added?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, maybe it's just my font, but this looked super weird with a monospace font. I'm fine removing this, just thought it looked better. Here's what it looks like without the space:

screen shot 2018-07-06 at 12 41 35 am

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep I agree! However spacefish's philosophy is to follow spaceship's standards as much as possible. So it would be up to the individual user to decide if they want to change the default one space.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh man I totally misunderstood what was going on, sounds great! I'll remove this.

Copy link
Owner

@matchai matchai Jul 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, thanks @matchai !

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turns out I actually can't use this setting @matchai :( I'm using powerline fonts and it messes with those characters

@@ -29,6 +29,8 @@ function __sf_section_ruby -d "Show current version of Ruby"
set ruby_version (rvm-prompt i v g)
else if type -q rbenv
set ruby_version (rbenv version-name)
else if type -q chruby
set ruby_version (echo $RUBY_AUTO_VERSION)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like the indentation for these added lines is off, we use tabs, equivalent to 4 spaces I believe.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh man I totally missed this! My bad, I'll swap these to tabs

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haha yeah just noticed that. Removed in the latest commit

@@ -29,6 +29,8 @@ function __sf_section_ruby -d "Show current version of Ruby"
set ruby_version (rvm-prompt i v g)
else if type -q rbenv
set ruby_version (rbenv version-name)
else if type -q chruby
set ruby_version (echo $RUBY_AUTO_VERSION)

This comment was marked as outdated.

@matchai matchai merged commit 7d7d966 into matchai:master Jul 6, 2018
@matchai
Copy link
Owner

matchai commented Jul 6, 2018

Thank you for the contribution @kyleholzinger!

@avegancafe
Copy link
Contributor Author

Of course @matchai !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement prompt section for ruby version
3 participants