RVM question

52 views
Skip to first unread message

jmcguckin

unread,
Apr 18, 2015, 9:06:08 PM4/18/15
to rubyonra...@googlegroups.com
I have a bit of a chicken & egg problem:

Assume I have a top level directory for all my Rails projects. Each project might be using a different version of Ruby and Rails.

How do I run a "rails new foo" with the correct ruby version and gemset?

Is there some sort of cmd line argument I can use? 

-joe

Norbert Melzer

unread,
Apr 19, 2015, 3:06:11 AM4/19/15
to Rails Mailinglist

rvm use version@gemset

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/8e509489-2cd8-4d76-aacb-dabc7a0e4376%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Antônio Augusto Sousa Britto

unread,
Apr 22, 2015, 8:13:44 AM4/22/15
to rubyonra...@googlegroups.com
You could also create a custom .rvmrc file for each project folder, in which you could specify the ruby version and gemset to use (or create if doesn't exist'). 

Frederick Cheung

unread,
Apr 22, 2015, 5:21:16 PM4/22/15
to rubyonra...@googlegroups.com
On Sunday, April 19, 2015 at 2:06:08 AM UTC+1, jmcguckin wrote:

>
>
> How do I run a "rails new foo" with the correct ruby version and gemset?
>
>
> Is there some sort of cmd line argument I can use? 
>


rails _4.1.10_ new

Should invoke that version of the rails executable (this is a rubygems thing - it should work with any executable provided by a gem.

Fred



>
> -joe

Joshua Rivers

unread,
Jun 3, 2015, 1:32:32 AM6/3/15
to rubyonra...@googlegroups.com
I always begin new rails projects by first creating the project directory

$ mkdir foo
$ cd foo/

$foo/ 

Once in the directory I make a .ruby-version and .ruby-gemset file

$foo/ touch .ruby-version .ruby-gemset

In the ruby-version file you just specify the version of ruby you wish to use 

2.2.1

and the ruby-gemset file you name the gemset you'd like to use

fooapp

Once you have those saved you can reload the current directory by 

$foo/ cd .

Then just rails new . and then bundle install
 
Reply all
Reply to author
Forward
0 new messages