So, I decided to give it a spin. First a couple of things:
- I wont be able to post everything I did in this post for the very simple reason I am not done
- I also intend this as a tutorial for newbies, who may be struggling with it (just as I did). Well, call me stupid :-) or slow - your pick. If you like this tutorial, please let me know
I indeed spent a lot of time going over old articles and tutorials that did not match the current state of merb.
Installation
Pre-requisites: Have Ruby and gem installed - which hopefully you do. Also, have a database installed. I like MySQL, and that is what is going to be used here.
Step 1: Install merb. You can do that using this command line:
$ sudo gem install merb --include-dependencies
This should install Merb. NOTE: As of writing the tutorial, Merb was on version 0.9.3. Things could change fast in the next major release and this tutorial could be useless (unless I update it).
Now, there are a couple of steps that you should also perform:
$ sudo gem sources -a http://merbivore.com
What this does is add merbivore.com to the list of place gem looks for when searching for updates to gems. Merb is a fast moving project, with lots of changes going in frequently. So, you may want to do this frequently as well:
$ sudo gem install merb activerecord merb_activerecord merb_helpers rspec merb_rspec
This will make sure the gems required for Merb are installed. Note that Merb supports three different ORM tools. However, I am familiar with ActiveRecord due to my Rails background, and that is what I am making sure in installed.
At this point, you should have Merb installed.
Step 2: Creating a Skeleton App
This is really simple and close to how you would do it in rails:
$ merb-gen app Helloworld
So there! merb-gen is a generator which does several useful things. Think of it as rails and script/generate in Rails. Now you should a bunch of directories inside the directory HelloWorld. Take a look, poke around. You will see some differences from Rails. The ones I noticed immediately were around lack of model information. No database.yml, no model directory, or migrations stuff. I didn't know whether to be happy or sad. But that we will discuss in the next part when I take the generated app and try and configure it.