<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-926178959556204128</id><updated>2011-11-27T15:23:24.735-08:00</updated><category term='ruby'/><category term='ruby1.9'/><category term='a merb application'/><category term='ubuntu'/><category term='installation'/><category term='merb'/><title type='text'>Adventures In Merb</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://adventuresinmerb.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/926178959556204128/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://adventuresinmerb.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>don buchanan</name><uri>http://www.blogger.com/profile/08218898914879705298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>4</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-926178959556204128.post-6694487851255640267</id><published>2009-07-29T14:57:00.001-07:00</published><updated>2009-07-30T14:32:20.969-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='merb'/><category scheme='http://www.blogger.com/atom/ns#' term='a merb application'/><title type='text'>Building a merb application, part two</title><content type='html'>&lt;p&gt;In &lt;a href="http://adventuresinmerb.blogspot.com/2009/07/building-merb-application-part-one.html"&gt;part 1&lt;/a&gt; we got our requirements and started building our first cucumber feature. We didn’t finish it so lets do that now. &lt;/p&gt;  &lt;p&gt;First job is the enhance the feature. We will have two scenarios now, one with a successful login, and one that accepts an invite. However we are going to get a lot repetition if we have to have all those log in steps for each feature. Luckily we can call steps from within steps. Modify the setup_steps.rb as follows. We have also filled in the I have an invite step. &lt;/p&gt;  &lt;div class="CodeRay"&gt;   &lt;div class="code"&gt;     &lt;pre&gt;&lt;span class="co"&gt;Given&lt;/span&gt; &lt;span class="rx"&gt;&lt;span class="dl"&gt;/&lt;/span&gt;&lt;span class="k"&gt;^I have an invite$&lt;/span&gt;&lt;span class="dl"&gt;/&lt;/span&gt;&lt;/span&gt; &lt;span class="r"&gt;do&lt;/span&gt;&lt;br /&gt;  &lt;span class="iv"&gt;@user&lt;/span&gt;.invites.build &lt;span class="r"&gt;if&lt;/span&gt; &lt;span class="iv"&gt;@user&lt;/span&gt;.invites.empty?&lt;br /&gt;&lt;span class="r"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="co"&gt;Given&lt;/span&gt; &lt;span class="rx"&gt;&lt;span class="dl"&gt;/&lt;/span&gt;&lt;span class="k"&gt;^I am logged in as &amp;quot;(.*)&amp;quot; with password &amp;quot;(.*)&amp;quot;$&lt;/span&gt;&lt;span class="dl"&gt;/&lt;/span&gt;&lt;/span&gt; &lt;span class="r"&gt;do&lt;/span&gt; |login,password|&lt;br /&gt;  &lt;span class="co"&gt;Given&lt;/span&gt; &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;I am not authenticated&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="co"&gt;And&lt;/span&gt; &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;I am a user &lt;/span&gt;&lt;span class="ch"&gt;\&amp;quot;&lt;/span&gt;&lt;span class="il"&gt;&lt;span class="idl"&gt;#{&lt;/span&gt;login&lt;span class="idl"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="ch"&gt;\&amp;quot;&lt;/span&gt;&lt;span class="k"&gt; with password &lt;/span&gt;&lt;span class="ch"&gt;\&amp;quot;&lt;/span&gt;&lt;span class="il"&gt;&lt;span class="idl"&gt;#{&lt;/span&gt;password&lt;span class="idl"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="ch"&gt;\&amp;quot;&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="co"&gt;And&lt;/span&gt; &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;I have an invite&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="co"&gt;And&lt;/span&gt; &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;I go to /invites&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="co"&gt;And&lt;/span&gt; &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;I fill in &lt;/span&gt;&lt;span class="ch"&gt;\&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;login&lt;/span&gt;&lt;span class="ch"&gt;\&amp;quot;&lt;/span&gt;&lt;span class="k"&gt; with &lt;/span&gt;&lt;span class="ch"&gt;\&amp;quot;&lt;/span&gt;&lt;span class="il"&gt;&lt;span class="idl"&gt;#{&lt;/span&gt;login&lt;span class="idl"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="ch"&gt;\&amp;quot;&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="co"&gt;And&lt;/span&gt; &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;I fill in &lt;/span&gt;&lt;span class="ch"&gt;\&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;password&lt;/span&gt;&lt;span class="ch"&gt;\&amp;quot;&lt;/span&gt;&lt;span class="k"&gt; with &lt;/span&gt;&lt;span class="ch"&gt;\&amp;quot;&lt;/span&gt;&lt;span class="il"&gt;&lt;span class="idl"&gt;#{&lt;/span&gt;password&lt;span class="idl"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;span class="ch"&gt;\&amp;quot;&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="co"&gt;And&lt;/span&gt; &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;I press &lt;/span&gt;&lt;span class="ch"&gt;\&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;Log In&lt;/span&gt;&lt;span class="ch"&gt;\&amp;quot;&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="r"&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;code&gt;&lt;br /&gt;  &lt;p&gt;Now our feature looks like this&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div class="CodeRay"&gt;&lt;br /&gt;    &lt;div class="code"&gt;&lt;br /&gt;      &lt;pre&gt;  &lt;span class="co"&gt;Scenario&lt;/span&gt;: &lt;span class="co"&gt;Login&lt;/span&gt; &lt;br /&gt;    &lt;span class="co"&gt;Given&lt;/span&gt; &lt;span class="co"&gt;I&lt;/span&gt; am logged &lt;span class="r"&gt;in&lt;/span&gt; as &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;myfriend&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; with password &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;apassword&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="co"&gt;Then&lt;/span&gt; &lt;span class="co"&gt;I&lt;/span&gt; should see &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;Are you coming?&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class="co"&gt;Scenario&lt;/span&gt;: &lt;span class="co"&gt;Accept&lt;/span&gt; &lt;span class="co"&gt;Invite&lt;/span&gt;&lt;br /&gt;    &lt;span class="co"&gt;Given&lt;/span&gt; &lt;span class="co"&gt;I&lt;/span&gt; am logged &lt;span class="r"&gt;in&lt;/span&gt; as &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;myfriend&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; with password &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;apassword&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="co"&gt;When&lt;/span&gt; &lt;span class="co"&gt;I&lt;/span&gt; press &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;I'm coming!&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="co"&gt;Then&lt;/span&gt; &lt;span class="co"&gt;I&lt;/span&gt; should see &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;Accepted invite!&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;    &lt;/div&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  &lt;p&gt;To pass the new feature we need to update the application. &lt;br /&gt;    &lt;br /&gt;First we need to add an accepted property to the Invite model. We’ll actually make this a datetime so we know when they accepted. &lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;Add this line to models/invite.rb, just under the belongs_to statement. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div class="CodeRay"&gt;&lt;br /&gt;    &lt;div class="code"&gt;&lt;br /&gt;      &lt;pre&gt;  property &lt;span class="sy"&gt;:accepted&lt;/span&gt;, &lt;span class="co"&gt;DateTime&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;    &lt;/div&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  &lt;p&gt;And in controllers/invites.rb, lets limit the invites to the current user.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;  &lt;div class="CodeRay"&gt;&lt;br /&gt;    &lt;div class="code"&gt;&lt;br /&gt;      &lt;pre&gt;  &lt;span class="r"&gt;def&lt;/span&gt; &lt;span class="fu"&gt;index&lt;/span&gt;&lt;br /&gt;    &lt;span class="iv"&gt;@invites&lt;/span&gt; = session.user.invites&lt;br /&gt;    display &lt;span class="iv"&gt;@invites&lt;/span&gt;&lt;br /&gt;  &lt;span class="r"&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;    &lt;/div&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;In views/invites/index.html.erb, add this &lt;br /&gt;&lt;br /&gt;  &lt;div class="CodeRay"&gt;&lt;br /&gt;    &lt;div class="code"&gt;&lt;br /&gt;      &lt;pre&gt;&lt;span class="il"&gt;&lt;span class="idl"&gt;&amp;lt;%&lt;/span&gt; invite = &lt;span class="iv"&gt;@invites&lt;/span&gt;.first &lt;span class="idl"&gt;%&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="il"&gt;&lt;span class="idl"&gt;&amp;lt;%=&lt;/span&gt; form_for invite, &lt;span class="sy"&gt;:action&lt;/span&gt; =&amp;gt; url(&lt;span class="sy"&gt;:invite&lt;/span&gt;,  invite) &lt;span class="r"&gt;do&lt;/span&gt; &lt;span class="idl"&gt;%&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="il"&gt;&lt;span class="idl"&gt;&amp;lt;%=&lt;/span&gt; hidden_field &lt;span class="sy"&gt;:accepted&lt;/span&gt;, &lt;span class="sy"&gt;:value&lt;/span&gt;=&amp;gt;&lt;span class="co"&gt;DateTime&lt;/span&gt;.now &lt;span class="idl"&gt;%&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="il"&gt;&lt;span class="idl"&gt;&amp;lt;%=&lt;/span&gt; submit &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;I'm coming!&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span class="idl"&gt;%&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="il"&gt;&lt;span class="idl"&gt;&amp;lt;%&lt;/span&gt; &lt;span class="r"&gt;end&lt;/span&gt; =&lt;span class="idl"&gt;%&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;    &lt;/div&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;br /&gt;  &lt;p&gt;Note that we are only using the first invite, because that’s all the feature requires to pass. For BDD, we write the absolute minimum to pass the tests. Now run our features again. We should get all green! &lt;br /&gt;    &lt;br /&gt;&amp;gt; rake features &lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;Part three will implement multiple invites.&lt;/p&gt;&lt;br /&gt;To get the code clone the repository (if you haven’t already done so) and check out this commit.&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&amp;gt; git clone git://github.com/donibuchanan/merb-rsvp.git&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&amp;gt; cd merb-rsvp&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&amp;gt; git checkout 67d5ebde343024baac5f0c5a704c5b3719f5310d  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/926178959556204128-6694487851255640267?l=adventuresinmerb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresinmerb.blogspot.com/feeds/6694487851255640267/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://adventuresinmerb.blogspot.com/2009/07/building-merb-application-part-two.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/926178959556204128/posts/default/6694487851255640267'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/926178959556204128/posts/default/6694487851255640267'/><link rel='alternate' type='text/html' href='http://adventuresinmerb.blogspot.com/2009/07/building-merb-application-part-two.html' title='Building a merb application, part two'/><author><name>don buchanan</name><uri>http://www.blogger.com/profile/08218898914879705298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-926178959556204128.post-5793428152495475442</id><published>2009-07-25T21:52:00.001-07:00</published><updated>2009-07-30T14:31:25.697-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='merb'/><category scheme='http://www.blogger.com/atom/ns#' term='a merb application'/><title type='text'>Building a Merb application, part one</title><content type='html'>&lt;p&gt;So we have the following requirements for a party invite app.&lt;/p&gt;  &lt;p&gt;&amp;quot;I want to be able to send invites to people via email or post, then I want them to hit the page and enter a code in the invite. After this they will be able to tick their name (or names in the case of a couple) as a way to RSVP.&lt;/p&gt;  &lt;p&gt;The dress up theme of this party is 'inappropriate' so I also want people to suggest something inappropriate to wear.&lt;/p&gt;  &lt;p&gt;When they submit the form they will be taken to a page with detailed party info and they will get a selection of suggestions by other guests.&amp;quot;&lt;/p&gt;  &lt;p&gt;lets create our project and submit it to source control&lt;/p&gt;  &lt;p&gt;&amp;gt; merb-gen app merb-rsvp&lt;/p&gt;  &lt;p&gt;&amp;gt; cd merb-rsvp&lt;/p&gt;  &lt;p&gt;Now we need to fix the dependencies file as detailed &lt;a href="http://adventuresinmerb.blogspot.com/2009/07/complete-guide-to-getting-merb-running.html"&gt;here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;merb_gems_version = &amp;quot;1.1&amp;quot;&lt;/p&gt;  &lt;p&gt;dm_gems_version&amp;#160;&amp;#160; = &amp;quot;0.9.11&amp;quot;&lt;/p&gt;  &lt;p&gt;do_gems_version&amp;#160;&amp;#160; = &amp;quot;0.9.12&amp;quot;&lt;/p&gt;  &lt;p&gt;lets run &lt;/p&gt;  &lt;p&gt;&amp;gt; rake db:automigrate&lt;/p&gt;  &lt;p&gt;And submit it to source control, in this case it is &lt;a href="http://github.com/donibuchanan/merb-rsvp/tree/master"&gt;http://github.com/donibuchanan/merb-rsvp/tree/master&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Ok so what's the very first thing we need? Before we get into admin, we'll work on the 'welcome' page. This will be a protected resource.&lt;/p&gt;  &lt;p&gt;So lets write the simplest possible user story. &lt;/p&gt;  &lt;p&gt;As an invitee &lt;/p&gt;  &lt;p&gt;I want login and accept my invite&lt;/p&gt;  &lt;p&gt;How does this translate to code? We use &lt;a href="http://wiki.github.com/aslakhellesoy/cucumber/merb"&gt;cucumber&lt;/a&gt;, lets install that&lt;/p&gt;  &lt;p&gt;&amp;gt; sudo aptitude install libxslt-dev libxml2 libxml2-dev&lt;/p&gt;  &lt;p&gt;&amp;gt; sudo gem install cucumber&lt;/p&gt;  &lt;p&gt;&amp;gt; sudo gem install roman-merb_cucumber&lt;/p&gt;  &lt;p&gt;&amp;gt; sudo gem install webrat&lt;/p&gt;  &lt;p&gt;&amp;gt; merb-gen cucumber --session_type webrat&lt;/p&gt;  &lt;p&gt;&amp;gt; merb-gen feature accept_invite&lt;/p&gt;  &lt;p&gt;Lets create a feature (which is a user story with different scenarios) to look like this&lt;/p&gt;  &lt;div class="CodeRay"&gt;   &lt;div class="code"&gt;     &lt;pre&gt;&lt;span class="co"&gt;Feature&lt;/span&gt;: accept invite&lt;br /&gt;&lt;br /&gt;  &lt;span class="co"&gt;To&lt;/span&gt; accept an invite&lt;br /&gt;&lt;br /&gt;  &lt;span class="co"&gt;An&lt;/span&gt; invitee&lt;br /&gt;&lt;br /&gt;  &lt;span class="co"&gt;Logs&lt;/span&gt; &lt;span class="r"&gt;in&lt;/span&gt; &lt;span class="r"&gt;and&lt;/span&gt; checks the &lt;span class="co"&gt;I&lt;/span&gt; accept box&lt;br /&gt;&lt;br /&gt;  &lt;span class="co"&gt;Scenario&lt;/span&gt;: &lt;span class="co"&gt;Login&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;    &lt;span class="co"&gt;Given&lt;/span&gt; &lt;span class="co"&gt;I&lt;/span&gt; am &lt;span class="r"&gt;not&lt;/span&gt; authenticated&lt;br /&gt;&lt;br /&gt;    &lt;span class="co"&gt;And&lt;/span&gt; &lt;span class="co"&gt;I&lt;/span&gt; am a user &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;myfriend&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; with password &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;apassword&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class="co"&gt;And&lt;/span&gt; &lt;span class="co"&gt;I&lt;/span&gt; have an invite&lt;br /&gt;&lt;br /&gt;    &lt;span class="co"&gt;When&lt;/span&gt; &lt;span class="co"&gt;I&lt;/span&gt; go to &lt;span class="rx"&gt;&lt;span class="dl"&gt;/&lt;/span&gt;&lt;span class="k"&gt;invites&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span class="co"&gt;And&lt;/span&gt; &lt;span class="co"&gt;I&lt;/span&gt; fill &lt;span class="r"&gt;in&lt;/span&gt; &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;login&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; with &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;myfriend&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class="co"&gt;And&lt;/span&gt; &lt;span class="co"&gt;I&lt;/span&gt; fill &lt;span class="r"&gt;in&lt;/span&gt; &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;password&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt; with &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;apassword&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class="co"&gt;And&lt;/span&gt; &lt;span class="co"&gt;I&lt;/span&gt; press &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;Log In&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class="co"&gt;Then&lt;/span&gt; &lt;span class="co"&gt;I&lt;/span&gt; should see &lt;span class="s"&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;Are you coming?&lt;/span&gt;&lt;span class="dl"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Before running features, we need to tweak the cucumber.rake file, located in lib/tasks. We change line 5 to&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="CodeRay"&gt;&lt;br /&gt;  &lt;div class="code"&gt;&lt;br /&gt;    &lt;pre&gt;t.binary = &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;/usr/local/bin/cucumber&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now run the feature&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;gt; rake features&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Its all yellow! Don't worry about the blue bits from the authentication feature, its actually running if you see the three green lines under Examples. &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Our feature is not very useful, we need to implement steps that match the text in the feature.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;We will create a file under features/steps called setup_steps.rb and put this in &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="CodeRay"&gt;&lt;br /&gt;  &lt;div class="code"&gt;&lt;br /&gt;    &lt;pre&gt;&lt;span class="co"&gt;Given&lt;/span&gt; &lt;span class="rx"&gt;&lt;span class="dl"&gt;/&lt;/span&gt;&lt;span class="k"&gt;^I am a user &amp;quot;(.*)&amp;quot; with password &amp;quot;(.*)&amp;quot;$&lt;/span&gt;&lt;span class="dl"&gt;/&lt;/span&gt;&lt;/span&gt; &lt;span class="r"&gt;do&lt;/span&gt; |login,password|&lt;br /&gt;&lt;br /&gt;  &lt;span class="iv"&gt;@user&lt;/span&gt; = &lt;span class="co"&gt;User&lt;/span&gt;.new(&lt;span class="sy"&gt;:login&lt;/span&gt;=&amp;gt;login)&lt;br /&gt;&lt;br /&gt;  &lt;span class="iv"&gt;@user&lt;/span&gt;.password = &lt;span class="iv"&gt;@user&lt;/span&gt;.password_confirmation = password&lt;br /&gt;&lt;br /&gt;  &lt;span class="iv"&gt;@user&lt;/span&gt;.save&lt;br /&gt;&lt;br /&gt;&lt;span class="r"&gt;end&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="co"&gt;Given&lt;/span&gt; &lt;span class="rx"&gt;&lt;span class="dl"&gt;/&lt;/span&gt;&lt;span class="k"&gt;^I have an invite$&lt;/span&gt;&lt;span class="dl"&gt;/&lt;/span&gt;&lt;/span&gt; &lt;span class="r"&gt;do&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class="c"&gt;#we haven't defined an invite object yet&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="r"&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;gt; rake features &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Gives us a couple of green lines and a bunch of red! This is good, now we build the app until it runs green.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;-----------&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;First up, lets create invites&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;gt; merb-gen resource invite&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Lets make a link between invites and users.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;In models/invite.rb add this before the &amp;quot;end&amp;quot;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="CodeRay"&gt;&lt;br /&gt;  &lt;div class="code"&gt;&lt;br /&gt;    &lt;pre&gt;belongs_to &lt;span class="sy"&gt;:user&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;and in user add&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="CodeRay"&gt;&lt;br /&gt;  &lt;div class="code"&gt;&lt;br /&gt;    &lt;pre&gt;has n, &lt;span class="sy"&gt;:invites&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Lets protect the invites resource and alter the index so it only shows the invites for the current user&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;In config/router.rb wrap the resources call in an authenticate block&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="CodeRay"&gt;&lt;br /&gt;  &lt;div class="code"&gt;&lt;br /&gt;    &lt;pre&gt;authenticate &lt;span class="r"&gt;do&lt;/span&gt;&lt;br /&gt;  resources &lt;span class="sy"&gt;:invites&lt;/span&gt;&lt;br /&gt;&lt;span class="r"&gt;end&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Lets update our invite step in setup_steps.rb for having an invite&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="CodeRay"&gt;&lt;br /&gt;  &lt;div class="code"&gt;&lt;br /&gt;    &lt;pre&gt;&lt;span class="co"&gt;Given&lt;/span&gt; &lt;span class="rx"&gt;&lt;span class="dl"&gt;/&lt;/span&gt;&lt;span class="k"&gt;^I have an invite$&lt;/span&gt;&lt;span class="dl"&gt;/&lt;/span&gt;&lt;/span&gt; &lt;span class="r"&gt;do&lt;/span&gt;&lt;br /&gt;  &lt;span class="iv"&gt;@user&lt;/span&gt;.invites.build &lt;span class="r"&gt;if&lt;/span&gt; &lt;span class="iv"&gt;@user&lt;/span&gt;.invites.empty?&lt;br /&gt;&lt;span class="r"&gt;end&lt;/span&gt;&amp;lt;&lt;span class="rx"&gt;&lt;span class="dl"&gt;/&lt;/span&gt;&lt;span class="k"&gt;p&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;In merb/merb-auth/setup.rb, mixin some redirect back functionality, just before the class Merb::Authentication part.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;# Mixin the redirect back mixin&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="CodeRay"&gt;&lt;br /&gt;  &lt;div class="code"&gt;&lt;br /&gt;    &lt;pre&gt;require &lt;span class="s"&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="k"&gt;merb-auth-more/mixins/redirect_back&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Finally lets add change the view so the feature will pass. Replace the contents on views/invites/index.html.erb with &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="CodeRay"&gt;&lt;br /&gt;  &lt;div class="code"&gt;&lt;br /&gt;    &lt;pre&gt;Are you coming?&lt;/pre&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now run features again&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;gt; rake features&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;4 scenarios (4 passed)&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;YES! I know it was the simplest of features but this was to give you an idea of what a feature was, if you haven't seen them before.&amp;#160; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;a href="http://adventuresinmerb.blogspot.com/2009/07/building-merb-application-part-two.html"&gt;Part two&lt;/a&gt; will complete the user story, currently the user is not accepting the invite.&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;To get the code clone the repository and check out this commit.&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&amp;gt; git clone git://github.com/donibuchanan/merb-rsvp.git&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&amp;gt; cd merb-rsvp&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&amp;gt; git checkout 8e6695ac746a67e01edb08f7fea4e48878b8d3d9&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/926178959556204128-5793428152495475442?l=adventuresinmerb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresinmerb.blogspot.com/feeds/5793428152495475442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://adventuresinmerb.blogspot.com/2009/07/building-merb-application-part-one.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/926178959556204128/posts/default/5793428152495475442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/926178959556204128/posts/default/5793428152495475442'/><link rel='alternate' type='text/html' href='http://adventuresinmerb.blogspot.com/2009/07/building-merb-application-part-one.html' title='Building a Merb application, part one'/><author><name>don buchanan</name><uri>http://www.blogger.com/profile/08218898914879705298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-926178959556204128.post-8053938840383393925</id><published>2009-07-22T04:36:00.001-07:00</published><updated>2009-07-22T04:36:37.426-07:00</updated><title type='text'>Pimp My Gedit, quickly</title><content type='html'>&lt;p&gt;We all know gedit is very basic and can be improved greatly, as detailed in &lt;a href="http://grigio.org/pimp_my_gedit_was_textmate_linux"&gt;Pimp my Gedit&lt;/a&gt;. However, there's other, and easier ways, of doing this. In addition, there's a lot of fiddling around with the instructions there, and I don't really use a lot of stuff he recommends chasing down. &lt;a href="http://github.com/lexrupy/gmate/tree/master"&gt;Gmate&lt;/a&gt; is a godsend, collecting up a bunch of stuff for gedit, very helpful. However, I like a different auto complete plugin so I've forked it &lt;a href="http://github.com/donibuchanan/gmate/tree/master"&gt;here&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;To download and install gmate, in a terminal, type:&lt;/p&gt;  &lt;p&gt;&amp;gt; git clone git://github.com/donibuchanan/gmate.git&lt;/p&gt;  &lt;p&gt;&amp;gt; cd gmate&lt;/p&gt;  &lt;p&gt;&amp;gt; sh install.sh&lt;/p&gt;  &lt;p&gt;Answer yes to everything. Now to set it up.&lt;/p&gt;  &lt;p&gt;Fire up gedit and go to Edit-&amp;gt;Preferences&lt;/p&gt;  &lt;p&gt;In the View tab make sure you have the following options checked&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_kWNabDKaFzY/Smb5it050TI/AAAAAAAAABM/M5GgsMRq0jI/s1600-h/view%5B4%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="view" border="0" alt="view" src="http://lh4.ggpht.com/_kWNabDKaFzY/Smb5kedA_ZI/AAAAAAAAABU/7mUBiDslAnw/view_thumb%5B2%5D.png?imgmax=800" width="300" height="368" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;In the Editor tab, make it look like this&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh3.ggpht.com/_kWNabDKaFzY/Smb5lDtEI4I/AAAAAAAAABY/9Rx7mpdxjns/s1600-h/Editor%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Editor" border="0" alt="Editor" src="http://lh6.ggpht.com/_kWNabDKaFzY/Smb5l1TINKI/AAAAAAAAABc/CQ2BYIP3Zz0/Editor_thumb%5B1%5D.png?imgmax=800" width="309" height="373" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Fonts and Colours do this: Of course you can choose different ones but I've found these to be the best&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lh5.ggpht.com/_kWNabDKaFzY/Smb5m5HvVkI/AAAAAAAAABg/50dpY2pWMxU/s1600-h/fonts%5B3%5D.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="fonts" border="0" alt="fonts" src="http://lh3.ggpht.com/_kWNabDKaFzY/Smb5nw8NZgI/AAAAAAAAABk/u1pEaSSl24Y/fonts_thumb%5B1%5D.png?imgmax=800" width="316" height="373" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Ok for the list of plugins, these are the ones I enable, you can choose different ones.&lt;/p&gt;  &lt;p&gt;Advanced Bookmarks   &lt;br /&gt;Autocomplete (this relies on open files, so keep those tabs open)    &lt;br /&gt;File Browser Pane    &lt;br /&gt;Find In Files    &lt;br /&gt;Gemini    &lt;br /&gt;Go to File (ctrl-alt-o to use)    &lt;br /&gt;Rails File Loader    &lt;br /&gt;Regex Search and Replace     &lt;br /&gt;Snippets (although i rarely use it)&lt;/p&gt;  &lt;p&gt;Feel free to play around with all the plugins and if you think I should be using one, please tell me! &lt;/p&gt;  &lt;p&gt;So now you have gedit, looking good and helping you out. Just make sure the root of you project is the root in the file browser pane.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/926178959556204128-8053938840383393925?l=adventuresinmerb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresinmerb.blogspot.com/feeds/8053938840383393925/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://adventuresinmerb.blogspot.com/2009/07/pimp-my-gedit-quickly.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/926178959556204128/posts/default/8053938840383393925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/926178959556204128/posts/default/8053938840383393925'/><link rel='alternate' type='text/html' href='http://adventuresinmerb.blogspot.com/2009/07/pimp-my-gedit-quickly.html' title='Pimp My Gedit, quickly'/><author><name>don buchanan</name><uri>http://www.blogger.com/profile/08218898914879705298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_kWNabDKaFzY/Smb5kedA_ZI/AAAAAAAAABU/7mUBiDslAnw/s72-c/view_thumb%5B2%5D.png?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-926178959556204128.post-222087694684133483</id><published>2009-07-21T15:22:00.001-07:00</published><updated>2009-08-07T22:33:10.259-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ruby'/><category scheme='http://www.blogger.com/atom/ns#' term='installation'/><category scheme='http://www.blogger.com/atom/ns#' term='merb'/><category scheme='http://www.blogger.com/atom/ns#' term='ruby1.9'/><category scheme='http://www.blogger.com/atom/ns#' term='ubuntu'/><title type='text'>The Complete Guide to getting Merb running on Ruby 1.9 with Ubuntu 9.04</title><content type='html'>&lt;p&gt;We are going to get &lt;a href="http://merbivore.com/"&gt;merb&lt;/a&gt; up and running with &lt;a href="http://www.ruby-lang.org/en/"&gt;ruby 1.9.1&lt;/a&gt; on &lt;a href="http://www.ubuntu.com/"&gt;ubuntu 9.04&lt;/a&gt;(Jaunty Jackalope). I'm not going to assume a lot of knowledge of ruby or merb and only basic knowledge of linux and ubuntu. I assume you know what a terminal is and how to get around the file system. This guide is in two parts, &lt;a href="http://www.blogger.com/post-edit.g?blogID=926178959556204128&amp;amp;postID=222087694684133483#part1"&gt;installing ruby&lt;/a&gt; and &lt;a href="http://www.blogger.com/post-edit.g?blogID=926178959556204128&amp;amp;postID=222087694684133483#part2"&gt;installing merb&lt;/a&gt;.&lt;/p&gt;  &lt;br /&gt;  &lt;h2 id="part1"&gt;Part one, installing Ruby 1.9.1&lt;/h2&gt; I've got a freshly installed copy of Ubuntu 9.04 here, so the very first thing to do is install the tools required to compile stuff. Fire up a terminal and type   &lt;p&gt;&lt;code&gt;&amp;gt; sudo aptitude install build-essential&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;Now to install ruby, unfortunately the ubuntu version of ruby is 1.9.0, which is a bit out of date, so we'll build ruby from sources.   &lt;br /&gt;Download ruby from &lt;/p&gt; &lt;a href="http://www.ruby-lang.org/en/downloads/"&gt;http://www.ruby-lang.org/en/downloads/&lt;/a&gt;, latest at time of writing is Ruby 1.9.1-p129.   &lt;p&gt;Extract the file, the exact file may differ&lt;/p&gt; &lt;code&gt;&amp;gt; tar -xvzf ruby-1.9.1-p129.tar.gz   &lt;br /&gt;&amp;gt; cd ruby-1.9.1-p129&lt;/code&gt;   &lt;p&gt;Now we're in the source of ruby, lets build it.   &lt;br /&gt;Before installing we need a couple of prerequisites for building ruby.&lt;/p&gt; &lt;code&gt;&amp;gt; sudo aptitude install libz1g-dev libssl-dev libreadline-dev&lt;/code&gt;   &lt;p&gt;Now type&lt;/p&gt;  &lt;p&gt;&lt;code&gt;&amp;gt; ./configure&lt;/code&gt; &lt;/p&gt;  &lt;p&gt;And you'll see a bunch of stuff, let it run.   &lt;br /&gt;    &lt;br /&gt;When its finished type &lt;/p&gt;  &lt;p&gt;&lt;code&gt;&amp;gt; make &lt;/code&gt;&lt;/p&gt;  &lt;p&gt;&lt;code&gt;&lt;/code&gt;and let that run. Ruby is built and ready to install.     &lt;br /&gt;    &lt;br /&gt;Before we install ruby, lets install &lt;a href="https://help.ubuntu.com/community/CheckInstall"&gt;checkinstall&lt;/a&gt;, this will allow us to cleanly remove our installation cleanly, in case we stuff things up, or we want to switch to the official ubuntu version later. Go head and install it.&lt;/p&gt; &lt;code&gt;&amp;gt; sudo aptitude install checkinstall&lt;/code&gt;  &lt;p&gt;Now run&lt;/p&gt;  &lt;p&gt;&lt;code&gt;&amp;gt; sudo checkinstall –pkgname libruby1.9     &lt;br /&gt;&amp;gt; Should I create a default set of package docs? Y       &lt;br /&gt;&amp;gt; End your description with an empty line or EOF       &lt;br /&gt;Ruby 1.9.1       &lt;br /&gt;&amp;gt; Enter a number to change any of them or press ENTER to continue: [press enter]       &lt;br /&gt;&amp;gt; Do you want me to list them? [n]: n       &lt;br /&gt;&amp;gt; Should I exclude them from the package? (Saying yes is a good idea) [y]: y&lt;/code&gt;&lt;/p&gt;  &lt;p&gt;It might take a while at &amp;quot;Copying files to the temporary directory&amp;quot; but it will finish eventually.   &lt;br /&gt;    &lt;br /&gt;Alright, ruby installed! Lets check it&lt;/p&gt; &lt;code&gt;&amp;gt; ruby -v   &lt;br /&gt;ruby 1.9.1p129 (2009-05-12 revision 23412) [x86_64-linux]&lt;/code&gt;   &lt;p&gt;YAY! Your output might be slightly different, especially if you’re on a 32bit system but don't worry about that.&lt;/p&gt;  &lt;h2 id="part2"&gt;Part Two, installing merb&lt;/h2&gt;  &lt;p&gt;Now to install merb.   &lt;br /&gt;Ruby stuff is all installed via a lovely tool called rubygems, which uses the command 'gem', not 'rubygems'. Lets see what version it is now.&lt;/p&gt; &lt;code&gt;&amp;gt; gem -v   &lt;br /&gt;1.3.1&lt;/code&gt;   &lt;p&gt;That’s slightly out of date, the current version is 1.3.5, lets update rubygems itself.&lt;/p&gt; &lt;code&gt;&amp;gt; sudo gem update --system&lt;/code&gt;   &lt;p&gt;We also need sqlite3 for our default database engine for merb so lets install that&lt;/p&gt; &lt;code&gt;&amp;gt; sudo aptitude install sqlite3 libsqlite3-dev&lt;/code&gt;   &lt;p&gt;Now, finally, we can install merb. We will install the standard package, which includes all our dependencies, and then upgrade to edge, which has some nice features and bug fixes. Ignore errors with the documentation installation.&lt;/p&gt;  &lt;p&gt;&lt;span style="font-family: monospace, serif; font-size: 13px" class="Apple-style-span"&gt;&amp;gt; sudo gem install merb     &lt;br /&gt;&amp;gt; sudo gem install merb --source &lt;a href="http://edge.merbivore.com/"&gt;http://edge.merbivore.com&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p&gt;MERB INSTALLED! Lets run something&lt;/p&gt; &lt;code&gt;&amp;gt; merb-gen app my_first_app   &lt;p&gt;/usr/local/lib/ruby/gems/1.9.1/gems/merb-core-1.0.12/lib/merb-core/dispatch/router/behavior.rb:18: warning: undefining `object_id' may cause serious problem      &lt;br /&gt;/usr/local/lib/ruby/gems/1.9.1/gems/merb-core-1.0.12/lib/merb-core/dispatch/router/behavior.rb:18: warning: undefining `__send__' may cause serious problem       &lt;br /&gt;/usr/local/lib/ruby/gems/1.9.1/gems/templater-0.5.0/lib/templater/core_ext/string.rb:5:in `realign_indentation': undefined method `to_a' for #&amp;lt;String:0x00000002cc7bb0&amp;gt; (NoMethodError)       &lt;br /&gt;. . . &lt;/p&gt;    &lt;p&gt;That didn’t work out too well!&lt;/p&gt;    &lt;p&gt;     &lt;br /&gt;&lt;/p&gt;    &lt;p&gt;Turns out we need to get the latest version of templater so first up we need git, a source control tool.&lt;/p&gt;    &lt;p&gt;&lt;code&gt;&amp;gt; sudo gem install git&lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;code&gt;&lt;/code&gt;Now run &lt;/p&gt;    &lt;p&gt;&lt;code&gt;&amp;gt; git clone git://github.com/jnicklas/templater.git        &lt;br /&gt;&amp;gt;        &lt;br /&gt;&amp;gt; gem build templater.gemspec         &lt;br /&gt;&amp;gt; sudo gem install templater-0.5.0.gem&lt;/code&gt; &lt;/p&gt;    &lt;p&gt;Lets also install this gem, i really have no idea what it does but its required :)&lt;/p&gt;    &lt;p&gt;&amp;gt; sudo gem install methopara&lt;/p&gt;    &lt;p&gt;Let’s try again&lt;/p&gt;    &lt;p&gt;&amp;gt; merb-gen app my_first_app&lt;/p&gt;   &lt;code&gt;SUCCESS!&lt;/code&gt;     &lt;p&gt;Let's try to run it.&lt;/p&gt;   &lt;code&gt;&amp;gt; cd my_first_app      &lt;br /&gt;&amp;gt; merb       &lt;br /&gt;Loading init file from /home/donibuchanan/Documents/my_first_app/config/init.rb       &lt;br /&gt;Loading /home/donibuchanan/Documents/my_first_app/config/environments/development.rb       &lt;br /&gt;~       &lt;br /&gt;~ &lt;span style="color: #ff0000"&gt;FATAL: The gem data_objects (= 0.9.11, runtime), [] was not found&lt;/span&gt;       &lt;br /&gt;~ &lt;/code&gt;    &lt;p&gt;Hrmm, thats not so good is it? Your error might be a bit different in terms of version numbers and the exact message. Turns out merb dependencies are really hard coded currently, so you have to go change them manually.&lt;/p&gt;    &lt;p&gt;First we will get version numbers we need so run&lt;/p&gt;    &lt;p&gt;&lt;code&gt;&amp;gt; gem list&lt;/code&gt; &lt;/p&gt;    &lt;p&gt;Note the version numbers for these gems, I've put the version I have currently      &lt;br /&gt;merb (1.1)       &lt;br /&gt;dm-core (0.9.11)       &lt;br /&gt;data_objects (0.9.12) &lt;/p&gt;    &lt;p&gt;We will run gedit to edit it. I'll write another article in beefing up gedit capabilities later on.&lt;/p&gt;   &lt;code&gt;&amp;gt; gedit config/dependencies.rb&lt;/code&gt;     &lt;p&gt;You'll need to edit these three lines to match the version numbers you noted before      &lt;br /&gt;merb_gems_version = &amp;quot;1.1&amp;quot;       &lt;br /&gt;dm_gems_version = &amp;quot;0.9.11&amp;quot;       &lt;br /&gt;do_gems_version = &amp;quot;0.9.12&amp;quot;&lt;/p&gt;    &lt;p&gt;Before we try again lets install thin and ( a web server)&lt;/p&gt;    &lt;p&gt;&lt;code&gt;&amp;gt; &lt;/code&gt;&lt;/p&gt;    &lt;p&gt;&lt;code&gt;&lt;/code&gt;And finally lets run it &lt;/p&gt;    &lt;p&gt;&lt;code&gt;&amp;gt; merb -a thin&lt;/code&gt; &lt;/p&gt;    &lt;p&gt;Browse to &lt;a href="http://localhost:4000/"&gt;http://localhost:4000&lt;/a&gt; and see the glory!       &lt;br /&gt;&lt;strong&gt;       &lt;br /&gt;IT LIVES!         &lt;br /&gt;&lt;/strong&gt;      &lt;br /&gt;What now? How about doing some examples from the &lt;a href="http://wiki.merbivore.com/#code_samples"&gt;samples page&lt;/a&gt;? Or start following &lt;a href="http://adventuresinmerb.blogspot.com/2009/07/building-merb-application-part-one.html"&gt;my sample app&lt;/a&gt;?&lt;/p&gt;&lt;/code&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/926178959556204128-222087694684133483?l=adventuresinmerb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://adventuresinmerb.blogspot.com/feeds/222087694684133483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://adventuresinmerb.blogspot.com/2009/07/complete-guide-to-getting-merb-running.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/926178959556204128/posts/default/222087694684133483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/926178959556204128/posts/default/222087694684133483'/><link rel='alternate' type='text/html' href='http://adventuresinmerb.blogspot.com/2009/07/complete-guide-to-getting-merb-running.html' title='The Complete Guide to getting Merb running on Ruby 1.9 with Ubuntu 9.04'/><author><name>don buchanan</name><uri>http://www.blogger.com/profile/08218898914879705298</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry></feed>
