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

Use different gem version on command line #80

Open
JuanitoFatas opened this issue Apr 8, 2014 · 16 comments
Open

Use different gem version on command line #80

JuanitoFatas opened this issue Apr 8, 2014 · 16 comments

Comments

@JuanitoFatas
Copy link
Contributor

Hello. I have installed rails 3.2.17, 4.0.4. When I call rails on command line it will use 4.0.4. I want to call 3.2.17 and find the answer in Stackoverflow:

$ rails _3.2.17_ new app

Is there any document on this feature? Thanks!

@knappe
Copy link

knappe commented Apr 9, 2014

Hey JuanitoFatas, you may want to look into RVM and gemsets.

https://rvm.io/gemsets/basics

Using gemsets, you can manage multiple versions of rails without the need to use undocumented hacks.

@JuanitoFatas
Copy link
Contributor Author

Thanks for the heads up, @knappe. You're right!

@drbrain
Copy link
Member

drbrain commented Apr 9, 2014

I think it's documented somewhere, but it isn't a hack.

I will check.

@drbrain drbrain reopened this Apr 9, 2014
@bf4
Copy link
Contributor

bf4 commented Apr 10, 2014

I don't think I've seen documentation for it. But its logic is included in all installed gem executables

@JuanitoFatas
Copy link
Contributor Author

As @bf4 points out (thanks), it's here: https://github.com/rubygems/rubygems/blob/master/lib/rubygems/installer.rb#L644. Should I add docs? Where is appropriate? Thanks.

@knappe
Copy link

knappe commented Apr 18, 2014

My point here is that RVM was designed for exactly this case. Ruby/gem managers (RVM, rbenv, ect) exist for to manage both ruby versions and gemsets.

This is common to every ruby project I've ever worked on whereas the underscore syntax is not. Why use a (to date) undocumented feature when tools exist to solve this problem and are widely used.

@JuanitoFatas
Copy link
Contributor Author

@knappe Yes, use RVM to manage different Ruby versions is better. But I found out this undocumented feature and think that maybe needs to be documented? So I opened this issue. Thanks for reply.

@knappe
Copy link

knappe commented Apr 18, 2014

That is my point though. I would rather steer people towards using a ruby/gem manager than using this 'feature', for all the reasons listed above.

@JuanitoFatas
Copy link
Contributor Author

@knappe I agree with you. Thanks. I will close this and left it undocumented in favor of gem manager.

@bf4
Copy link
Contributor

bf4 commented Apr 18, 2014

I think it would be nice to document somewhere. I've found it useful. If I have 5 versions of rake installed and I want to run a command as 0.8.7, rake _0.8.7_ is the way to go, for me. OTOH, anyone curious about how gems are executed will eventually see this code and know.

@drbrain
Copy link
Member

drbrain commented Apr 18, 2014

Documentation should be added to guides somewhere

@drbrain drbrain reopened this Apr 18, 2014
@strzibny
Copy link

strzibny commented May 4, 2014

I am also for documenting this. Saying that this should be left out in favor of Ruby managers doesn't make sense to me.

@JuanitoFatas
Copy link
Contributor Author

Thanks! Please document it. : )

@igneus
Copy link
Contributor

igneus commented Oct 17, 2020

This feature is already documented on the Command Reference page, in the section describing the gem install subcommand.

@igneus
Copy link
Contributor

igneus commented Oct 17, 2020

Is it still preferable to create, say, a new page discussing in detail how Rubygems decide which of multiple installed versions of a gem to activate, and mention there also the matter of specifying which version of an executable to use?

@deivid-rodriguez
Copy link
Member

I guess it would make sense to add a separate section, right before Command Reference with a general introduction to the gem CLI, including this kind of behaviour that's common to all gem commands?

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

No branches or pull requests

7 participants