<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>has_many :thoughts: Tag thin</title>
    <link>http://blog.kineticweb.com/articles/tag/thin</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Musings from a Ruby on Rails development team</description>
    <item>
      <title>Starting to Get Thin, v0.6.3</title>
      <description>&lt;p&gt;When I first heard about Thin I was slightly intrigued, but less enthusiastic when I attempted to run it (not sure what version). Anyway, now that Thin has matured a bit more, and Merb 0.9 is bringing the love of &lt;a href="http://rack.rubyforge.org/"&gt;Rack&lt;/a&gt; to the masses&amp;#8230; I&amp;#8217;m &lt;strong&gt;really&lt;/strong&gt; &lt;strong&gt;really&lt;/strong&gt; &lt;strong&gt;really&lt;/strong&gt; starting to see what all the fuss is about. 3000+ requests a second of fuss.&lt;/p&gt;


	&lt;h2&gt;The Skinny&lt;/h2&gt;


	&lt;p&gt;Thin is actually a mash-up of current back-end web serving technologies.&lt;/p&gt;


&lt;ol&gt;
&lt;li&gt;the Mongrel parser, I&amp;#8217;m &lt;strong&gt;speculating&lt;/strong&gt; its the &lt;a href="http://www.cs.queensu.ca/~thurston/ragel/"&gt;Ragel executable state machine&lt;/a&gt; portion&lt;/li&gt;
&lt;li&gt;Event Machine, and the tough, concurrent service request handling of the &lt;a href="http://www.cs.wustl.edu/~schmidt/PDF/reactor-siemens.pdf"&gt;Reactor Pattern&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;and Rack, our new hero which brings a common &lt;a href="http://en.wikipedia.org/wiki/Web_Server_Gateway_Interface"&gt;web server gateway interface&lt;/a&gt; to all of our favorite Ruby web frameworks.&lt;/li&gt;
&lt;/ol&gt;

	&lt;p&gt;Fancy technologies (and citations), but how&amp;#8217;s this going to help good&amp;#8217;ole &lt;a href="http://www.peepcode.com"&gt;Geoffrey Grosenbach&lt;/a&gt;?&lt;/p&gt;


	&lt;h2&gt;Installation&lt;/h2&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;$ sudo gem install thin&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt; 

	&lt;p&gt;...or if you know what your doing&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;$ git clone git://github.com/macournoyer/thin.git&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;&lt;small&gt;If not, go directly to &lt;span class="caps"&gt;FAIL&lt;/span&gt;&amp;#8230;&lt;/small&gt;&lt;/p&gt;


	&lt;h2&gt;Show&amp;#8217;em Some Ruby&lt;/h2&gt;


	&lt;p&gt;Lets take a quick glimpse at the adapter example that is included with the gem (&lt;small&gt;examples/adapter.rb&lt;/small&gt;).&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ll try not to ramble on about Rack too long but&amp;#8230; This really shows you how damn simple it can be to plug and play applications into a Rack stack, and the power that Thin brings along with its speed!&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="constant"&gt;File&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;dirname&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="constant"&gt;__FILE__&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt; &lt;span class="punct"&gt;+&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;/../lib/thin&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;

&lt;span class="keyword"&gt;class &lt;/span&gt;&lt;span class="class"&gt;SimpleAdapter&lt;/span&gt;
  &lt;span class="keyword"&gt;def &lt;/span&gt;&lt;span class="method"&gt;call&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="ident"&gt;env&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;
    &lt;span class="ident"&gt;body&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;[&amp;quot;&lt;/span&gt;&lt;span class="string"&gt;hello!&lt;/span&gt;&lt;span class="punct"&gt;&amp;quot;]&lt;/span&gt;
      &lt;span class="punct"&gt;[&lt;/span&gt;      &lt;span class="number"&gt;200&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt;  
        &lt;span class="punct"&gt;{&lt;/span&gt;
          &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;Content-Type&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;   &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;text/plain&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt;
          &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;Content-Length&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="ident"&gt;body&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;join&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;size&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;to_s&lt;/span&gt;&lt;span class="punct"&gt;,&lt;/span&gt;
        &lt;span class="punct"&gt;},&lt;/span&gt; &lt;span class="ident"&gt;body&lt;/span&gt;
      &lt;span class="punct"&gt;]&lt;/span&gt;  
   &lt;span class="keyword"&gt;end&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt; 

