Sunday, May 27, 2012

Working on an existing Rails application in Ubuntu 12.04

My previous post described environment setup.  This post will focus on getting an existing application up and running.


Getting the application

I'm using Aptana and the existing project is on a bitbucket Mercurial repo.  Using the IDE I checked out the application.


The following commands are run from inside the project directory structure.

Bundler

Use bundler to get the appropriate gems for the project (see the file Gemfile).  I initially got errors due to missing packages on the Ubuntu side (postgresql-server-dev-all was not installed).


$ bundle


Database setup

Create databases

Looking at database.yml I see which databases I need to create.  Mine are postgresql (see the adapter fields) and two different databases.  Using psql's CREATE DATABASE <database_name> command I set both the test and  development databases up.


Create role

I needed to create a role for my Linux user using CREATE ROLE <role_name>


Populate databases

I needed to add execjs and therubyracer to my Gemfile.  I also needed to add `, :require => false` after my shoulda and shoulda-context gems in Gemfile per https://gist.github.com/1549790.  Per the link it seems that the load worked fine without the require => false.


$ rake db:schema:load


Run the application

$ rails server


http://localhost:3000 will display the RoR welcome screen.  You'll have to modify the URL based on your application.


Dude, where's my gemset?

If the .rvmc file for the project on which your working specifies a gemset that you don't have and/or that you didn't use to install the proper gems you can copy the one you did have setup to match the one specified in the file.  This is especially helpful if you want to use the Terminal in Aptana.
I needed to manually rerun the ruby debug installation because that failed during the copy.

$ rvm gemset list
$ rvm gemset copy 1.9.3-p194@<existing_gemset> 1.9.3-p194@<.rvms_gemset>
$ export RVM_SRC=$HOME/.rvm/src/ruby-1.9.3-p194
$ gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=$RVM_SRC

No comments:

Post a Comment