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

Default ruby #30

Closed
postmodern opened this issue Dec 10, 2012 · 19 comments
Closed

Default ruby #30

postmodern opened this issue Dec 10, 2012 · 19 comments
Assignees
Milestone

Comments

@postmodern
Copy link
Owner

Should we support a default ruby? Currently users have to add chruby 1.9 to their ~/.bashrc or global config. Alternatively, users could run chruby $(cat ~/.ruby)?

@ghost ghost assigned postmodern Dec 10, 2012
@wilmoore
Copy link
Contributor

I'm thinking yes...

Perhaps check for a $HOME/.ruby, if it exists, use it, otherwise, try to default to something (system). Less confusion for those getting started, but good options for those that need something more specific. Of course, the option to do chruby $(cat ~/.ruby) continues to be available for those that prefer that workflow.

@postmodern
Copy link
Owner Author

Also, what is the preferred file for specifying (fuzzy) Ruby versions: .ruby or .ruby-version? I know rbfu supports .ruby-version, yet most people use .rbenv-version.

@wilmoore
Copy link
Contributor

I feel in my gut that .<language-version> is the right thing to do and everything else is an anti-pattern; however, given there is much mind-share already (shame on them for not being generic in the first place), I would say:

  • .ruby-version (default)
  • .rbenv-version (for compat)
  • .whatever-else-is-popular (for compat)

@postmodern
Copy link
Owner Author

I'm starting to think of not supporting rbenv-version, since rbenv/ruby-build uses specific names for their Rubies; I prefer the full NAME-VERSION form. I like the idea of standardizing on a .ruby-version containing (RUBY-)?(X(.Y(.Z)?)?)?.

@postmodern
Copy link
Owner Author

Looks like @mpapis already requested .ruby-version support in rbenv, 10 months ago. There's even a Pull Request for this.

@wilmoore
Copy link
Contributor

Interesting that it's still open. Seems like that should have gotten merged post-haste.

@mpapis
Copy link
Contributor

mpapis commented Dec 11, 2012

I would vote for .ruby-version over .ruby - just try to follow existing conventions ;) and .ruby could be some dir with either rubies or configurations, so might be conflicting.

@wilmoore
Copy link
Contributor

.ruby-version 👍

@postmodern
Copy link
Owner Author

So now to shoe-horn this functionality into the chruby function. What do you think about being able to pass a directory to chruby, which is then checked for .ruby-version?

chruby .
chruby ~
chruby /path/to/project

Or should we only allow a keyword that indicates to check for $PWD/.ruby-version, such as chruby project, chruby local, chruby .?

@mpapis
Copy link
Contributor

mpapis commented Dec 11, 2012

try to keep it simple, rvm allows all the kind path/file loading, including:

rvm in /path do command...

which will cd to the dir, load project file and execute the command there.


if you are about to allow chruby project which will default to $PWD/.ruby-version you could easily make it chruby project [path] with %{1:-$PWD}.

@wilmoore
Copy link
Contributor

  • chruby local seems like magic to avoid.
  • chruby . is pretty intention revealing and concise and should be equivalent to chruby $PWD.
  • as such, to mitigate confusion, it should also be allowed to do chruby /path/to/project or chruby /path/to/whatever.

@mpapis
Copy link
Contributor

mpapis commented Dec 11, 2012

@wilmoore 👍

@postmodern
Copy link
Owner Author

@wilmoore what about the off chance you're working in a project that has a jruby directory? What should take precedence, check for jruby/.ruby-version or fuzzy matching for jruby in RUBIES.

@mpapis
Copy link
Contributor

mpapis commented Dec 11, 2012

@postmodern matching rubies should have precedence, you can always say it's path with ./jruby

@wilmoore
Copy link
Contributor

Yup, what @mpapis said :)

@postmodern
Copy link
Owner Author

Just realized this. . will always fuzzy match the first Ruby. :) So directory matching should happen last, or this feature should be implemented in auto-switching by hooking cd/chpwd.

@postmodern
Copy link
Owner Author

If we decide to keep manual loading of .ruby-version, it should probably be in a separate function/script. Given chruby NAME, NAME should directly map to a Ruby by name/version.

@mpapis
Copy link
Contributor

mpapis commented Dec 12, 2012

maybe consider replacing . to - or anything else so the unix meaning of . is preserved for directories and you can still match any ruby ... or use ./. for current dir ;)

@postmodern
Copy link
Owner Author

Closing this in favour of chruby $(cat .chruby) in .bashrc and Auto-Switching on chdir (issue #40).

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

No branches or pull requests

3 participants