<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Meta Bates &#187; ruby</title>
	<atom:link href="http://www.metabates.com/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.metabates.com</link>
	<description>The technical ramblings of Mark Bates.</description>
	<lastBuildDate>Wed, 10 Mar 2010 15:46:20 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ruby 1.9 &amp; Rails 3.0</title>
		<link>http://www.metabates.com/2010/02/08/ruby-1-9-rails-3-0/</link>
		<comments>http://www.metabates.com/2010/02/08/ruby-1-9-rails-3-0/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 15:06:27 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[active record]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.metabates.com/?p=313</guid>
		<description><![CDATA[I&#8217;ve always been a big proponent of Ruby 1.9, I make no bones about it. My question is why wouldn&#8217;t you be? It&#8217;s faster, more powerful, easier to use, and makes things a lot clearer and cleaner than 1.8. So why then are pretty much all of us still running our applications on 1.8.x? Great [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always been a big proponent of Ruby 1.9, I make no bones about it. My question is why wouldn&#8217;t you be? It&#8217;s faster, more powerful, easier to use, and makes things a lot clearer and cleaner than 1.8. So why then are pretty much all of us still running our applications on 1.8.x? Great question, and as far as I can tell there is really only 1 answer.</p>
<p>That answer? Because no one else is. It&#8217;s stupid really, but it&#8217;s the truth. We&#8217;re all afraid to run our applications in 1.9 because we don&#8217;t know many other people that are. Because of that it makes it hard for you to make your application work with 1.9 because all those gems and libraries  you use aren&#8217;t 1.9 compatible, so you&#8217;re forced to keep running your app on 1.8. And so the cycle continues.</p>
<p>Enter Rails 3.0. Here is a major upgrade to the most prominent web framework in the Ruby community, and I would argue the reason that most of us got into Ruby in the first place. This upgrade will force us all to make some pretty severe changes to our applications to make them fully compatible.  The changes in ActiveRecord alone are so sweeping and massive that we, as a community, are going to have to put some serious time into upgrade our applications. Yet, despite this, we are all going to do it.</p>
<p>Why are we all going to upgrade to Rails 3.0? Because it  looks cool and sexy, and we want those great new features and all those performance enhancements to make our applications run faster. Which leads me back to Ruby 1.9.</p>
<p>In Rails 3.0 they are dropping support for Ruby 1.8.6 and below in favor of Ruby &gt;1.8.7 and &gt;1.9.1. I propose that Rails 3.0 becomes Ruby 1.9 compatible only. Think about it. What a perfect opportunity for us all. We are all going to have to upgrade the libraries and gems we maintain to support Rails 3.0 and we are going to be upgrading our applications to Rails 3.0, so why not go full steam into Ruby 1.9?</p>
<p>There is no better time than now to push forward into the future as a whole community. Let&#8217;s put Ruby 1.8 behind and reap the benefits of what Ruby 1.9 has to offer. What do you say? Can we do it? I think we can.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2010/02/08/ruby-1-9-rails-3-0/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Distributed Programming with Ruby &#8211; Now Available</title>
		<link>http://www.metabates.com/2009/11/12/distributed-programming-with-ruby-now-available/</link>
		<comments>http://www.metabates.com/2009/11/12/distributed-programming-with-ruby-now-available/#comments</comments>
		<pubDate>Thu, 12 Nov 2009 20:40:31 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[book]]></category>
		<category><![CDATA[distributed programmig]]></category>
		<category><![CDATA[distributed programming with ruby]]></category>
		<category><![CDATA[distributed ruby]]></category>
		<category><![CDATA[drb]]></category>
		<category><![CDATA[rinda]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.metabates.com/?p=290</guid>
		<description><![CDATA[Well folks, it&#8217;s been a long road, nearly a year since I presented the idea for &#8220;Distributed Programming with Ruby&#8221; to Obie Fernandez in a hot tub in Florida, but finally my book is done, dusted, back from the printers and available for purchase from a variety of places, include Amazon.com!
It was an absolutely amazing [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://book.markbates.com"><img class="alignleft size-medium wp-image-231" style="margin: 10px;" title="Distributed Programming with Ruby" src="http://www.metabates.com/wp-content/uploads/2009/06/0321638360_bates_mech_page_3-261x300.jpg" alt="Distributed Programming with Ruby" width="261" height="300" /></a>Well folks, it&#8217;s been a long road, nearly a year since I presented the idea for &#8220;Distributed Programming with Ruby&#8221; to Obie Fernandez in a hot tub in Florida, but finally my book is done, dusted, back from the printers and available for purchase from a variety of places, include <a href="http://book.markbates.com">Amazon.com</a>!</p>
<p>It was an absolutely amazing experience and I can&#8217;t thank everyone involved with the project enough for all of their help, guidance, and having to put up with me over the past year.</p>
<p>I would go into detail about all the people I wish to thank, but I did that already in the book, and let&#8217;s be honest, you&#8217;re going to buy it and read it anyway, so I don&#8217;t want to ruin the surprise. <img src='http://www.metabates.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>I&#8217;m sure you&#8217;ve already purchased your copy, but if you haven&#8217;t might I recommend you pop over to <a href="http://book.markbates.com">Amazon</a> right now and pick yourself up a copy. They&#8217;re selling pretty well and you don&#8217;t want to miss out, do you? I didn&#8217;t think so.</p>
<p>If you are someone with a popular blog and you would like to do a review of the book, please drop me a line and I&#8217;ll see what we can do about hooking you up with a copy. Please understand, though, the publishers aren&#8217;t going to send out copies to everyone who requests them, so there will be a bit of vetting going on.</p>
<p>Also, if you have already purchased the book if you wouldn&#8217;t mind leaving a review of it on <a href="http://book.markbates.com">Amazon</a>, that would be much appreciated. It doesn&#8217;t matter where you bought the book, if you could leave a review there, it will really make a difference. Thanks.</p>
<h3><a href="http://book.markbates.com">Buy &#8220;Distributed Programming with Ruby&#8221; Today!</a></h3>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2009/11/12/distributed-programming-with-ruby-now-available/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Apple Push Notifications on Rails</title>
		<link>http://www.metabates.com/2009/07/24/apple-push-notifications-on-rails/</link>
		<comments>http://www.metabates.com/2009/07/24/apple-push-notifications-on-rails/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 01:06:10 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Releases]]></category>
		<category><![CDATA[apn]]></category>
		<category><![CDATA[apple]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[push notification]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.metabates.com/?p=250</guid>
		<description><![CDATA[The other night I submitted a new iPhone application to the Apple Store. The app, which I&#8217;ll speak about when, and if it gets approved, uses the new Apple Push Notification service available in iPhone OS 3.0. On the server side I have a Rails application that I am using to send the notifications to [...]]]></description>
			<content:encoded><![CDATA[<p>The other night I submitted a new iPhone application to the Apple Store. The app, which I&#8217;ll speak about when, and if it gets approved, uses the new Apple Push Notification service available in iPhone OS 3.0. On the server side I have a Rails application that I am using to send the notifications to Apple. The problem I ran into was how.</p>
<p>Enter the APN on Rails gem. While searching I found one plugin for Rails that mostly worked for me, Sam Soffes&#8217; apple_push_notification plugin. It was a great place to start, but I found that there were things that didn&#8217;t suite me. For starters, not having any tests is always a big turn off for me when it comes to any code. I also didn&#8217;t like that you didn&#8217;t need to save a notification in order to send it. That means you don&#8217;t have a record of what was sent and when. I also wanted to have devices stored separately from the notification. Finally, I wanted to be able to easily configure the plugin. Sam&#8217;s was using constants that would need to be changed when it hit production.</p>
<p>So, with all that said and done I took Sam&#8217;s great work, ripped it apart, and put it back together again, this time in gem form instead of a plugin, and here it is.</p>
<p>There are a few migrations, a few models, and a few Rake tasks, but here is the basic idea of how it works:</p>
<p><script src="http://gist.github.com/154516.js"></script></p>
<p>To get a better understanding of exactly how it works, and what it does, I highly recommend reading the <a href="http://apnonrails.metabates.com/">RDOC</a>.</p>
<p>There are a few things I still would like to add, for example, a controller to do CRUD for devices so iPhones can register with the Rails app. I&#8217;d also like to add a task that talks to Apple and finds out which devices are no longer accepting messages so they can be removed.</p>
<p>If you&#8217;d like to contribute, please feel free and for the project on GitHub:<br />
<a href="http://github.com/markbates/apn_on_rails/tree">http://github.com/markbates/apn_on_rails/tree</a></p>
<p>Again, a special thanks to Fabien Penso and Sam Soffes for their initial work on this project.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2009/07/24/apple-push-notifications-on-rails/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Genosaurus 1.1.1</title>
		<link>http://www.metabates.com/2008/04/23/genosaurus-111/</link>
		<comments>http://www.metabates.com/2008/04/23/genosaurus-111/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 16:48:48 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[genosaurus]]></category>
		<category><![CDATA[mack]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.mackframework.com/?p=83</guid>
		<description><![CDATA[So this week I took a small break away from Mack to build another library, Genosaurus. I found that in Mack I had basically written a generator system, so I extracted it out into a stand alone library that anybody can use, and I called it Genosaurus.  Genosaurus is, in my opinion, an incredibly [...]]]></description>
			<content:encoded><![CDATA[<p>So this week I took a small break away from Mack to build another library, <a href="http://genosaurus-api.mackframework.com/" target="_blank">Genosaurus</a>. I found that in Mack I had basically written a generator system, so I extracted it out into a stand alone library that anybody can use, and I called it Genosaurus.  Genosaurus is, in my opinion, an incredibly easy to use generator framework. Let&#8217;s be honest, we&#8217;ve all basically built a generator system at one point or another, so I&#8217;ve just wrapped it up nicely. The next release of Mack, due out the end of this week, will have all it&#8217;s generators converted to use Genosaurus.  Let&#8217;s take a look at a section of the README for Genosaurus:</p>
<h3>Implied Manifests</h3>
<p>The easiest way to useÂ GenosaurusÂ is to let it do the work for you. Letâ€˜s looked at whatâ€˜s called an â€˜impliedâ€™ manifest:</p>
<pre>  dir:
    simple_generator.rb
    templates:
      hello_world.txt.template</pre>
<p>Thatâ€˜s our folder structure. Now letâ€˜s look at simple_generator.rb:</p>
<pre>  require 'rubygems'
  require 'genosaurus'

  class SimpleGenerator &lt; Genosaurus
  end</pre>
<p>Now if we run that generator:</p>
<pre>  $irb: SimpleGenerator.run</pre>
<p>We should get a file called hello_world.txt generated in the current directory. Yes, it truly is that simple!  With implied manifests our directory structure under â€˜templatesâ€™ tells the whole story, andÂ GenosaurusÂ is smart enough to figure it out. All the file names, and the same goes for folders, need to end in .template, andÂ GenosaurusÂ will do the rest.  All the files will go through ERB before they generated, so you can put all your lovely little dynamic goodies in there. File, and folder, names also get run through ERB so you can even make the file name dynamic too!  Letâ€˜s look at a more complex example:</p>
<pre>  dir:
    complex_generator.rb
    templates:
      app:
        views:
          &lt;%=param(:name).plural%&gt;.template:
            hello_world.html.erb
        models:
          &lt;%=param(:name)%&gt;.rb.template</pre>
<p>Letâ€˜s run our complex_generator.rb file:</p>
<pre>  require 'rubygems'
  require 'genosaurus'

  class ComplexGenerator &lt; Genosaurus
    require_param: name
  end</pre>
<p>Now if we run that generator:</p>
<pre>  $irb: ComplexGenerator.run("name" =&gt; "user")</pre>
<p>Now you should end up with the following:</p>
<pre>  app:
    views:
      users:
        hello_world.html.erb
    models:
      user.rb.template</pre>
<p>In the ComplexGenerator we toldÂ GenosaurusÂ that we are requiring that the parameter, name, be passed into it. We are then using that parameter to generate the names of some files and folders. Pretty cool, eh? See how simple that is.</p>
<h3>Explicit Manifests</h3>
<p>Explicit manifests are used when there is a manifest.yml supplied at the same level as the generator. If there is a manifest.yml file then implied manifests are not used. This means you have to define the entire generation process. This is great if you have a pretty complicated generator, as the manifest.yml is also sent through ERB before being loaded.  Letâ€˜s look at the manifest.yml file for our simple_generator example:</p>
<pre>  template_1:
    type: file
    template_path: &lt;%= File.join(templates_directory_path, "templates", "hello_world.txt.template")
    output_path: hello_world.txt</pre>
<p>Pretty simple. We give the template a name, template_1, it really doesnâ€˜t matter what it is, but Hash objects need keys. The â€˜typeâ€™ parameter is either file or directory. The template_path is the path to the template. Finally, the output_path is the where you want the file to be generated.  Letâ€˜s look at our more complex example. We can change the directory structure a bit, since we really donâ€˜t need ERB in the file names now:</p>
<pre>  dir:
    complex_generator.rb
    templates:
      hello_world.html.erb.template
      model.rb.template</pre>
<p>Our manifest.yml file would look like this:</p>
<pre>  hello_world_template:
    type: file
    template_path: &lt;%= File.join(templates_directory_path, "templates", "hello_world.html.erb")
    output_path: &lt;%= File.join("app", "views", param(:name).plural, "hello_world.html.erb") %&gt;
  model_template:
    type: file
    template_path: &lt;%= File.join(templates_directory_path, "templates", "model.html.erb")
    output_path: &lt;%= File.join("app", "models", "#{param(:name)}.rb") %&gt;</pre>
<p>This will generate the exact same thing as our implied manifest.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2008/04/23/genosaurus-111/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My thoughts on spec tests</title>
		<link>http://www.metabates.com/2008/04/09/my-thoughts-on-spec-tests/</link>
		<comments>http://www.metabates.com/2008/04/09/my-thoughts-on-spec-tests/#comments</comments>
		<pubDate>Wed, 09 Apr 2008 12:34:54 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[mack]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[spec test]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://www.mackframework.com/?p=52</guid>
		<description><![CDATA[I&#8217;ve been asked by people why I&#8217;m not using spec tests to test Mack. I&#8217;m currently using just plain old regular unit tests for my tests. It&#8217;s a good question, but not really a valid one, I think. Should it matter what type of tests I&#8217;m using as long as I&#8217;m testing? Tests are tests. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been asked by people why I&#8217;m not using spec tests to test Mack. I&#8217;m currently using just plain old regular unit tests for my tests. It&#8217;s a good question, but not really a valid one, I think. Should it matter what type of tests I&#8217;m using as long as I&#8217;m testing? Tests are tests. The framework you use to do your tests is moot as long as the tests you write are good, solid tests.</p>
<p>I jumped on the spec test bandwagon about a year or so ago. I forced my whole team to start writing in nothing but spec tests. The team, is still not impressed. If I were to tell them we weren&#8217;t using spec tests anymore, they would be EXTREMELY happy with that.Spec tests are certainly prettier than &#8216;regular&#8217; tests. I&#8217;ll give you that. They are more &#8216;human readable&#8217;. With that said I find assert_equal to be fairly easy to read.</p>
<p>So why do I use regular tests, and not spec tests? A couple of reasons. First, they&#8217;re there and built right in to Ruby, ready to go, no new gems or syntax to learn. They&#8217;re fast. They are faster than spec tests. I see it everyday at work. I can also, and this one is HUGE, run just a single test or a regex&#8217;d series of tests. I really love that last bit. I have yet to find a way to do that, easily, with spec tests.</p>
<p>Again, how people write tests doesn&#8217;t really matter so much to me, it&#8217;s just that they write them. Testing is too easy in Ruby, there&#8217;s just no reason for not writing them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2008/04/09/my-thoughts-on-spec-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Release 0.4.0</title>
		<link>http://www.metabates.com/2008/03/26/release-040/</link>
		<comments>http://www.metabates.com/2008/03/26/release-040/#comments</comments>
		<pubDate>Thu, 27 Mar 2008 01:32:58 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Releases]]></category>
		<category><![CDATA[Updates]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[distributed routes]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[mack]]></category>
		<category><![CDATA[merb]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[routes]]></category>
		<category><![CDATA[routing]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.mackframework.com/2008/03/26/release-040/</guid>
		<description><![CDATA[It&#8217;s finally here! The release you&#8217;ve all been waiting for, 0.4.0!! What&#8217;s new in this one? Well, the big one, DISTRIBUTED ROUTING!!! Now you can share your routes between all of your Mack applications.
I&#8217;m very excited about this release. This is one of the first features that starts to set Mack apart from other Ruby [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s finally here! The release you&#8217;ve all been waiting for, 0.4.0!! What&#8217;s new in this one? Well, the big one, <strong>DISTRIBUTED ROUTING</strong>!!! Now you can share your routes between all of your Mack applications.</p>
<p>I&#8217;m very excited about this release. This is one of the first features that starts to set Mack apart from other Ruby frameworks such as Rails and Merb.Â  Mack is trying to set itself as the framework for doing multiple, distributed, portal applications. This release gets us headed in that direction.</p>
<p>There will be a tutorial post and app in the next few days. In the meantime I highly encourage you to download this release and check it out.</p>
<p>Changelog:</p>
<ul>
<li>Added Distributed Routes!</li>
</ul>
<ul>
<li>gem: mack_ruby_core_extensions 0.1.3</li>
</ul>
<ul>
<li>removed gem: ruby_extensions</li>
</ul>
<pre>$ sudo gem install mack</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2008/03/26/release-040/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Announcing Mack Ruby Core Extensions</title>
		<link>http://www.metabates.com/2008/03/26/announcing-mack-ruby-core-extensions/</link>
		<comments>http://www.metabates.com/2008/03/26/announcing-mack-ruby-core-extensions/#comments</comments>
		<pubDate>Wed, 26 Mar 2008 19:57:00 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Releases]]></category>
		<category><![CDATA[extensions]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[inflection]]></category>
		<category><![CDATA[mack]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.mackframework.com/2008/03/26/announcing-mack-ruby-core-extensions/</guid>
		<description><![CDATA[Mack has been using a combination of the ruby_extensions gem as well some local extensions to the Ruby core in order to make Mack as wonderful as it is. In an effort to make life a little simpler, as well as to help share the wealth, the ruby_extensions gem and the Mack extensions have been [...]]]></description>
			<content:encoded><![CDATA[<p>Mack has been using a combination of the ruby_extensions gem as well some local extensions to the Ruby core in order to make Mack as wonderful as it is. In an effort to make life a little simpler, as well as to help share the wealth, the ruby_extensions gem and the Mack extensions have been combined into a single new gem called mack_ruby_core_extensions.</p>
<p>One of the main Mack pieces that has been broken out into this new gem is the inflection system. Now you can have inflections as part of any Ruby application just by requiring the gem. As far as I can tell this is the first stand alone inflection system for Ruby. I know because I couldn&#8217;t find one for Mack, that&#8217;s why I had to write one.</p>
<p>This gem will continually be updated, outside of the core Mack code. The forthcoming release of Mack, 0.4.0, will be converted to use the new gem.</p>
<p>Those who wish to contribute to the gem can find it on GitHub at: <a href="http://github.com/markbates/mack_ruby_core_extensions" target="_blank">http://github.com/markbates/mack_ruby_core_extensions</a></p>
<p>The API for mack_ruby_core_extensions can be found at:<br />
<a href="http://mrce-api.mackframework.com/" target="_blank">http://mrce-api.mackframework.com/</a></p>
<pre>Â $ sudo gem install mack_ruby_core_extensions</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2008/03/26/announcing-mack-ruby-core-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Release 0.3.0</title>
		<link>http://www.metabates.com/2008/03/19/release-030/</link>
		<comments>http://www.metabates.com/2008/03/19/release-030/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 20:43:51 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Releases]]></category>
		<category><![CDATA[Updates]]></category>
		<category><![CDATA[builder]]></category>
		<category><![CDATA[crypt]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[erb]]></category>
		<category><![CDATA[format]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[mack]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[release]]></category>
		<category><![CDATA[rijndael]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.mackframework.com/2008/03/19/release-030/</guid>
		<description><![CDATA[I&#8217;ve been holding back this release so I could get distributed routing into it, but it appears that there&#8217;s still a little more work that needs to be done before it&#8217;s ready to go. I&#8217;m hoping to get it out by the beginning of next week, but don&#8217;t quote me on that.
Instead of focusing on [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been holding back this release so I could get distributed routing into it, but it appears that there&#8217;s still a little more work that needs to be done before it&#8217;s ready to go. I&#8217;m hoping to get it out by the beginning of next week, but don&#8217;t quote me on that.</p>
<p>Instead of focusing on what didn&#8217;t make it in, let&#8217;s talk about what did make it in! There&#8217;s some cool stuff in this release.</p>
<h3>Format Driven Content</h3>
<p>Mack now allows you to drive different content based on the format requested. For example:</p>
<p>/posts &#8211; will render app/views/posts/index.html.erb<br />
/posts.html  &#8211; will also render app/views/posts/index.html.erb<br />
/posts.xml  &#8211; will render app/views/posts/index.xml.erb &#8211; A special note *.xml.erb files, despite their name, do NOT get run through ERB, instead they use the XML Builder library<br />
/posts.js  &#8211; will render app/views/posts/index.js.erb<br />
etc&#8230;</p>
<p>Alternatively, in your action you can now define &#8216;want&#8217; blocks, to run specific code based on the format. Example:</p>
<pre>class PostsController
  def index
    # find all the posts in the system
     @posts = Post.find(:all)
    wants(:html) do
      # this will only be run if html is requested.
      # we need a username for a 'welcome message in the view'
      @username = @user.username
    end
    wants(:xml) do
      # this will only be run if html is requested.
      # find the last published date
      @last_pub_date = Rss.find_last_by_date_by_object(:posts)
    end
  end
end</pre>
<h3>XML Builder Support</h3>
<p>I&#8217;m not going to go into this, there is another nice post coming shortly that will explain how to use this library to add RSS to our blog demo. Here&#8217;s the <a href="http://www.mackframework.com/2008/03/19/adding-rssxml-feeds-to-our-blog-demo/">post</a>.</p>
<h3>Built-in Encryption</h3>
<p>In every app I&#8217;ve ever built I found the need to use encryption. Whether it&#8217;s for encrypting something into a cookie, a password in the database, or a file on disk, we all need encryption, so I&#8217;ve baked the crypt gem into Mack.</p>
<p>At the very simple level you can easily do this in your code:</p>
<pre>@my_encrypted_value = _encrypt("hello world")</pre>
<p>and you&#8217;ll be returned a nice pieced of garbled data using the Crypt/Rijndael library. Decrypting is just as easy:</p>
<pre>_decrypt(@my_encrypted_value) # =&gt; "hello world"</pre>
<p>See, I told you it couldn&#8217;t be easier. It gets even better you can even define your own &#8216;worker&#8217; to implement other encryption schemes. It&#8217;s as simple as this:</p>
<pre>class Mack::Utils::Crypt::HorribleWorker
  def encrypt(value)
    value.reverse
  end
  def decrypt(value)
    value.reverse
  end
end

_encrypt("hello", :horrible) # =&gt; "olleh"
_decrypt("decrypt", :horrible) # =&gt; "hello"</pre>
<p>See how easy that was? You can also do:</p>
<pre>@my_encrypted_value = "Hello".encrypt
@my_encrypted_value.decrypt #=&gt; "Hello"</pre>
<p>Either way it&#8217;s now easy to handle encryption in your funky cool Mack app.</p>
<p>Changelog:</p>
<ul>
<li>Ticket: #8 Xml Builder Support</li>
<li>Ticket: #7 Ability to drive certain content based on &#8216;format&#8217;</li>
<li>Ticket: #9 Added a global encryption system to make encrypting/decrypting of strings easy to use</li>
<li>gem: builder 2.1.2</li>
<li>gem: crypt 1.1.4</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2008/03/19/release-030/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>0.3.0: Adding RSS/xml feeds to our Blog demo</title>
		<link>http://www.metabates.com/2008/03/19/adding-rssxml-feeds-to-our-blog-demo/</link>
		<comments>http://www.metabates.com/2008/03/19/adding-rssxml-feeds-to-our-blog-demo/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 20:42:49 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[builder]]></category>
		<category><![CDATA[demo]]></category>
		<category><![CDATA[mack]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.mackframework.com/2008/03/19/adding-rssxml-feeds-to-our-blog-demo/</guid>
		<description><![CDATA[Ok, as you remember a while back we created a simple blog using mack, http://www.mackframework.com/2008/03/04/the-obligatory-blog-demo/. Well now it&#8217;s time to add the all important RSS/xml feed to it.
Mack 0.3.0 introduces xml rendering support natively, so this shouldn&#8217;t be so hard. First things first, let&#8217;s fire up the app, shall we:
$ rake server
Now let&#8217;s head over [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, as you remember a while back we created a simple blog using mack, <a href="http://www.mackframework.com/2008/03/04/the-obligatory-blog-demo/" target="_blank">http://www.mackframework.com/2008/03/04/the-obligatory-blog-demo/</a>. Well now it&#8217;s time to add the all important RSS/xml feed to it.</p>
<p>Mack 0.3.0 introduces xml rendering support natively, so this shouldn&#8217;t be so hard. First things first, let&#8217;s fire up the app, shall we:</p>
<pre>$ rake server</pre>
<p>Now let&#8217;s head over to http://localhost:3000/posts. We should see our beautiful posts index page. Now let&#8217;s try to go to http://localhost:3000/posts.xml you should see something that looks like this:</p>
<p><img src="http://www.mackframework.com/wp-content/uploads/2008/03/xml1.png" alt="XML blog demo 1" width="450" /></p>
<p>Clearly, that&#8217;s not what we want, is it? I didn&#8217;t think so. The error is telling us that it&#8217;s looking for a file called index.xml.erb in the app/views/posts directory of our blog project. Obviously that file doesn&#8217;t exist.</p>
<p>Let&#8217;s take a second and talk about <em>why</em> Mack was looking for index.xml.erb. We haven&#8217;t changed anything in our controller. Our index method still looks something like this:</p>
<pre>def index
  @posts = Post.find(:all)
end</pre>
<p>No where in there does it mention xml. The only place xml is mentioned is on the the url itself, remember? We looked for /posts.xml. By adding .xml you&#8217;re telling Mack that you want to render, well&#8230; xml. So it goes looking for that. That&#8217;s also new in 0.3.0. The default is html, but if you append a format (.js, .xml, etc&#8230;), it will go looking for app/views/&lt;controller_name&gt;/&lt;action_name&gt;.&lt;format&gt;.erb and render it.</p>
<p>Ok, now that we understand why we&#8217;re looking for an xml file, let&#8217;s fire up our trusty text editor and create a new file called: app/views/posts/index.xml.erb. Let&#8217;s edit the file to look like this:</p>
<pre>xml.instruct! <img src='http://www.metabates.com/wp-includes/images/smilies/icon_mad.gif' alt=':x' class='wp-smiley' /> ml, :version=&gt;"1.0"
xml.rss(:version =&gt; "2.0") do
  xml.channel do
    xml.title("My Mack Blog")
    xml.link(posts_index_full_url)
    xml.description("Find out about all the cool stuff happening on my blog!")
    xml.language("en-us")
    xml.copyright("Copyright Me")
    xml.pubDate(CGI.rfc1123_date(Time.now))
    xml.lastBuildDate(CGI.rfc1123_date(Time.now))
    @posts.each do |post|
      xml.entry do
        xml.title(post.title)
        xml.link(posts_show_full_url(:id =&gt; post.id))
        xml.description(post.body)
        xml.pubDate(post.created_at.strftime("%a, %d %b %Y %H:%M:%S"))
      end
    end
  end
end</pre>
<p>Mack uses the standard builder gem library. I&#8217;m not going to go into explaining how that works, there are plenty of other tutorials and documentation that will show you that. I&#8217;m also not going to explain all the necessary pieces of an RSS feed. Instead I&#8217;ll point out in that code you&#8217;ll see we&#8217;re using the @posts instance variable that we set in the index action of our PostsController. Just like regular *.html.erb files we have access to all the instance variables from the controller, as well, helpers, etc&#8230;</p>
<p>So now if we go to http://localhost:3000/posts.xml we should see our RSS feed. If we did a view source we should see something that looks like this:</p>
<pre id="line1"><span class="pi">&lt;?xml version="1.0" encoding="UTF-8"?&gt;</span>
&lt;<span class="start-tag">rss</span><span class="attribute-name"> version</span>=<span class="attribute-value">"2.0"</span>&gt;
 &lt;<span class="start-tag">channel</span>&gt;
  &lt;<span class="start-tag">title</span>&gt;My Mack Blog&lt;/<span class="end-tag">title</span>&gt;
  &lt;<span class="start-tag">link</span>&gt;http://localhost:3000/posts&lt;/<span class="end-tag">link</span>&gt;
  &lt;<span class="start-tag">description</span>&gt;Find out about all the cool stuff happening on my blog!&lt;/<span class="end-tag">description</span>&gt;
  &lt;<span class="start-tag">language</span>&gt;en-us&lt;/<span class="end-tag">language</span>&gt;
  &lt;<span class="start-tag">copyright</span>&gt;Copyright Me&lt;/<span class="end-tag">copyright</span>&gt;</pre>
<pre id="line9">  &lt;<span class="start-tag">pubDate</span>&gt;Tue, 18 Mar 2008 17:18:05 GMT&lt;/<span class="end-tag">pubDate</span>&gt;
  &lt;<span class="start-tag">lastBuildDate</span>&gt;Tue, 18 Mar 2008 17:18:05 GMT&lt;/<span class="end-tag">lastBuildDate</span>&gt;
  &lt;<span class="start-tag">entry</span>&gt;
   &lt;<span class="start-tag">title</span>&gt;My New Post&lt;/<span class="end-tag">title</span>&gt;
   &lt;<span class="start-tag">link</span>&gt;http://localhost:3000/posts/1&lt;/<span class="end-tag">link</span>&gt;
   &lt;<span class="start-tag">description</span>&gt;This is my first post in my cool Mack blog!&lt;/<span class="end-tag">description</span>&gt;</pre>
<pre id="line15">   &lt;<span class="start-tag">pubDate</span>&gt;Tue, 18 Mar 2008 11:58:30&lt;/<span class="end-tag">pubDate</span>&gt;
  &lt;/<span class="end-tag">entry</span>&gt;
 &lt;/<span class="end-tag">channel</span>&gt;
&lt;/<span class="end-tag">rss</span>&gt;</pre>
<p>Awesome! All that&#8217;s really left is create one of those fancy RSS tags in the location field of our browsers that people can click and go straight to the RSS feed. Let&#8217;s do that now.</p>
<p>At the top of your app/views/posts/index.html.erb file add the following:</p>
<pre>&lt;%= rss_tag(posts_index_url(:format =&gt; <img src='http://www.metabates.com/wp-includes/images/smilies/icon_mad.gif' alt=':x' class='wp-smiley' /> ml)) %&gt;</pre>
<p>Now, refresh the page in your browser, and there you go, you should now see the little RSS button in the location bar of your browser. If you click that you should be taken to your feed.</p>
<p>That&#8217;s all there is to adding not only xml, but an RSS feed to your new blog.</p>
<p>The code for this demo can be found <a href="http://www.mackframework.com/wp-content/uploads/2008/03/mack_blog_demo.zip" title="Blog Demo w/ XML">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2008/03/19/adding-rssxml-feeds-to-our-blog-demo/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The History Of Mack, pt. 1</title>
		<link>http://www.metabates.com/2008/02/26/the-history-of-mack-pt-1/</link>
		<comments>http://www.metabates.com/2008/02/26/the-history-of-mack-pt-1/#comments</comments>
		<pubDate>Wed, 27 Feb 2008 01:02:12 +0000</pubDate>
		<dc:creator>Mark Bates</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[mack]]></category>
		<category><![CDATA[menderchuck]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[web 2.0]]></category>

		<guid isPermaLink="false">http://www.mackframework.com/?p=3</guid>
		<description><![CDATA[Let me start by answering the question at the top of your head, &#8220;why another ruby web application framework?&#8221; Great question.
I work for a company that for the time being shall be called Menderchuck. Menderchuck has been using Ruby on Rails since the company started two years ago. I am employee number three at Menderchuck, [...]]]></description>
			<content:encoded><![CDATA[<p>Let me start by answering the question at the top of your head, &#8220;why another ruby web application framework?&#8221; Great question.</p>
<p>I work for a company that for the time being shall be called Menderchuck. Menderchuck has been using Ruby on Rails since the company started two years ago. I am employee number three at Menderchuck, and was hired directly by the VP of Development. I was hired as the Senior Software Architect. I&#8217;m now the Director of Architecture for the company. <img src='http://www.metabates.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Sorry about the bragging, I just like telling people I&#8217;m a director!</p>
<p>Prior to joining the company I had been using Rails for about 6 months, long before v1.0.0 of the now widely used framework. I loved Rails. I still do in fact, well, kind of. More on that later. Rails was the only choice for developing Menderchuck. The VP of Development and myself were huge fans, and having both come from Java backgrounds, we loved the flexibility and fun of Ruby as a language and Rails as a framework.</p>
<p>As I said we&#8217;ve spent the past two years developing Menderchuck using Rails, and for the most part things have been OK. I can&#8217;t say that they&#8217;ve been great, because, well, they haven&#8217;t. We&#8217;ve had scalability problems, deployment problems, and most importantly problems with the constraints that Rails places on development team.</p>
<p>The idea of an opinionated framework is great, in theory. If you follow and play by their rules things are great. The problem arises if you want to stray from the beaten path. Then you are left out on your own. Left to forge your own path, and as we&#8217;ve found at Menderchuck, you end up doing a whole hell of a lot of hacking!</p>
<p>Rails was designed for, and is incredible for building Web 2.0 applications. Menderchuck, although touted by the CEO as a Web 2.0 application, is really more of a complex and large scale web application, in the flavor of Web 1.0 applications. It&#8217;s also more of a portal, which can be a very difficult thing to build with the Rails framework.</p>
<p>Now don&#8217;t get me wrong, you CAN build a portal using Rails, but it really involves turning the framework on it&#8217;s head and kicking it in the neck. That just shouldn&#8217;t be the way build things.</p>
<p>Enter Mack.  (More to come&#8230;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.metabates.com/2008/02/26/the-history-of-mack-pt-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.547 seconds -->
<!-- Cached page served by WP-Cache -->
