I am using windows for rails.I installed pik for maintaining different versions of ruby.
But is there any possibility to create gemsets in PIK as in RVM?If not then how can i install different versions of rails?
Please help me..Thanks in advance!!!
Pik saved my life. I've been using rails 2.3.8 at work. I wanted to try the new rails 3.1 for my personal use. They told me to install RailsInstaller. But that screwed up all my rails 2.3.8 settings. So here's what I did.
I went to rubyinstaller. Downloaded installer for versions Ruby 1.8.7-p302 and Ruby 1.9.2-p290 installed them.
I installed both versions of ruby
then i installed the gem pik (see https://github.com/vertiginous/pik)
Now, I can switch between Ruby 1.8.7 and 1.9.2 using pik easily
pik 187 (switches to ruby 1.8.7)
So, I switched to ruby 1.8.7. and then installed rails 2.3.8
gem install rails -v 2.3.8
then i said pik 192 which switched the ruby to 1.9.2. Then i said
gem install rails -v 3.1.0
Now to use rails 2.3.8 all I have to do is say pik 187. Not only it switches ruby to 1.8.7 it also switches rails to 2.3.8
I am not a Ruby or Rails expert. But the key to remember is that you need to have the right Ruby version selected while installing rails. Meaning, if you're installing rails 3.1.0 make sure your current ruby version is 1.9.2 or higher or whatever version rails 3 works on. Similarly if you want to install rails 2.3.8 make sure your current ruby version is 1.8.7
Hope this helps. And people won't lose sleep because of this, like i did.
As far as I know, pik doesn't have this feature (yet).
As PIK is no longer maintained, see this commit comment. I would suggest to checkout URU to have version support in Windows (also supports linux and OSX)
Related
I am using Ruby 1.9.3p2 and Rails 4.0 versions on my Linux machine.
Recently we got an maintenance project which is on versions Ruby 1.8.7 and Rails 2.3.2.
I tried of installing rvm, after that it asked to install ree. But it goes on continuously increasing packages to install.
Please tell me if there is any way without using rvm.
Using a version manager is the best way. If you don't want to use rvm, you could try using rbenv, although I prefer rvm.
I git cloned an open source software and is currently planning to contribute to it. Originally I installed ruby 1.9.3 with rvm and installed gem install rails - which fetched version 4.0 (newest version)
I installed ruby 2.0 as well with rvm and did 'gem install rails' which also fetched me version 4.0
I was planning to installed ruby 1.9.3 with rails 3.2.13 - an older version of rails
to work with different software and switch between them using rvm
So since my open source software is written in 1.9.3 and rails 3.2.13, I tried
gem uninstall rails
and removed all the rails version
but when I do
rails-v ,
it is still 4.0
I figured out from another question that there are folders associated with 4.0 that I need to remove to remove 4.0, another question suggest that I install rails 3.2.13 but when I make a new app I can just do rails 3.2.13 new app etc. I installed that under 1.9.3 when I switch to 2.00 which still has 4.0, I tried rails 3.2.13 new app and it ran which I don't think it should.
I am growing semi-frustrated with this, and I wish someone can help me while I browse even more questions.
You should create a new gemset within rvm for this. That way you can use a different version of ruby and rails than your system default. Switch to ruby version 1.9.3 in RVM and then use rvm gemset create <name-here> and then rvm gemset use <name-here> to create and use the new gemset. Switch to the directory of the project you cloned and run bundle install to install all of the necessary gems, including rails (assuming the rails version is specified in the Gemfile.)
I have already installed Ruby 1.8.7 and Rails 2.3.8 which is working fine.
Now, I need to install Rails 3.2.8 in order to install a gem and my goal build the same compatible with Rails 2.3.8 based on how it is developed.
I tried installing Rails 3.2.8 using
gem install rails -v=3.2.8 -include-dependencies
but to my surprise when I checked gem list rails, it shows only Rails 2.3.8 and I'm unable to create a new app using rails 3.2.8 test.
I'm not sure but I read that Rails > 3.0 doesn't work well with Ruby 1.8.7 and needs Ruby>1.9
Rails 3.2 is compatible with Ruby 1.8.7. What you could do is have a ruby version manager like RVM or Rbenv. I use RVM but some people prefer Rbenv as it does not mess with your shell.
Using version managers will allow you to have different versions of ruby and with RVM you can create different gemsets for each specific version.
EDIT Here's the link for the release notes for rails 3.2 http://guides.rubyonrails.org/3_2_release_notes.html
EDIT
There's a couple of commands that you can use.
rvm list
will list the versions of ruby you have installed.
To install a version of ruby you'd do something like rvm install 1.9.3 to use that version you'd do something like rvm use 1.9.3 You can even specify patch levels and switch between different versions.
Now, rvm uses a concept of gemsets, to create a gemset you can set up an .rvmrc file in your project with the following command
rvm --create ruby-1.9.3-p286#some-project
it will create a set of gems called some-project where you can install whatever gem versions you want.
Notice that command can be ran from the command line as well. That will separate all the gems per project and you can switch between gemsets as you would ruby versions. Then in whichever gemset you'd just run gem install rails and the version
Your ruby version is good enough for both rails 2 & 3.
Try to create new app like below:
rails _3.2.8_ new appname
I use Vagrant and Chef to create new servers when I am developing. I want to start out on Ruby on Rails so I am setting up a server. Everything is working but Ubuntu and Rails are reporting different Ruby versions.
Ubuntu 12.04: ruby -v = ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]
Rails = 1.8.7 (x86_64-linux)
I don't want Ruby 1.8.7 on the system at all but I can't get rid of it. Is there anyway to set a default Ruby version?
I don't want top use RVM or similar.
try this aptitude purge ruby
and then install the latest version or the version you want
came across this post in stackoverflow
How do I make Ruby 1.9 the default Ruby on Ubuntu?
This did the trick.
https://github.com/royratcliffe/VagrantBaseBoxes
I am actually reading a rails book that is written for rails 2.3.5. I want to test Rails 3 beta as well. Is it possible to have such a setup in my Mac OS leopard?
I have tried with gem list -d rails. There are many versions stored in my mac but I don't know how to use different versions of rails while creating applications using rails command
While RVM is great there's no need for it in this use-case.
Install the Rails 3 gem: gem install rails—pre
Create new project: rails project_name (this will use the latest version installed)
To create projects with a specific version: rails _2.3.5_ project_name
Yes! Try rvm. It is awesome, you can have many different versions of Ruby, and for each one you can have different versions of gems. And you can run the same tests on all those versions. Isn't that cool?!
Quick How-To:
$ rvm install ruby-1.8.7 --default
$ gem install rails -v 1.0.0
$ rvm gemset create rails238
$ rvm 1.8.7#rails238
$ gem install rails -v 2.3.8
Now,
$ rvm 1.8.7
will give you ruby 1.8.7 and rails 1.0
And,
$ rvm 1.8.7#rails238
will give you ruby 1.8.7 and rails 2.3.8
You can make 2.3.8 as default one with
$ rvm use 1.8.7#rails238 --default
BTW rvm is documented really good.
The way to do this anymore is to use RVM, the Ruby Version Manager, which isolates different Ruby environments from each other.
A coworker of mine did a blog entry on setting up Rails 3 and RVM (and Ruby 1.9), which you might find interesting.