<?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 merb</title>
    <link>http://blog.kineticweb.com/articles/tag/merb</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Musings from a Ruby on Rails development team</description>
    <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>
    <item>
      <title>Bad do_mysql-0.2.2 Gem</title>
      <description>&lt;p&gt;If your getting this error whilst attempting to load up DataMapper in Merb (the rake dm:install:mysql portion, or just gem install do_mysql). Here&amp;#8217;s how I fixed it&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;Started merb_init.rb ...
Loading dependencies...
dyld: NSLinkModule() error
dyld: Library not loaded: /opt/local/lib/mysql5/mysql/libmysqlclient_r.15.dylib
  Referenced from: /usr/local/lib/ruby/gems/1.8/gems/do_mysql-0.2.2/lib/mysql_c.bundle
  Reason: image not found
Trace/BPT trap&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;Try this&amp;#8230;&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_shell "&gt;# sudo -s
# cd /usr/local/lib/ruby/gems/1.8/gems/do_mysql-0.2.2/ext
# make clean
# vim mysql_c.i
[change any bad paths to correct mysql locations in your OS]
# make all
# rm ../lib/mysql_c.bundle
# cp mysql_c.bundle ../lib&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;DataMapper with MySQL should now work in Merb! Happy hacking once more&amp;#8230;&lt;/p&gt;</description>
      <pubDate>Thu, 06 Dec 2007 23:04:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:a11409b1-25a8-49e7-966c-fe5b2464b89c</guid>
      <author>Justin Reagor</author>
      <link>http://blog.kineticweb.com/articles/2007/12/06/bad-do_mysql-0-2-2-gem</link>
      <category>merb</category>
      <category>gems</category>
      <category>ruby</category>
    </item>
    <item>
      <title>Review: Ruby Performance @ Ruby East</title>
      <description>&lt;p&gt;Ezra Zygmuntowicz, creator of Merb, gave a eye-opening talk about Ruby performance and why the stigma that &amp;#8220;Ruby is slow&amp;#8221; led him to prove everyone wrong in creating Merb.&lt;/p&gt;


	&lt;p&gt;Quick overview (pros):&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Benchmarking was discussed, using Ruby Benchmark library and the Ruby-Profile gem/lib. I liked how he has a &lt;i&gt;profile&lt;/i&gt; method setup in Merb (and can be ported out to any app) to do quick profiling of blocks of code. As well as the significance of profiling/benchmarking while you develop.&lt;/li&gt;
		&lt;li&gt;The idea of &amp;#8220;Less meta-programming tricks&amp;#8221; and keeping things simple.&lt;/li&gt;
		&lt;li&gt;Benchmarking of options hash as arguments for methods and Symbol.to_proc, amongst others Ezra demonstrated.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Above all, what stuck with me the most was his explanation of why he created Merb, for speed and less framework code. Ezra proclaimed that Rails has been great at extending new ideas into the development community. As well as pushing Ruby into the mainstream.&lt;/p&gt;


	&lt;p&gt;As far as Merb goes I&amp;#8217;ve learned that its great for file uploading and gateway stream buffering. Example: Merb can initiate an authenticated stream with S3, then push the data through Merb to the end client.&lt;/p&gt;


	&lt;p&gt;Merb is also has a feature called PartControllers. PartControllers are apparently smaller Rails-ish controller classes that do not handle params, sessions or requests and instead provide actions for smaller widgets or controller-in-controller. Example: You would like to have a small &lt;span class="caps"&gt;RSS&lt;/span&gt; Feed reader (PartController) within a view initiated from your StoreController, etc&amp;#8230;&lt;/p&gt;


	&lt;p&gt;To sum it all up, Merb allows you to implement Ruby web applications, generally like Rails, but without being forced idioms and conventions. Not just that, but Merb is completely Rspec&amp;#8217;d and provides built-in profiling!!!&lt;/p&gt;


	&lt;p&gt;&lt;strong&gt;&lt;span class="caps"&gt;BLURP&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;</description>
      <pubDate>Fri, 28 Sep 2007 12:47:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:2184cbce-064d-41fe-9f4c-4d791b7a2ebd</guid>
      <author>Justin Reagor</author>
      <link>http://blog.kineticweb.com/articles/2007/09/28/review-ruby-performance-ruby-east</link>
      <category>merb</category>
      <category>RubyEast</category>
      <category>Rails</category>
      <trackback:ping>http://blog.kineticweb.com/articles/trackback/63</trackback:ping>
    </item>
  </channel>
</rss>