&lt;span class="constant"&gt;Thin&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Server&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;start&lt;/span&gt;&lt;span class="punct"&gt;('&lt;/span&gt;&lt;span class="string"&gt;0.0.0.0&lt;/span&gt;&lt;span class="punct"&gt;',&lt;/span&gt; &lt;span class="number"&gt;3000&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt;  

  &lt;span class="ident"&gt;use&lt;/span&gt; &lt;span class="constant"&gt;Rack&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;CommonLogger&lt;/span&gt;

  &lt;span class="ident"&gt;map&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;/test&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt;    
    &lt;span class="ident"&gt;run&lt;/span&gt; &lt;span class="constant"&gt;SimpleAdapter&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;new&lt;/span&gt;  
  &lt;span class="keyword"&gt;end&lt;/span&gt;  

  &lt;span class="ident"&gt;map&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;/files&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt;    
    &lt;span class="ident"&gt;run&lt;/span&gt; &lt;span class="constant"&gt;Rack&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;File&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;new&lt;/span&gt;&lt;span class="punct"&gt;('&lt;/span&gt;&lt;span class="string"&gt;.&lt;/span&gt;&lt;span class="punct"&gt;')&lt;/span&gt;  
  &lt;span class="keyword"&gt;end&lt;/span&gt;

  &lt;span class="ident"&gt;run&lt;/span&gt; &lt;span class="constant"&gt;Rack&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Adapter&lt;/span&gt;&lt;span class="punct"&gt;::&lt;/span&gt;&lt;span class="constant"&gt;Rails&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;new&lt;/span&gt;&lt;span class="punct"&gt;(&lt;/span&gt;&lt;span class="symbol"&gt;:root&lt;/span&gt; &lt;span class="punct"&gt;=&amp;gt;&lt;/span&gt; &#8216;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="regex"&gt;Users&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;justin&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;apps&lt;/span&gt;&lt;span class="punct"&gt;/&lt;/span&gt;&lt;span class="ident"&gt;whatsyomammabeensmokin&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;com&#8216;&lt;/span&gt;&lt;span class="punct"&gt;)&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Very briefly, this example is a thin/Thin adapter specification and server initialization. Its also an insanely small example of a Rack adapter (&lt;small&gt;which may, or may not work; reference the real examples in the gem&lt;/small&gt;).&lt;/p&gt;


	&lt;p&gt;We can see, after loading our necessary library file, we create a class used as an adapter, called SimpleAdapter.&lt;/p&gt;


	&lt;p&gt;This holds in it a means to handle status code 200 requests. With a simple output of plain text content-type, set in its header hash. It also includes a simple body of text, &amp;#8220;hello!&amp;#8221; to be returned as content. Literally the Rack adapter, handling a request, need only return this sort of array as a response. [status, header, body].&lt;/p&gt;


	&lt;p&gt;Finishing up the script is Thin&amp;#8217;s server stack initialization. Resembling a Rack config.ru configuration file, Thin initializes a server for our localhost on port 3000. As well as some middle ware setups using our SimpleAdapter.&lt;/p&gt;


	&lt;p&gt;First, inside the setup block you should quickly notice a few &amp;#8220;map&amp;#8221; method calls that resemble Rails routes. &amp;#8220;map&amp;#8221; is actually just that, a simple way to set Rack::URLMap&amp;#8217;s, or web &lt;span class="caps"&gt;URI&lt;/span&gt; paths, inside the main server start block.&lt;/p&gt;


	&lt;p&gt;Second, the &amp;#8220;use&amp;#8221; method actually adds middle ware to the stack.&lt;/p&gt;


	&lt;p&gt;Finally, notice &amp;#8220;run&amp;#8221;. This literally dispatches middle ware logic to the server.&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;ve taken the liberty of adding a call to a local Rails application to point out how easy it is to include new applications straight into a running Rack/Thin server stack. Pretty much just as easy as it is to &amp;#8220;include&amp;#8221; a mix-in into a class in Ruby.&lt;/p&gt;


	&lt;p&gt;If you would like to work more closely with some real code, take a look &lt;a href="http://macournoyer.wordpress.com/2008/02/09/the-flexible-thin-anorexic-gymnast-that-democratized-deployment/"&gt;here&amp;#8230;&lt;/a&gt;&lt;/p&gt;


	&lt;h2&gt;Thin Rails&lt;/h2&gt;


	&lt;p&gt;Ok&amp;#8230; woosh, back to the easy stuff&amp;#8230;&lt;/p&gt;


	&lt;p&gt;Since Thin supports Rails natively through what I believe is an included Rack adapter&amp;#8230; you can start playing with it right out of the box on any of your current Rails projects.&lt;/p&gt;


	&lt;p&gt;Once you have the Thin gem installed, simply do a&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;$ thin start&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;If you&amp;#8217;d like to explicitly set your Rails environment&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;$ thin start -e development&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;&amp;#8220;&amp;#8212;help&amp;#8221; provides more information as usual. Thin&amp;#8217;s main site has a lovely amount of info with a beautiful web design. Be it tiny lil text (get it, thin).&lt;/p&gt;


	&lt;p&gt;You can also try out a middle ware script that comes with Thin called &amp;#8220;stats&amp;#8221;.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;$ thin --stats=/public_thin/stats start&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;This will give you a technical details of your Thin server stats, map&amp;#8217;d to &amp;#8220;localhost:3000/public_thin/stats&amp;#8221;.&lt;/p&gt;


	&lt;h2&gt;To Deployment, and Beyond&lt;/h2&gt;


	&lt;p&gt;I have yet to really attempt a deployment with Thin, but I have one coming up shortly to assist with and will definitely be trying this out.&lt;/p&gt;


	&lt;p&gt;From what I&amp;#8217;ve read you can just as easily replace mongrel_cluster with thin like so.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;# thin config -C config/thin.yml --servers 3 --port 5000 --chdir ...
# thin start -C config/thin.yml&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;If anyone has tried this yet please let me know how it went.&lt;/p&gt;


	&lt;h2&gt;The Year 2000&lt;/h2&gt;


	&lt;p&gt;Hopefully your interested now and will check into this speedy fast Mongrel replacement. Did I even mention it was fast&amp;#8230;? &amp;gt;;)&lt;/p&gt;


	&lt;p&gt;In the near future I&amp;#8217;ll attempt to report back on deployments and middle ware scripts. I&amp;#8217;m eager to see what useful little apps I can come up with that sit between the web server and my actual Rails application. But I can imagine 8 bazillion possibilities (especially logging and transparent statistics harvesting).&lt;/p&gt;


	&lt;p&gt;So yeah&amp;#8230; cheers to the author!!&lt;/p&gt;</description>
      <pubDate>Tue, 12 Feb 2008 22:16:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:2dbbe8c9-a52c-4652-b5f3-6ad131491c12</guid>
      <author>Justin Reagor</author>
      <link>http://blog.kineticweb.com/articles/2008/02/12/starting-to-get-thin-v0-6-3</link>
      <category>thin</category>
      <category>rack</category>
      <category>ruby</category>
      <category>mongrel</category>
    </item>
    <item>
      <title>Soar with Merb-Core and Merb-More (0.9)</title>
      <description>&lt;p&gt;I haven&amp;#8217;t been around in awhile, frankly because I&amp;#8217;ve had my own things to attend to&amp;#8230; but I&amp;#8217;ve felt somewhat ashamed that I&amp;#8217;ve left my kind Kinetic audience a float.  So here is another &amp;#8220;Up and Running&amp;#8221; treat. Cloning Merb-core and -more, from Git[hub] to dummy project.&lt;/p&gt;


	&lt;p&gt;&lt;em&gt;&lt;span class="caps"&gt;BTW&lt;/span&gt;, it should be any day now for the official 0.9 release. Rumors have it that Ezra will be releasing it at ActsAsConference.&lt;/em&gt;&lt;/p&gt;


	&lt;h3&gt;Preperation&lt;/h3&gt;


	&lt;p&gt;Your going to want to remove any old gems in the following list, as you will be installing trunk versions in this tutorial.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;merb (&amp;lt; 0.9)
merb_datamapper (&amp;lt; 0.9)
merb_helpers (&amp;lt; 0.9)
datamapper (&amp;lt; 0.3.0)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;You can go ahead and gem install the following. I&amp;#8217;ve listed the version numbers I use currently.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;sqlite3-ruby (1.2.1)
data_objects (0.2.0)
do_sqlite3 (0.2.3)
do_mysql(0.2.2)
rack (0.2.0)&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Along with the regular Merb dependencies listed in the &lt;span class="caps"&gt;API&lt;/span&gt;.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;# gem install mongrel json json_pure erubis mime-types rspec hpricot mocha rubigen haml markaby mailfactory Ruby2Ruby -y&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Thats a lotta gems right? Well, taking a closer look you should have most of these already&amp;#8230; and if you don&amp;#8217;t you should.&lt;/p&gt;


	&lt;h3&gt;Installing Git&lt;/h3&gt;


	&lt;p&gt;&lt;a href="http://blog.kineticweb.com/articles/2007/10/30/compiling-git-for-mac-os-x-leopard-10-5"&gt;You installed it already&lt;/a&gt;, otherwise&amp;#8230; &lt;span class="caps"&gt;EPIC FAIL&lt;/span&gt;!&lt;/p&gt;


	&lt;h3&gt;You DO have a Github account&lt;/h3&gt;


	&lt;p&gt;If you have a Github account, you&amp;#8217;ll most likely want to fork merb-core and merb-more so you have your own fork&amp;#8217;s to mess about with. If you find anything interesting you can always submit a bug/patch and help the wonderful Merb team out! Or start building some new framework forked from Merb. Either way&amp;#8230;&lt;/p&gt;


	&lt;p&gt;To do this, login to Github and&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;http://github.com/wycats/merb-core/fork
http://github.com/wycats/merb-more/fork
http://github.com/wycats/merb-plugins/fork&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;You&amp;#8217;ll then want to clone these like the next section&amp;#8230;&lt;/p&gt;


	&lt;h3&gt;You &lt;span class="caps"&gt;DON&lt;/span&gt;&amp;#8217;T have a Github account&lt;/h3&gt;


	&lt;p&gt;If you don&amp;#8217;t have an account yet for Github you&amp;#8217;ll still need Git installed like I noted above. From within a fresh directory in Terminal run the following commands.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;# git clone git://github.com/wycats/merb-core.git
# git clone git://github.com/wycats/merb-more.git
# git clone git://github.com/wycats/merb-plugins.git&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h3&gt;Installing these Git forks/clones&lt;/h3&gt;


	&lt;p&gt;Simply enter the directories &amp;#8220;&lt;em&gt;merb-core&lt;/em&gt;&amp;#8221; and &amp;#8220;&lt;em&gt;merb-more&lt;/em&gt;&amp;#8221; and run&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;# sudo rake install&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;You&amp;#8217;ll also want to do this under &amp;#8220;&lt;em&gt;merb-plugins/merb_datamapper&lt;/em&gt;&amp;#8221; and &amp;#8220;&lt;em&gt;merb-plugins/merb_helpers&lt;/em&gt;&amp;#8221;. Including any others in &amp;#8220;&lt;em&gt;merb-plugins&lt;/em&gt;&amp;#8221; you would like installed.&lt;/p&gt;


	&lt;h3&gt;Installing Datamapper Trunk&lt;/h3&gt;


	&lt;p&gt;Currently, Datamapper is still under &lt;span class="caps"&gt;SVN&lt;/span&gt;. I&amp;#8217;m positive this will change in the near future. But for now&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;# svn co http://datamapper.rubyforge.org/svn/trunk/ data_mapper&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Then simply go into the data_mapper/ directory created and do&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;# sudo rake install&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h3&gt;Merb-gen is your Friend?&lt;/h3&gt;


	&lt;p&gt;I&amp;#8217;ve just recently discovered that they&amp;#8217;ve changed, yet again, the default way of creating a new Merb project. I guess because &amp;#8220;&lt;em&gt;merb -g&lt;/em&gt;&amp;#8221; or &amp;#8220;&lt;em&gt;merb&lt;/em&gt;&amp;#8221; was getting annoying, so &amp;#8220;&lt;em&gt;merb-gen [projectname]&lt;/em&gt;&amp;#8221; is some how much simpler. You also use this to generate models/controllers/resources/etc&amp;#8230; :/&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;m going to take another guess and say this is somehow based on the project directory no longer needing to conform to a certain structure like Rails. I&amp;#8217;ve heard this, but I haven&amp;#8217;t tested it out for fact&amp;#8230; so let me know your experiences.&lt;/p&gt;


	&lt;p&gt;Either way&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;# merb-gen lovely-app&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;h3&gt;Going into Toshi Station to pick up some power converters&lt;/h3&gt;


	&lt;p&gt;This is where it starts to get exciting. The fruit of our labors dance in unison to form a euphoric aura called &amp;#8220;0.9&amp;#8221;... not so fast though.&lt;/p&gt;


	&lt;p&gt;1. If your not already, make sure your in the &amp;#8220;&lt;em&gt;lovely-app/&lt;/em&gt;&amp;#8221; project directory.&lt;/p&gt;


	&lt;p&gt;2. Open up &amp;#8220;&lt;em&gt;config/init.rb&lt;/em&gt;&amp;#8221; and uncomment&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;use_orm :datamapper&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Rspec should be your testing framework by default.&lt;/p&gt;


	&lt;p&gt;3. Back in your shell, run&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;# rake --tasks&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;4. This should auto-generate &amp;#8220;&lt;em&gt;config/database.sample.yml&lt;/em&gt;&amp;#8220;&lt;/p&gt;


	&lt;p&gt;5. Overwrite the entire thing with the following, and save as &amp;#8220;&lt;em&gt;config/database.yml&lt;/em&gt;&amp;#8221;...&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;---
:development: &amp;amp;build
  :adapter: sqlite3
  :database: db/dev.db

:test:
  &amp;lt;&amp;lt;: *build
  :database: db/test.db

:production:
  :adapter: mysql
  :database: lovely_app
  :username: root
  :password: &amp;quot;&amp;quot;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;6. Your going to now want to create those sqlite databases. If not both just db/dev.db.&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;# mkdir db/
# sqlite3 db/dev.db
SQLite version 3.5.1
Enter &amp;quot;.help&amp;quot; for instructions
sqlite&amp;gt; .databases
seq  name             file                                                      
---  ---------------  ----------------------------------------------------------
0    main             /Users/bionicebonics/lovely-app/db/dev.db                     
sqlite&amp;gt; .quit&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;You should be able to run a successful &amp;#8220;&lt;em&gt;rake&amp;#8212;tasks&lt;/em&gt;&amp;#8221; if you did everything correctly. You may also want to test and see if you can run the daemon, and pull up a browser window. Run &amp;#8220;&lt;em&gt;merb&lt;/em&gt;&amp;#8221; by itself from Merb.root or project root directory.&lt;/p&gt;


	&lt;p&gt;In short, just start hacking! Reference the &lt;span class="caps"&gt;API&lt;/span&gt; for help, not me.&lt;/p&gt;


	&lt;h3&gt;The Sugar&lt;/h3&gt;


	&lt;p&gt;You should now have a base process for exploring Merb 0.9 development.&lt;/p&gt;


	&lt;h3&gt;The Salt&lt;/h3&gt;


	&lt;p&gt;If for some weird reason your getting errors running &amp;#8220;merb&amp;#8221;, make sure you removed any old versions of Merb &amp;lt;= 0.5.x.&lt;/p&gt;


	&lt;p&gt;Also try uninstalling merb-core and reinstalling it from a new Git clone of the main repo. I had to do this for some odd reason whilst running through this tutorial.&lt;/p&gt;


	&lt;h3&gt;Shameless Kinetic/PhillyOnRails&lt;/h3&gt;


	&lt;p&gt;Colin will be giving a talk on Merb at our local &lt;a href="http://www.phillyonrails.org/"&gt;PhillyOnRails Users Group&lt;/a&gt;, so stay tuned for info on that.&lt;/p&gt;


	&lt;h2&gt;Update&lt;/h2&gt;


	&lt;p&gt;Gotta love Merb integrating &lt;a href="http://rack.rubyforge.org/"&gt;Rack/WSGI&lt;/a&gt;!&lt;/p&gt;


	&lt;p&gt;Following a few discussions on the &lt;a href="http://code.macournoyer.com/thin/"&gt;Thin webserver&lt;/a&gt; mailing list, I just tried Merb on Thin&amp;#8230; this is working out excellent! I&amp;#8217;ve also heard that Ezra just got 2200 req/sec using Thin.&lt;/p&gt;


	&lt;p&gt;If you would like to explore the possibilities of this incredibly fast setup, simply do&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;# sudo gem install thin
# cd lovely-app
# merb -a thin&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;This will load Merb on Thin. If you don&amp;#8217;t know about Thin, I&amp;#8217;m not going to sit here and explain it. I&amp;#8217;m just not like that. You&amp;#8217;ll have to &lt;span class="caps"&gt;FOFY&lt;/span&gt;, &lt;a href="http://code.macournoyer.com/thin/doc/files/README.html"&gt;find-out-for-yourself&lt;/a&gt;.&lt;/p&gt;</description>
      <pubDate>Sat, 09 Feb 2008 01:31:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:96a186fc-4aef-4504-9955-8be244d9b63e</guid>
      <author>Justin Reagor</author>
      <link>http://blog.kineticweb.com/articles/2008/02/09/soar-with-merb-core-and-merb-more-0-9</link>
      <category>merb</category>
      <category>git</category>
      <category>tutorial</category>
      <category>thin</category>
      <category>rack</category>
    </item>
  </channel>
</rss>
