Skip to content

Instantly share code, notes, and snippets.

@ryanyogan
Created August 7, 2011 21:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanyogan/1130800 to your computer and use it in GitHub Desktop.
Save ryanyogan/1130800 to your computer and use it in GitHub Desktop.
Pre-Requisites for Rails / Mongoid Tutorial
The following will get you up to speed for the Rails 3 / mongoid tutorial at the up coming MongoDB Chicago Meetup.
Please note at this time this writing is only for Unix based platforms (Linux, Mac OS X), I personally do not develop on Windows and will add to this once I find the best route, please feel free to notify me and let me know what you use on Windows to develop your Rails applications.
## RVM ## -- Step 1
RVM (Ruby Version Manager => http://beginrescueend.com/) is great, in fact it is the only tool I use to install and manage my Ruby / Ruby Gems on my development machines as well as on production servers. If you have not used RVM yet I will go over the basics to get Ruby 1.9.2 and Rails 3.1.rc4 on your machine, after this you should feel comfortable enough to check out the referenced documentation and play around with this excellent tool.
- Install RVM -
Open your terminal and paste the following command in:$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm) This process may take several minutes and will take care of all dependancies for you.
- Install Ruby 1.9.2 -
RVM should now be in your path, lets check by typing "rvm info" in the terminal, you should get a nice little snippet about some basics regarding RVM. To install Ruby type "rvm install ruby-1.9.2" this process will take a few minutes, grab a coffee or sit and watch the magic as RVM downloads and compiles Ruby from source. One of the beauties is that RVM will allow you to use multiple instances or different versions of Ruby as well as different versions of Rails, Sinatra, or any Gem. Once the process has completes type "ruby -v" in the terminal and you should see information about Ruby version 1.9.2. Good lets continue on to GemSets.
- Install Rails 3.1.rc4 -
At the time of this writing Rails 3.1.rc4 (Release Candidate 4) is the most up to date version of Rails 3.1, also there is Rails 3.0.10 but we will opt for Rails 3.1 as we are going to take advantage of some Rails 3.1 features such as "Coffeescript" in future tutorial iterations. So lets get Rails installed! We are going to create a gem set for this specific tutorial, think of a gem set as a big box you can throw all related gems in, we can use this gem set for our tutorial and you can easily switch to a different gem set if you want to use Rails 2.3, etc.. In your terminal type the following "rvm gemset create mongotutorial"
Now that we have created this gemset we want to "use" it, so we will specify that we want to use this however there is a catch if we use this gemset with our ruby version 1.9.2 it will only be used for the particular bash window we have open, for now we want this to be the default. I will discuss this more later. Lets go ahead for now and type the following into the termini "rvm use ruby-1.9.2@mongotutorial --default" notice the "--default" tag at the end this is telling RVM that we not only want to use Ruby 1.9.2 with our gemset mongotutorial but we also want it to be the default for every thing right now. This is fine you can always change this if you want to use a different gemset for a different project which I recommend you create a different gemset for every project.
We have an option here, since we are using Rails 3, we have "bundler" which means we don't have to install Rails right now, when we run "bundle install" within our Rails application all the gems we need and their dependancies will be installed into this gemset. For now lets just install the gem "bundler" so you can see that it will in fact be installed into the mongotutorial gemset. In the terminal type "gem install bundler" take note that we are not using "sudo" as RVM does not require this, if you were to run sudo you would override RVM and install the GEM to your local guby gems if ruby is installed locally as well as within RVM (this doesn't make much sense and I will edit this).
If you type "gem list" you should see bundler, if you type "rvm info" you should see that we are intact using the "mongotutorial" gemset.
- Cloning the boiler plate Rails 3.1 app from GitHub --
Currently this app does not exist and will be up here shortly as well as instructions on the basics of Git w/ installation for Mac & Linux.
- Installing MongoDB -
This will be added shortly, anyone can feel free to add on to this document.
@ryanyogan
Copy link
Author

This document will be formatted and updated within the next day or so, this is a rough draft.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment