I started a Ruby on Rails project with Rails version 3.2.12. But i did not really much in this project because of my time. My day has not enough hours 🙂 I played around with TeamCity and Jenkins as CI server and how i can deploy it to EC. How to setup everything on AWS EC2 and so on. Now, i just found out that there Rails 4.0.0.beta1 ist out. So i thought, why not update to Rails 4.0 and then start with the project 🙂 So, here is how i get there.

I assume that you have a Rails 3.2.12 installed. If not see my other blogs: Install a Ruby on Rails Dev Environment on Mac OS X 10.8.2 or Install Ruby and Ruby on Rails on Ubuntu 12.04 (also for AWS EC2).

I will describe how you create your own Gemsets, update to Ruby 2.0 and Rails 3.2.13 and then to 4.0. Gemsets are pretty useful, because this way you can switch the versions without problems. Its true, i tried it 🙂 We will also create a .rvmrc file to specify which Gemset should be used in this project. So lets start with it 🙂

 

Lets assume you have Ruby 1.9.3-p392 and Rails 3.2.12 installed and created a project like this:

So we have a clean Rails project. So it looks similar in my project 🙂

 

Update Gems

So, lets check if we have the correct versions for Ruby 2.0 and Rails 4.0

We will need RubyGems 2.0.3 or newer, so update if you have an older Version:

check for other versions with

you will need the following versions:

  • RubyGems 2.0.3
  • Rake 10.0.3
  • Bundler 1.3.4
  • Rubygems-Bundler 1.1.1

update it with following commands:

 

Create Gemset for our existing Application

If you never created a Gemset, you are using propably the default or global one. Check with:

Now, lets create one for our existing Application with Ruby 1.9.3-p392 and Rails 3.2.12

So, we also want to work with that Gemset so use it:

 

Update to Ruby 2.0 and Rails 3.2.13

Now we are ready to update to Ruby 2.0 and Rails 3.2.13.

Install Ruby 2.0

Create a new Gemset

Check which Gemset you are using:

Install Rails 3.2.13

Do not forget to update your Gemfile in your project with the new Rails version and then update your Gems:

Now, this Gemset is ready for use. If you want to test any other application with Ruby 2.0 and Rails 3.2.13, just use this Gemset:

But, then you will maybe create a generic name without MyApp after the rails version.

Update to Rails 4.0.0.beta1

Now lets update to Rails 4.0.0

Again, update your Gemfile to Rails 4.0.0 version and

and fix problem. I do not want to explain it here because its not possible to have it here for all problems.. but please leave a comment.

In this way, you are also able to update to the Rails 4.0.0 or higher version when its out! Take a look on: http://rubygems.org/gems/rails

 

Adding an .rvmrc File to your Application

Create a file in the root folder of your project

and add the Gemset you want to use to that file

So now you can always just update this file and the App will choose the correct Gemset!

 

 

So, enjoy and leave comments if you have additions. I will try to update this site than.

 

Update 2013-March 25: Visit also http://railsapps.github.com/installing-rails.html

 

Update: Copied from: http://railsapps.github.com/updating-rails.html

Rake Rails:Update

Minor Rails version updates seldom require changes to configuration files. Major Rails updates often change configuration files. If you don’t make the required configuration file changes, you’ll likely see deprecation warnings when you launch a Rails application.

Rails provides a rake task to update configuration files. Be sure you’ve committed your application with git before running rake rails:update in case you need to roll back changes.

The rake rails:update will identify every configuration file in your application that differs from a new Rails application. When it detects a conflict, it will offer to overwrite your file.

Don’t blindly allow rake rails:update to overwrite your files. Many of your files will be different because you’ve made changes from a default new Rails application. You’ll need to check each file to determine if rake rails:update is seeing your own changes or pointing out changes due to a Rails update.

When rake rails:update offers to overwrite a file, enter d (for “diff”) and review the differences. Most differences will be your own. If you’re uncertain, don’t overwrite the file; make a note for yourself and investigate later. If you are certain that the difference is due to a Rails version change, you can allow rake rails:update to overwrite the file.

 

 

Update Rails 3.2.12 projects to Rails 4.0.0.beta1 and Ruby 2.0 via 3.2.13
Tagged on:     

Leave a Reply

Follow

Get every new post on this blog delivered to your Inbox.

Join other followers:

Welcome Damir Kusar

Log in

Lost your password?
%d bloggers like this: