<?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>Mundo Ruby &#187; how-to</title>
	<atom:link href="http://www.mundoruby.com.ar/tag/how-to/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.mundoruby.com.ar</link>
	<description>Ruby Artists, Hackers y otras yerbas ...</description>
	<lastBuildDate>Wed, 12 Aug 2009 23:02:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>rails twitter search using search.atom</title>
		<link>http://www.mundoruby.com.ar/2009/07/23/rails-twitter-search-using-search-atom/</link>
		<comments>http://www.mundoruby.com.ar/2009/07/23/rails-twitter-search-using-search-atom/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 00:08:00 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=155</guid>
		<description><![CDATA[
Recently, I had to create a twitter live feed for a work I&#8217;m doing&#8230;. so I found the gems for searching in twitter, but all of them were working with the search.json api, but since my client wanted the same results that he saw in twitter.search.com, I created a lib for that project (following the [...]]]></description>
			<content:encoded><![CDATA[<p>
<p>Recently, I had to create a twitter live feed for a work I&#8217;m doing&#8230;. so I found the gems for searching in twitter, but all of them were working with the search.json api, but since my client wanted the same results that he saw in <a href="http://twitter.search.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/http://twitter.search.com');" target="_blank">twitter.search.com</a>, I created a lib for that project (following the gem example code), in order to use the search.atom api and parse the xml results with hpricot.</p>
<p>If you deal with the same problem, here you have the code</p>
<p>require &#8216;rubygems&#8217;<br />
require &#8216;net/http&#8217;<br />
require &#8216;cgi&#8217;</p>
<p>class Twitter<br />
TWITTER_SEARCH_API_URL = &#8216;http://search.twitter.com/search.atom&#8217;<br />
DEFAULT_TIMEOUT = 5<br />
HEADERS = { &#8220;Content-Type&#8221; =&gt; &#8216;application/rss+xml&#8217;,<br />
&#8220;User-Agent&#8221;   =&gt; &#8216;twitter-search&#8217; }</p>
<p>def self.search(opts)<br />
search_for = &#8216;#twitter&#8217;</p>
<p>url = URI.parse(TWITTER_SEARCH_API_URL)<br />
url.query = sanitize_query(opts)</p>
<p>ensure_no_location_operators(url.query)</p>
<p>req  = Net::HTTP::Get.new(url.path)<br />
http = Net::HTTP.new(url.host, url.port)<br />
http.read_timeout = DEFAULT_TIMEOUT</p>
<p>res = http.start { |h| h.get(&#8221;#{url.path}?#{url.query}&#8221;, HEADERS) }</p>
<p>if res.code == &#8216;404&#8242;<br />
raise &#8220;Twitter responded with a 404 for your query&#8221;<br />
end</p>
<p>self.parse_search(res.body)<br />
end</p>
<p>def self.sanitize_query(opts)<br />
if opts.is_a? String<br />
&#8220;q=#{CGI.escape(opts)}&#8221;<br />
elsif opts.is_a? Hash<br />
&#8220;#{sanitize_query_hash(opts)}&#8221;<br />
else<br />
raise &#8220;sanitique_query expects a String or a Hash&#8221;<br />
end<br />
end</p>
<p>def self.sanitize_query_hash(query_hash)<br />
query_hash.collect{|key, value| &#8220;#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}&#8221; }.join(&#8217;&amp;&#8217;)<br />
end</p>
<p>def self.ensure_no_location_operators(query_string)<br />
if query_string.include?(&#8221;near%3A&#8221;) ||<br />
query_string.include?(&#8221;within%3A&#8221;)<br />
raise &#8220;near: and within: are available from the Twitter Search web interface, but not the API. The API requires the geocode parameter. See dancroak/twitter-search README.&#8221;<br />
end<br />
end</p>
<p>def self.parse_search(body)<br />
doc = Hpricot.parse(body)</p>
<p>entries = []</p>
<p>items = (doc/:entry)<br />
items.each do |raw_item|<br />
entry = {}</p>
<p>entry</p>
</p>
<p>(Via <a href="http://www.rorra.com.ar">Rorra&#8217;s blog</a>.) Original Link: <a href="http://www.rorra.com.ar/2009/07/22/rails-twitter-search-using-searchatomrails-busquedas-en-twitter-usando-searchatom/#comments">rails twitter search using search.atom</a> </p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/07/23/rails-twitter-search-using-search-atom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>rake sh en otro directorio</title>
		<link>http://www.mundoruby.com.ar/2009/07/17/rake-sh-en-otro-directorio/</link>
		<comments>http://www.mundoruby.com.ar/2009/07/17/rake-sh-en-otro-directorio/#comments</comments>
		<pubDate>Fri, 17 Jul 2009 13:31:39 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[rake]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=151</guid>
		<description><![CDATA[Problema: Quiero ejecutar un comando desde otro directorio en rake (por ejemplo, ejecutar un makefile que está en un subdirectorio).
Solución: Agrego al rakefile la posibilidad de ejecutar comandos en otro directorio. Para eso, al principio de mi rakefile puse:

require 'fileutils'

def sh_in_dir( dirname, *args, &#38;block )
  old_path = pwd
  FileUtils.chdir( dirname )
  sh( [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-weight:bold;">Problema:</span> Quiero ejecutar un comando desde otro directorio en rake (por ejemplo, ejecutar un makefile que está en un subdirectorio).<br />
<span style="font-weight:bold;">Solución:</span> Agrego al rakefile la posibilidad de ejecutar comandos en otro directorio. Para eso, al principio de mi rakefile puse:</p>
<pre class="ruby"><span class="string">
<pre style="font-size: 1.1em; background-color: #ffffcc; color: #000000; overflow-x: auto; overflow-y: auto; margin-top: 4px; margin-right: 0px; margin-bottom: 4px; margin-left: 0px; width: 610px; padding: 10px; border: thin dashed initial;"><span style="color: #000044;">require</span> <span style="color: #444477; font-weight: bold;">'</span><span style="color: #994444;">fileutils</span><span style="color: #444477; font-weight: bold;">'</span>

<span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">sh_in_dir</span><span style="color: #444477; font-weight: bold;">(</span> <span style="color: #000044;">dirname</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #444477; font-weight: bold;">*</span><span style="color: #000044;">args</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #444477; font-weight: bold;">&amp;</span><span style="color: #000044;">block</span> <span style="color: #444477; font-weight: bold;">)</span>
  <span style="color: #000044;">old_path</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #000044;">pwd</span>
  <span style="color: #0077ff;">FileUtils</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">chdir</span><span style="color: #444477; font-weight: bold;">(</span> <span style="color: #000044;">dirname</span> <span style="color: #444477; font-weight: bold;">)</span>
  <span style="color: #000044;">sh</span><span style="color: #444477; font-weight: bold;">(</span> <span style="color: #444477; font-weight: bold;">*</span><span style="color: #000044;">args</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #444477; font-weight: bold;">&amp;</span><span style="color: #000044;">block</span> <span style="color: #444477; font-weight: bold;">)</span>
  <span style="color: #0077ff;">FileUtils</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">chdir</span><span style="color: #444477; font-weight: bold;">(</span> <span style="color: #000044;">old_path</span> <span style="color: #444477; font-weight: bold;">)</span>
<span style="color: #aa0000; font-weight: bold;">end</span></pre>
<p><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, fantasy; line-height: 19px; white-space: normal; font-size: 13px;">Happy hacking,</span></p>
<p></span></pre>
<p>Aureliano.</p>
<div class="blogger-post-footer"><img src="https://blogger.googleusercontent.com/tracker/1437970354124720603-7633002584629589611?l=aurelianito.blogspot.com" alt="" width="1" height="1" /></div>
<p>(Via <a href="http://aurelianito.blogspot.com/">aurelianito</a>.) Original Link: <a href="http://aurelianito.blogspot.com/2009/07/rake-sh-en-otro-directorio.html">rake sh en otro directorio</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/07/17/rake-sh-en-otro-directorio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RubyInstaller: Updated packages, and other news.</title>
		<link>http://www.mundoruby.com.ar/2009/07/15/rubyinstaller-updated-packages-and-other-news/</link>
		<comments>http://www.mundoruby.com.ar/2009/07/15/rubyinstaller-updated-packages-and-other-news/#comments</comments>
		<pubDate>Thu, 16 Jul 2009 01:50:30 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=149</guid>
		<description><![CDATA[
A few days of silence in the middle, but definitely progress in Windows land&#8230; Readline, new packages and more news&#8230;

Pure-Ruby Readline for the win!
If was the case that under your environment every time you use IRB your CPU went crazy, you will be happy to hear that we found the problem.
More than just find it, [...]]]></description>
			<content:encoded><![CDATA[<p>
<p>A few days of silence in the middle, but definitely progress in Windows land&#8230; Readline, new packages and more news&#8230;</p>
<p><span id="more-172"></span></p>
<h3>Pure-Ruby Readline for the win!</h3>
<p>If was the case that under your environment every time you use <span class="caps">IRB </span>your <span class="caps">CPU </span>went crazy, you will be happy to hear that we found the problem.</p>
<p>More than just find it, we put our some money to it and paid Park Heesob (from win32utils project fame) to code a Pure-Ruby Readline library.</p>
<p>The crazy part is that works on 1.8, 1.9, on Windows and Linux!, even more crazy, it also worked under Rubinius!</p>
<p>The code is in GitHub <a href="http://github.com/luislavena/rb-readline">here</a></p>
<p>Latest packages in RubyInstaller download page have replaced the <span class="caps">GNU</span> Readline binary with it, and <span class="caps">IRB </span>now works normally.</p>
<h3>Ruby 1.9.1-p129 got out.</h3>
<p>As announced in Ruby-Lang website (<a href="http://www.ruby-lang.org/en/news/2009/05/12/ruby-1-9-1-p129-released/">here</a>) 1.9.1-p129 went out last week.</p>
<p>While test on Windows for either trunk and 1.9.1 branch still segfault, I decided to do another release of this and put the 7zip packages in the <a href="http://rubyinstaller.org/downloads/">downloads</a> page at RubyInstaller.</p>
<p>Yes, no official Windows Installer yet, still need to iron some quirks (mentioned in previous post <a href="http://blog.mmediasys.com/2009/05/05/rubyinstaller-state-of-one-click/">here</a>)</p>
<p>Again, you can download those from <a href="http://rubyinstaller.org/downloads/">usual place</a></p>
<h3>Moved to Windows 7</h3>
<p>I definitely been one of the late adopters in OS changes. Been using Windows XP for work for the past 7 years (moved directly from Windows <span class="caps">NT4</span>) &#8212; yeah, love to skip versions.</p>
<p>So decided to install latest Release Candidate as main <span class="caps">OS, </span>and start using it. So far, the experience has been great.</p>
<p>Keep in mind that I rarely turned my laptop off or restarted it (even with XP). Sleep and hibernation are the two options I mostly use, and haven&#8217;t restarted the computer since installed Windows 7, so is good <img src='http://blog.mmediasys.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The following is a list of <em>things</em> I noticed that will love to expand in other posts:</p>
<h4>Mount <code>Users</code> in other partition, don&#8217;t keep with your system</h4>
<p>Like on Linux, dedicate a partition to your personal files, so I did it for the user folder. Is tricky, but can be done. This ease the restoration process of the OS since you don&#8217;t need to worry about losing your personal files.</p>
<h4>Set <code>HOME</code></h4>
<p>Ensure <code>HOME</code> get set to <code>%HOMEDRIVE%</code>@%HOMEPATH%@. This is to make RubyGems and Ruby expansion of @~@ will work properly (and avoid nasty issues with known scripts or gems).</p>
<h4>Console 2 halts</h4>
<p>For some reason, the combo of Console 2 and <span class="caps">VIM </span>when working with Git just halts, not accepting any input. This also affected <span class="caps">IRB, </span>which lead me to think that is readline related.</p>
<p>Anyhow, installed GVim and installed Fabio Akita&#8217;s vimfiles (instructions <a href="http://www.akitaonrails.com/2009/04/27/the-best-environment-for-rails-on-windows-part-2">here</a>)</p>
<p>Then, ensured Git uses it doing <code>git config --global core.editor gvim</code></p>
<h4>Hidden files behave as read only?</h4>
<p>Found that Ruby and some programs don&#8217;t let you modify hidden files. They just return access denied.</p>
<p>This seems weird, since Notepad can edit those files without issues.</p>
<p>Will investigate further, seems a bad usage of Windows <span class="caps">API.</span></p>
<h4>Don&#8217;t pollute your system.</h4>
<p>Put all your tools, <span class="caps">DLL</span>s and your scripts in your user folder. Mine is <code>%HOME%\Tools\bin</code>, add this to your User environment variables: <code>%HOME%\Tools\bin</code>, et voila!</p>
<p>Don&#8217;t copy files to <code>system32</code> blindly, this includes <span class="caps">SQL</span>ite3, MySQL or any of these tools, putting things there make things harder to find or update later.</p>
<p>Also, that requires Admin rights, which are annoying if you don&#8217;t have them (I have <span class="caps">UAC </span>to the highest value to avoid do any stuff that normal non-admin users will do).</p>
<p>See my <a href="http://gist.github.com/113258">Tools layout</a></p>
<h3>Some gem issues and news</h3>
<p>While doing the move to new <span class="caps">OS, </span>decided to build a few gems again, and maybe update them.</p>
<h4>MySQL 5.1 and mysql gem are a nightmare, stick to 5.0 for now.</h4>
<p>Yeah, it seems that mysql Ruby C Extension have several memory issues. Stick to 5.0 for know (or switch to DataMapper, I heard they got things working on Windows!) <img src='http://blog.mmediasys.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Been working in my own fork to support MinGW properly. Check the code at GitHub:</p>
<p><a href="http://github.com/luislavena/mysql-gem">http://github.com/luislavena/mysql-gem</a></p>
<h4>Almost 100% cross-platform <span class="caps">SQL</span>ite3 ruby gem!</h4>
<p>Lot of progress on this, partially stolen from do_sqlite3 (and viceversa!) <img src='http://blog.mmediasys.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>My fork <a href="http://github.com/luislavena/sqlite3-ruby">here</a> is capable to build Windows binaries on Linux/OSX.</p>
<p>Ideas of making <a href="http://tenderlovemaking.com/2009/05/07/fat-binary-gems-make-the-rockin-world-go-round/">fat binaries</a> are around, but I believe this can be worked out with some love to RubyGems (discussed last year).</p>
<p>Will make binaries of those gems this week.</p>
<h3>So, what are you waiting for?</h3>
<p>Start using it!, like Mike Hodgson that reported his success <a href="http://rubyforge.org/pipermail/rubyinstaller-devel/2009-May/000565.html">here</a></p>
</p>
<p>(Via <a href="http://blog.mmediasys.com">DEV_MEM.dump_to(:blog) &#8211; Multimedia systems blog</a>.) Original Link: <a href="http://blog.mmediasys.com/2009/05/17/rubyinstaller-updated-packages-and-other-news/#comments">RubyInstaller: Updated packages, and other news.</a> </p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/07/15/rubyinstaller-updated-packages-and-other-news/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rails 2.3, rake y reenable method</title>
		<link>http://www.mundoruby.com.ar/2009/07/13/rails-2-3-rake-y-reenable-method/</link>
		<comments>http://www.mundoruby.com.ar/2009/07/13/rails-2-3-rake-y-reenable-method/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 17:42:27 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[rake]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=129</guid>
		<description><![CDATA[

Estoy terminando de hacer una migration a Rails 2.3 de la
app con la que estoy trabajando, resulta que me encontré con el siguiente tema:
Luego de instalar rails y migrar la app, llegó el momento de hacer un deploy a
staging, entonces me econtré con el siguiente error:

undefined method `reenable' for &#60;Rake::Task db:schema:dump =&#62;
[environment]&#62;:Rake::Task

googleando un poco llegué [...]]]></description>
			<content:encoded><![CDATA[<p>
<div class='snap_preview'>
<p>Estoy terminando de hacer una migration a Rails 2.3 de la<br />
app con la que estoy trabajando, resulta que me encontré con el siguiente tema:<br />
Luego de instalar rails y migrar la app, llegó el momento de hacer un deploy a<br />
staging, entonces me econtré con el siguiente error:</p>
<pre>
undefined method `reenable' for &lt;Rake::Task db:schema:dump =&gt;
[environment]&gt;:Rake::Task
</pre>
<p>googleando un poco llegué a este <a href="http://antono.info/en/138">link </a> que dice que hay que instalar<br />
la nueva versión de rake, investigando un poco más, llegué a este <a href="http://rails.lighthouseapp.com/projects/8994/tickets/1412-dbmigrateredo-does-not-dump-the-schema-after-migrating-back-up">PATCH </a><br />
que hace uso del método Rake::Task#reenable, el caso es que este método<br />
se agrega e con la versión de rake 0.8.2 y como el pibe dice en el comentario<br />
del patch, no hay problemas por que rails 2.3 require rake 0.8.3&#8230;. pero<br />
que pasa cuando:</p>
<p>1- Instalo rails 2.3<br />
2- Hago un &#8216;rake rails:freeze&#8217;<br />
3- hago &#8216;cap staging deploy:migrations&#8217;</p>
<p>Y no tengo rails 2.3 instalado en el server y por eso justamente hice un freeze.</p>
<p>Si leemos la task que arma las dependencias de rails:</p>
<pre>
  s.add_dependency('rake', '&gt;= 0.8.3')
  s.add_dependency('activesupport',    '= 3.0.pre' + PKG_BUILD)
  s.add_dependency('activerecord',     '= 3.0.pre' + PKG_BUILD)
  s.add_dependency('actionpack',       '= 3.0.pre' + PKG_BUILD)
  s.add_dependency('actionmailer',     '= 3.0.pre' + PKG_BUILD)
  s.add_dependency('activeresource',   '= 3.0.pre' + PKG_BUILD)
</pre>
<p>uando hacemos el freeze nos copia todas estas cosas menos el rake,<br />
lo cual parece razonable. Pero creo debería agregar en config/environment.rb</p>
<p>config.gem &#8220;rake&#8221;, :version =&gt; &#8216;0.8.3&#8242;</p>
<p>Que opinan uds? </p>
<p>  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/gastonramos.wordpress.com/345/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/gastonramos.wordpress.com/345/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/gastonramos.wordpress.com/345/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/gastonramos.wordpress.com/345/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/gastonramos.wordpress.com/345/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/gastonramos.wordpress.com/345/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/gastonramos.wordpress.com/345/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/gastonramos.wordpress.com/345/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/gastonramos.wordpress.com/345/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/gastonramos.wordpress.com/345/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=gastonramos.wordpress.com&#038;blog=1034400&#038;post=345&#038;subd=gastonramos&#038;ref=&#038;feed=1" /></div>
</p>
<p>(Via <a href="http://gastonramos.wordpress.com">Gastón Ramos &#8211; Ruby, Rails&#8230;</a>.) Original Link: <a href="http://gastonramos.wordpress.com/2009/07/08/rails-2-3-rake-y-reenable-method/#comments">Rails 2.3, rake y reenable method</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/07/13/rails-2-3-rake-y-reenable-method/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RubyInstaller: Getting Started with Rails and SQLite3</title>
		<link>http://www.mundoruby.com.ar/2009/07/07/rubyinstaller-getting-started-with-rails-and-sqlite3/</link>
		<comments>http://www.mundoruby.com.ar/2009/07/07/rubyinstaller-getting-started-with-rails-and-sqlite3/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 14:10:12 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[sqlite3]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=127</guid>
		<description><![CDATA[
A few folks asked this over the past weeks, and since I released preview1 version of RubyInstaller, wouldn&#8217;t be awesome I write a guide for it?
So, here we go

First, Getting Ruby
Please download from here one of the preview1 installers for Ruby.
For this demonstration, I&#8217;m going to use Ruby 1.9.1-p129. Downloaded, executed and installed to it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>
<p>A few folks asked this over the past weeks, and since I <a href="http://blog.mmediasys.com/2009/06/28/rubyinstaller-preview1-released/">released preview1</a> version of RubyInstaller, wouldn&#8217;t be awesome I write a guide for it?</p>
<p>So, here we go</p>
<p><span id="more-233"></span></p>
<h3>First, Getting Ruby</h3>
<p>Please download <a href="http://rubyinstaller.org/downloads/">from here</a> one of the preview1 installers for Ruby.</p>
<p>For this demonstration, I&#8217;m going to use Ruby 1.9.1-p129. Downloaded, executed and installed to it&#8217;s default location <code>C:\Ruby19</code></p>
<p>Now, start a Command prompt with Ruby (under start menu, inside Ruby 1.9.1-p129).</p>
<p><img src="http://blog.mmediasys.com/wp-content/uploads/2009/07/prompt.png" alt="Command Prompt with Ruby" title="Command Prompt with Ruby" width="515" height="365" class="alignnone size-full wp-image-238" /></p>
<h3>Getting <span class="caps">SQL</span>ite3</h3>
<p>As you may know, Windows do not came out of the box with libraries like <span class="caps">SQL</span>ite3. For this, we are going to download it from Internet.</p>
<p>Going to <a href="http://sqlite.org/download.html"><span class="caps">SQL</span>ite downloads</a>, under <em>Precompiled binaries for Windows</em>, download <code>sqlitedll-3_6_16.zip</code> and <code>sqlite-3_6_16.zip</code>. Those two packages contains the <span class="caps">DLL </span>(sqlite3.dll) and the command line executable for <span class="caps">SQL</span>ite (sqlite3.exe).</p>
<p>Please extract those contents inside <code>C:\Ruby19\bin</code></p>
<p>Now, let&#8217;s get the Ruby bindings for <span class="caps">SQL</span>ite3</p>
<h3>Getting <span class="caps">SQL</span>ite3/Ruby bindings</h3>
<p>As you may know, the preferred way to distribute Ruby libraries is using Gems. Users on other platforms usually compile themselves these components, using the mechanisms provided by the operating system distribution.</p>
<p>We are going to avoid the compilation process using pre-compiled binaries that has been <em>cooked</em> for us.</p>
<p>So, back to the Command Prompt with Ruby, let&#8217;s install the sqlite3 bindings:</p>
<pre>gem install sqlite3-ruby --source http://gems.rubyinstaller.org</pre>
<p>Adding <code>--source</code> help us indicate a non-standard location from where gems are going to be installed. RubyInstaller team has built and packaged special versions of these gems that we hope get published soon into RubyForge, the official place for gem distribution.</p>
<p>Once installed, you should see something like this at the screen:</p>
<pre>Successfully installed sqlite3-ruby-1.2.4.1-x86-mingw32
1 gem installed</pre>
<p>These special version of the gem are <em>fat binaries</em>, which means these can be safely installed on Ruby 1.8.6 or 1.9.1.</p>
<h3>Getting Rails</h3>
<p>Now it&#8217;s time to install and build a Rails application. First, let&#8217;s install the rails gem:</p>
<pre>gem install rails</pre>
<p>That command is going to take a bit, since is a 2MB or so download, and will install several of the Rails dependencies (ActiveRecord, ActionPack, ActiveSupport, etc). You should expect similar output to this:</p>
<pre>Successfully installed activesupport-2.3.2
Successfully installed activerecord-2.3.2
Successfully installed actionpack-2.3.2
Successfully installed actionmailer-2.3.2
Successfully installed activeresource-2.3.2
Successfully installed rails-2.3.2
6 gems installed</pre>
<p>Let&#8217;s build our application now.</p>
<h3>Creating a Rails application.</h3>
<p>Let&#8217;s call the application <code>railsapp</code></p>
<pre>rails railsapp</pre>
<p>An excerpt of the output you should get:</p>
<pre>      create
      create  app/controllers
      create  app/helpers
      create  app/models
      create  app/views/layouts
      create  config/environments
      create  config/initializers
      create  config/locales
      create  db
...</pre>
<p>Rails 2.3.2 defaults it&#8217;s database format to <span class="caps">SQL</span>ite3, so there is no need for us to tweak anything.</p>
<p>Checking if everything is ok, using <code>script\about</code>:</p>
<pre>cd railsapp
ruby script\about</pre>
<p>And the output should be something like this:</p>
<pre>About your application's environment
Ruby version              1.9.1 (i386-mingw32)
RubyGems version          1.3.4
Rack version              1.0 bundled
Rails version             2.3.2
Active Record version     2.3.2
Action Pack version       2.3.2
Active Resource version   2.3.2
Action Mailer version     2.3.2
Active Support version    2.3.2
Application root          C:/Users/Luis/railsapp
Environment               development
Database adapter          sqlite3
Database schema version   0</pre>
<p>Now, it&#8217;s up to you create your models, controllers and everything.</p>
<h3>Some notes and considerations.</h3>
<p>At the time of this writing, Mongrel has not been updated to build and install properly either on 1.9 or MinGW versions of Ruby.</p>
<p>As part of Mongrel development team, I&#8217;m going to work on a solution for this in the upcoming days.</p>
<p>If you find something wrong with the Ruby Installer, please report <a href="http://rubyforge.org/tracker/?atid=715&amp;group_id=167&amp;func=browse">here</a>, but issues with your code, Rails or other are not responsability of RubyInstaller.</p>
<p>The binary gems provided at <code>gems.rubyinstaller.org</code> are based on our forks of sqlite3-ruby, which can be cloned and explored <a href="http://github.com/luislavena/sqlite3-ruby">here</a> at GitHub.</p>
<p>Keep in mind that some gems would not work under Ruby 1.9, or you will need a compiler (DevKit) for it. See previous post with details how to get those from our download page.</p>
</p>
<p>(Via <a href="http://blog.mmediasys.com">DEV_MEM.dump_to(:blog) &#8211; Multimedia systems blog</a>.) Original Link: <a href="http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-sqlite3/#comments">RubyInstaller: Getting Started with Rails and SQLite3</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/07/07/rubyinstaller-getting-started-with-rails-and-sqlite3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>RubyInstaller: Getting Started with Rails and MySQL</title>
		<link>http://www.mundoruby.com.ar/2009/07/07/rubyinstaller-getting-started-with-rails-and-mysql/</link>
		<comments>http://www.mundoruby.com.ar/2009/07/07/rubyinstaller-getting-started-with-rails-and-mysql/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 14:09:53 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Rails]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[msyql]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=125</guid>
		<description><![CDATA[
This is a follow up instruction set from previous post, but this time, using MySQL

Getting Ruby
These steps are the same for Ruby 1.9 or Ruby 1.8, please feel free to download the installer from here
For this guide I&#8217;m going to use Ruby 1.9.1-p129, since it the coolest new version that all the guys are playing [...]]]></description>
			<content:encoded><![CDATA[<p>
<p>This is a follow up instruction set from <a href="http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-sqlite3/">previous post</a>, but this time, using MySQL</p>
<p><span id="more-250"></span></p>
<h3>Getting Ruby</h3>
<p>These steps are the same for Ruby 1.9 or Ruby 1.8, please feel free to download the installer <a href="http://rubyinstaller.org/downloads">from here</a></p>
<p>For this guide I&#8217;m going to use Ruby 1.9.1-p129, since it the coolest new version that all the guys are playing with <img src='http://blog.mmediasys.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>Now, start a Command prompt with Ruby (under start menu, inside Ruby 1.9.1-p129).</p>
<p><img src="http://blog.mmediasys.com/wp-content/uploads/2009/07/prompt.png" alt="Command Prompt with Ruby 1.9" title="Command Prompt with Ruby 1.9" width="515" height="365" class="alignnone size-full wp-image-238" /></p>
<h3>Getting the right MySQL version</h3>
<p>While building the MySQL/Ruby bindings, we found that mixing versions of the bindings with different versions of MySQL installations ended on undesired results (abnormal program termination, weird errors, etc.)</p>
<p>For this guide, and because we are going to use binary gems, we are going to stick to MySQL version <strong>5.0.83</strong>. </p>
<p>Now is time to download MySQL. For this guide, I&#8217;m going to install the <em>essentials</em> version, which contains only MySQL and command line tools, no Query Builder or any other administrative tool.</p>
<p>Please go to <a href="http://dev.mysql.com/downloads/mysql/5.0.html#win32">this page</a> and download <em>Windows Essentials (x86)</em>. Once downloaded you will end with <code>mysql-essential-5.0.83-win32.msi</code> file. Execute it and install with defaults.</p>
<h3>Configure MySQL</h3>
<p>If you&#8217;re an advanced and savvy MySQL user, you can skip the following steps. For the sake of this guide, I&#8217;m going to list the simple options you must follow when installing it.</p>
<p>Once you installed MySQL, the installer should have started the <em>Configuration Wizard</em> page.</p>
<p>Inside of it, please apply the following options:</p>
<table>
<tr>
<th>Option/Screen</th>
<th>Value</th>
</tr>
<tr>
<td>Configuration Type</td>
<td>Detailed configuration</td>
</tr>
<tr>
<td>Server type</td>
<td>Developer Machine</td>
</tr>
<tr>
<td>Database usage</td>
<td>Transactional Database only</td>
</tr>
<tr>
<td>InnoDB datafile</td>
<td><em>Your option or leave defaults</em></td>
</tr>
<tr>
<td>Number of connections</td>
<td>Decision Support</td>
</tr>
<tr>
<td>Networking options</td>
<td>Check <em>Add firewall exceptions</em></td>
</tr>
<tr>
<td>Character set</td>
<td>Best support for Multilingualism (UTF8)</td>
</tr>
<tr>
<td>Windows Options</td>
<td>Add to <span class="caps">PATH </span>if you want <em>mysql</em> available on every prompt</td>
</tr>
<tr>
<td>Security Options</td>
<td>Uncheck if you want <em>root</em> password be blank</td>
</tr>
</table>
<p>Once done with all this, on the summary screen, please click <em>Execute</em> to complete the configuration of MySQL Server.</p>
<p>Under some system, starting of MySQL server will fail during this wizard, but don&#8217;t be afraid, most of the times, this can be safely ignored.</p>
<p>To check everything was properly installed, please go to the Start Menu, and inside <em>MySQL Server 5.0</em>, click on <em>MySQL Command Line Client</em></p>
<p>If you changed the <em>root</em> password, or, like me, leaved it unchecked, you can simply press enter when asked for the password and see that the server is running!</p>
<p><img src="http://blog.mmediasys.com/wp-content/uploads/2009/07/mysql-client.png" alt="MySQL Console Client" title="MySQL Console Client" width="566" height="353" class="alignnone size-full wp-image-253" /></p>
<p>If you decided to add MySQL to the <span class="caps">PATH, </span>you will require to restart your computer so the <span class="caps">PATH </span>change is available to the system.</p>
<p>If you decided not to add MySQL to the <span class="caps">PATH, </span>please go, with Explorer to the location where you installed MySQL Server and copy <code>libmySQL.dll</code> into <code>C:\Ruby19\bin</code></p>
<p>In my case, I found this file in <code>C:\Program Files\MySQL\MySQL Server 5.0\bin</code></p>
<p>Now, it is time to install the bindings.</p>
<h3>Getting MySQL/Ruby</h3>
<p>For this version of Ruby, there is no official binary gems for both Ruby 1.8 and 1.9. So we are going to install the specially built version from RubyInstaller gems repository. </p>
<p>At the <em>Command Prompt with Ruby</em>, please enter the following command:</p>
<pre>
gem install mysql --source http://gems.rubyinstaller.org
  </pre>
<p>This is going to install the special version of MySQL bindings. This version works with Ruby 1.8 and 1.9, since bundles <em>fat binaries</em>. You should expect a similar output like this:</p>
<pre>Successfully installed mysql-2.8.1.1-x86-mingw32
1 gem installed</pre>
<h3>Getting Rails</h3>
<p>Now is time to install Rails and build our application. At the same command prompt, please enter the following command:</p>
<pre>gem install rails</pre>
<p>This is going to take a bit, since Rails and it&#8217;s dependencies takes around 2MB or so, and need to be downloaded and installed.</p>
<p>Once done, expect see at the screen something like this:</p>
<pre>Successfully installed activesupport-2.3.2
Successfully installed activerecord-2.3.2
Successfully installed actionpack-2.3.2
Successfully installed actionmailer-2.3.2
Successfully installed activeresource-2.3.2
Successfully installed rails-2.3.2
6 gems installed</pre>
<h3>Creating a Rails application</h3>
<p>Let&#8217;s name our application <code>mysqlapp</code></p>
<pre>rails mysqlapp --database=mysql</pre>
<p>The <code>--database</code> option indicates to Rails that we want to use MySQL instead of the default database adapter (SQLite3).</p>
<p>Rails will output a lot of lines when creating your application structure, just an excerpt of what to see:</p>
<pre>
...
      create  config/database.yml
      create  config/routes.rb
      create  config/locales/en.yml
      create  config/initializers/backtrace_silencers.rb
      create  config/initializers/inflections.rb
      create  config/initializers/mime_types.rb
      create  config/initializers/new_rails_defaults.rb
      create  config/initializers/session_store.rb
      create  config/environment.rb
...
</pre>
<h3>Configuring our Database</h3>
<p>Now Rails have configured for us the name of the database we want to use, and you can verify it in <code>config\database.yml</code></p>
<p>Rails will try to connect to <code>mysqlapp_development</code>, but that database do not exist in our fresh new MySQL server.</p>
<p>So, let&#8217;s create it:</p>
<pre>cd mysqlapp
rake db:create</pre>
<p>Just that, simple <code>db:create</code> is going to connect to our MySQL server, and create the database for us.</p>
<p>Keep in mind that if you changed root password or want to use other MySQL user to connect to the database, you need to edit <code>database.yml</code> to reflect those changes.</p>
<p>Let&#8217;s verify that everything is in place, using the following command:</p>
<pre>About your application's environment
Ruby version              1.9.1 (i386-mingw32)
RubyGems version          1.3.4
Rack version              1.0 bundled
Rails version             2.3.2
Active Record version     2.3.2
Action Pack version       2.3.2
Active Resource version   2.3.2
Action Mailer version     2.3.2
Active Support version    2.3.2
Application root          C:/Users/Luis/mysqlapp
Environment               development
Database adapter          mysql
Database schema version   0</pre>
<p>Now is up to you to create your models, controllers and views!</p>
<h3>Some notes and considerations</h3>
<p>On other post I&#8217;m going to guide you with steps on building the bindings against MySQL 5.1.36, since you will need to install the Ruby Development Kit and the development headers for MySQL.</p>
<p>If you find something wrong with the Ruby Installer, please report it <a href="http://rubyforge.org/tracker/?atid=715&amp;group_id=167&amp;func=browse">here</a>, but issues with your code, Rails or other are not responsability of RubyInstaller.</p>
<p>The binary gems provided at <code>gems.rubyinstaller.org</code> are based on our forks of mysql bindings, which can be cloned and explored <a href="http://github.com/luislavena/mysql-gem">here</a> at GitHub.</p>
<p>Keep in mind that some gems would not work under Ruby 1.9, or you will need a compiler (DevKit) for it. See previous post with details how to get those from our download page.</p>
</p>
<p>(Via <a href="http://blog.mmediasys.com">DEV_MEM.dump_to(:blog) &#8211; Multimedia systems blog</a>.) Original Link: <a href="http://blog.mmediasys.com/2009/07/06/getting-started-with-rails-and-mysql/#comments">RubyInstaller: Getting Started with Rails and MySQL</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/07/07/rubyinstaller-getting-started-with-rails-and-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I&#8217;m back with some Code &#8230;</title>
		<link>http://www.mundoruby.com.ar/2009/07/06/im-back-with-some-code/</link>
		<comments>http://www.mundoruby.com.ar/2009/07/06/im-back-with-some-code/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 17:52:30 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[how-to]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=123</guid>
		<description><![CDATA[
Well, hello again, long time since the last post. I went on vacations, work a lot and did some programming. Let&#8217;s talk abount the programming part, since it is the most interesting one.  
I created a small library called &#8220;Esearchy&#8221; capable of searching the internet for email addresses. Currently, we the supported search methods [...]]]></description>
			<content:encoded><![CDATA[<p>
<p>Well, hello again, long time since the last post. I went on vacations, work a lot and did some programming. Let&#8217;s talk abount the programming part, since it is the most interesting one. <img src='http://www.mundoruby.com.ar/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>I created a small library called &#8220;Esearchy&#8221; capable of searching the internet for email addresses. Currently, we the supported search methods are  engines such as Google, Bing, Yahoo, PGP servers, GoogleGroups, etc , but I intend to add many more.<br />
Also, the library searches inside .pdf and .txt files for emails addresses and adds them to the list of found accounts.  </p>
<p>For now, there are two main ways of performing a search, &#8220;the ruby way&#8221;</p>
<div class="geshifilter">
<div class="geshifilter-ruby" style="font-family: monospace;">
<ol>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal"> Esearchy.<span style="color:#9900CC;">create</span> <span style="color:#996600;">&quot;domain.com&quot;</span> <span style="color:#9966CC; font-weight:bold;">do</span> |domain|</div>
</li>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp; &nbsp;domain.<span style="color:#9900CC;">maxhits</span> = <span style="color:#006666;">500</span></div>
</li>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp; &nbsp;domain.<span style="color:#9900CC;">search</span></div>
</li>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp; &nbsp;domain.<span style="color:#9900CC;">clean</span> <span style="color:#006600; font-weight:bold;">&#123;</span>|e| e =~ /&lt;|&gt;/ <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp; &nbsp;domain.<span style="color:#9900CC;">save_to_file</span> <span style="color:#996600;">&quot;~/emails.txt&quot;</span></div>
</li>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp;<span style="color:#9966CC; font-weight:bold;">end</span></div>
</li>
</ol>
</div>
</div>
<p>and the more classic way in which users can create an Esearchy objetc and work on it</p>
<p>
<div class="geshifilter">
<div class="geshifilter-ruby" style="font-family: monospace;">
<ol>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal"> &nbsp;domain = Esearchy.<span style="color:#9900CC;">new</span> <span style="color:#ff3333; font-weight:bold;">:query</span> =&gt; <span style="color:#996600;">&quot;domain.com&quot;</span>, <span style="color:#ff3333; font-weight:bold;">:maxhits</span> =&gt; <span style="color:#006666;">500</span></div>
</li>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp; domain.<span style="color:#9900CC;">search</span></div>
</li>
<li style="font-family: monospace; font-weight: normal;">
<div style="font-family: monospace; font-weight: normal; font-style: normal">&nbsp; domain.<span style="color:#9900CC;">save_to_file</span> <span style="color:#996600;">&quot;~/emails.txt&quot;</span></div>
</li>
</ol>
</div>
</div>
<p>For now , that&#8217;s it for now , but keep on tuned for more shitty code ajjajaa</p>
</p>
<p>(Via <a href="http://www.freedomcoder.com.ar">自由編碼人</a>.) Original Link: <a href="http://www.freedomcoder.com.ar/node/153#comments">I&#8217;m back with some Code &#8230;</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/07/06/im-back-with-some-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Patch en Regexp para poder usarlas como clave en un Hash</title>
		<link>http://www.mundoruby.com.ar/2009/07/06/patch-en-regexp-para-poder-usarlas-como-clave-en-un-hash/</link>
		<comments>http://www.mundoruby.com.ar/2009/07/06/patch-en-regexp-para-poder-usarlas-como-clave-en-un-hash/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 17:51:56 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[Regular Expressions]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=121</guid>
		<description><![CDATA[Siguiendo mi proyecto de hacer mi wiki en Ruby, encontré un comportamiento muy raro.
Generé un hash (que se llama @rules) que no tiene un elemento que tiene. O sea, @rules[@rules.keys[2]] da nil, pero @rules.values[2] devuelve el objeto asociado a la clave @rules.keys[2]. Como este hash tiene como claves un montón de expresiones regulares, me imaginé [...]]]></description>
			<content:encoded><![CDATA[<p>Siguiendo mi proyecto de hacer mi wiki en Ruby, encontré un comportamiento muy raro.<br />
Generé un hash (que se llama @rules) que no tiene un elemento que tiene. O sea, <code>@rules[@rules.keys[2]]</code> da nil, pero <code>@rules.values[2]</code> devuelve el objeto asociado a la clave <code>@rules.keys[2]</code>. Como este hash tiene como claves un montón de expresiones regulares, me imaginé que había un problema con el hash y el eql? de Regexp, así que los implementé de nuevo y monkeypatchié.<br />
Este es el código:</p>
<pre class="ruby">
<pre style="font-size: 1.1em; background-color: #ffffcc; color: #000000; overflow-x: auto; overflow-y: auto; margin-top: 4px; margin-right: 0px; margin-bottom: 4px; margin-left: 0px; width: 608px; padding: 10px; border: thin dashed initial;"><span style="color: #aa0000; font-weight: bold;">class </span><span style="color: #007744;">Regexp</span>
 <span style="color: #000044;">alias_method</span> <span style="color: #009999;"> <img src='http://www.mundoruby.com.ar/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> ld_rapidito_inspect</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #009999;">:inspect</span>

 <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">inspect</span>
   <span style="color: #337777;">@inspect</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #000044;">old_rapidito_inspect</span> <span style="color: #aa0000; font-weight: bold;">if</span> <span style="color: #337777;">@inspect</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">nil?</span>
   <span style="color: #337777;">@inspect</span>
 <span style="color: #aa0000; font-weight: bold;">end</span>

 <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">eql?</span><span style="color: #444477; font-weight: bold;">(</span> <span style="color: #000044;">other</span> <span style="color: #444477; font-weight: bold;">)</span>
   <span style="color: #0077ff;">false</span> <span style="color: #aa0000; font-weight: bold;">if</span> <span style="color: #000044;">other</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #aa0000; font-weight: bold;">class </span><span style="color: #007744;">!=</span> <span style="color: #000044;">Regexp</span>
   <span style="color: #000044;">self</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">inspect</span> <span style="color: #444477; font-weight: bold;">==</span> <span style="color: #000044;">other</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">inspect</span>
 <span style="color: #aa0000; font-weight: bold;">end</span>

 <span style="color: #000044;">alias_method</span> <span style="color: #009999;">:"</span><span style="color: #009999;">==</span><span style="color: #009999;">"</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #009999;">:eql?</span>

 <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">hash</span>
   <span style="color: #0077ff;">self</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">inspect</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">hash</span>
 <span style="color: #aa0000; font-weight: bold;">end</span>
<span style="color: #aa0000; font-weight: bold;">end</span></pre>
</pre>
<p>Esta corrección me anduvo con la siguiente versión de ruby:</p>
<pre>
<pre style="font-size: 1.1em; background-color: #ffffcc; color: #000000; overflow-x: auto; overflow-y: auto; margin-top: 4px; margin-right: 0px; margin-bottom: 4px; margin-left: 0px; width: 608px; padding: 10px; border: thin dashed initial;">$ ruby --version
ruby 1.8.7 (2008-08-11 patchlevel 72) [i486-linux]</pre>
</pre>
<p>Espero que les sirva.<br />
Happy hacking,<br />
Aureliano.</p>
<div class="blogger-post-footer"><img src="https://blogger.googleusercontent.com/tracker/1437970354124720603-1030567752923382780?l=aurelianito.blogspot.com" alt="" width="1" height="1" /></div>
<p>(Via <a href="http://aurelianito.blogspot.com/">aurelianito</a>.) Original Link: <a href="http://aurelianito.blogspot.com/2009/07/patch-en-regexp-para-poder-usarlas-como.html">Patch en Regexp para poder usarlas como clave en un Hash</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/07/06/patch-en-regexp-para-poder-usarlas-como-clave-en-un-hash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Más rapidito</title>
		<link>http://www.mundoruby.com.ar/2009/07/01/mas-rapidito/</link>
		<comments>http://www.mundoruby.com.ar/2009/07/01/mas-rapidito/#comments</comments>
		<pubDate>Wed, 01 Jul 2009 19:22:18 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[trac]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=119</guid>
		<description><![CDATA[Como les estuve contando, sigo escribiendo mi wiki. Ya parsea un subconjunto interesante del lenguaje definido por trac.
Siguiendo la tradición, les cuento como está avanzando el tokenizer. Al tokenizer lo simplifiqué para que devuelva la expresión regular que matcheo junto con el match (en vez del &#8220;tipo&#8221;). Esto hizo que la interfase para definir las [...]]]></description>
			<content:encoded><![CDATA[<p>Como <a href="http://aurelianito.blogspot.com/2009/06/tokenizer-de-rapidito.html">les</a> <a href="http://aurelianito.blogspot.com/2009/06/tokenizer-de-rapidito-segunda-version.html">estuve</a> <a href="http://aurelianito.blogspot.com/2009/06/pequenas-delicias-de-las-expresiones.html">contando</a>, sigo escribiendo mi wiki. Ya parsea un subconjunto interesante del lenguaje definido por <a href="http://trac.edgewall.org">trac</a>.<br />
Siguiendo la tradición, les cuento como está avanzando el tokenizer. Al tokenizer lo simplifiqué para que devuelva la expresión regular que matcheo junto con el match (en vez del &#8220;tipo&#8221;). Esto hizo que la interfase para definir las reglas para tokenizar sea más simple. Si no hay ninguna regla que matchee sigue devolviendo <tt>["string", :text]</tt>.<br />
Sin más, acá el código:</p>
<pre class="ruby">
<pre style="font-size: 1.1em; background-color: #ffffcc; color: #000000; overflow-x: auto; overflow-y: auto; margin-top: 4px; margin-right: 0px; margin-bottom: 4px; margin-left: 0px; width: 608px; padding: 10px; border: thin dashed initial;"><span style="color: #aa0000; font-weight: bold;">module </span><span style="color: #005500;">Rapidito</span>
  <span style="color: #aa0000; font-weight: bold;">class </span><span style="color: #007744;">Tokenizer</span>

    <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">initialize</span><span style="color: #444477; font-weight: bold;">(</span> <span style="color: #444477; font-weight: bold;">*</span><span style="color: #000044;">delimiters</span> <span style="color: #444477; font-weight: bold;">)</span>
      <span style="color: #337777;">@delimiter_list</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #000044;">delimiters</span> <span style="color: #444477; font-weight: bold;">+</span>  <span style="color: #444477; font-weight: bold;">[/</span><span style="color: #bb6666;"><span>\z</span></span><span style="color: #444477; font-weight: bold;">/]</span>
      <span style="color: #337777;">@match_cache</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #0077ff;">nil</span>
    <span style="color: #aa0000; font-weight: bold;">end</span>

    <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">source</span>
      <span style="color: #000044;">valid_cache?</span> <span style="color: #444477; font-weight: bold;">?</span> <span style="color: #337777;">@match_cache</span><span style="color: #444477; font-weight: bold;">[</span><span style="color: #dd5555;">0</span><span style="color: #444477; font-weight: bold;">].</span><span style="color: #000044;">to_s</span> <span style="color: #444477; font-weight: bold;">+</span> <span style="color: #337777;">@source</span> <span style="color: #444477; font-weight: bold;">:</span> <span style="color: #337777;">@source</span>
    <span style="color: #aa0000; font-weight: bold;">end</span>

    <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">source=</span><span style="color: #444477; font-weight: bold;">(</span><span style="color: #000044;">s</span><span style="color: #444477; font-weight: bold;">)</span>
      <span style="color: #337777;">@match_cache</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #0077ff;">nil</span>
      <span style="color: #337777;">@source</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #000044;">s</span>
    <span style="color: #aa0000; font-weight: bold;">end</span>

    <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">has_next?</span>
      <span style="color: #444477; font-weight: bold;">!</span><span style="color: #337777;">@source</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">empty?</span> <span style="color: #444477; font-weight: bold;">||</span> <span style="color: #000044;">valid_cache?</span>
    <span style="color: #aa0000; font-weight: bold;">end</span>

    <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">valid_cache?</span>
      <span style="color: #444477; font-weight: bold;">(!</span><span style="color: #337777;">@match_cache</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">nil?</span><span style="color: #444477; font-weight: bold;">)</span> <span style="color: #444477; font-weight: bold;">&amp;&amp;</span> <span style="color: #444477; font-weight: bold;">(</span><span style="color: #337777;">@match_cache</span><span style="color: #444477; font-weight: bold;">[</span><span style="color: #dd5555;">0</span><span style="color: #444477; font-weight: bold;">].</span><span style="color: #000044;">to_s</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">length</span> <span style="color: #444477; font-weight: bold;">&gt;</span> <span style="color: #dd5555;">0</span><span style="color: #444477; font-weight: bold;">)</span>
    <span style="color: #aa0000; font-weight: bold;">end</span>

    <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">next_match</span>
      <span style="color: #337777;">@delimiter_list</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">map</span> <span style="color: #444477; font-weight: bold;">{|</span><span style="color: #000044;">regex</span><span style="color: #444477; font-weight: bold;">|</span> <span style="color: #444477; font-weight: bold;">[</span><span style="color: #000044;">regex</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">match</span><span style="color: #444477; font-weight: bold;">(</span><span style="color: #337777;">@source</span><span style="color: #444477; font-weight: bold;">),</span><span style="color: #000044;">regex</span><span style="color: #444477; font-weight: bold;">]}.</span><span style="color: #000044;">reject</span> <span style="color: #444477; font-weight: bold;">{|</span><span style="color: #000044;">p</span><span style="color: #444477; font-weight: bold;">|</span> <span style="color: #000044;">p</span><span style="color: #444477; font-weight: bold;">[</span><span style="color: #dd5555;">0</span><span style="color: #444477; font-weight: bold;">].</span><span style="color: #000044;">nil?</span><span style="color: #444477; font-weight: bold;">}.</span><span style="color: #000044;">inject</span> <span style="color: #aa0000; font-weight: bold;">do</span>
        <span style="color: #444477; font-weight: bold;">|</span><span style="color: #000044;">better</span><span style="color: #444477; font-weight: bold;">,</span><span style="color: #000044;">new</span><span style="color: #444477; font-weight: bold;">|</span>
        <span style="color: #000044;">better_pos</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #000044;">better</span><span style="color: #444477; font-weight: bold;">[</span><span style="color: #dd5555;">0</span><span style="color: #444477; font-weight: bold;">].</span><span style="color: #000044;">pre_match</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">length</span>
        <span style="color: #000044;">new_pos</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #000044;">new</span><span style="color: #444477; font-weight: bold;">[</span><span style="color: #dd5555;">0</span><span style="color: #444477; font-weight: bold;">].</span><span style="color: #000044;">pre_match</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">length</span>

        <span style="color: #aa0000; font-weight: bold;">if</span> <span style="color: #000044;">better_pos</span> <span style="color: #444477; font-weight: bold;">&lt;</span> <span style="color: #000044;">new_pos</span>
          <span style="color: #000044;">better</span>
        <span style="color: #aa0000; font-weight: bold;">elsif</span> <span style="color: #000044;">new_pos</span> <span style="color: #444477; font-weight: bold;">&lt;</span> <span style="color: #000044;">better_pos</span>
          <span style="color: #000044;">new</span>
        <span style="color: #aa0000; font-weight: bold;">elsif</span> <span style="color: #000044;">better</span><span style="color: #444477; font-weight: bold;">[</span><span style="color: #dd5555;">0</span><span style="color: #444477; font-weight: bold;">].</span><span style="color: #000044;">to_s</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">length</span> <span style="color: #444477; font-weight: bold;">&gt;</span> <span style="color: #000044;">new</span><span style="color: #444477; font-weight: bold;">[</span><span style="color: #dd5555;">0</span><span style="color: #444477; font-weight: bold;">].</span><span style="color: #000044;">to_s</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">length</span>
          <span style="color: #000044;">better</span>
        <span style="color: #aa0000; font-weight: bold;">else</span>
          <span style="color: #000044;">new</span>
        <span style="color: #aa0000; font-weight: bold;">end</span>
      <span style="color: #aa0000; font-weight: bold;">end</span>
    <span style="color: #aa0000; font-weight: bold;">end</span>

    <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">next_token</span>
      <span style="color: #aa0000; font-weight: bold;">if</span> <span style="color: #337777;">@match_cache</span> <span style="color: #000055; font-style: italic;">#cached delimiter</span>
        <span style="color: #000044;">rv</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #337777;">@match_cache</span>
        <span style="color: #337777;">@match_cache</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #0077ff;">nil</span>
        <span style="color: #aa0000; font-weight: bold;">return</span> <span style="color: #000044;">rv</span>
      <span style="color: #aa0000; font-weight: bold;">end</span>

      <span style="color: #000044;">match</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #000044;">next_match</span>
      <span style="color: #000044;">p</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #000044;">match</span><span style="color: #444477; font-weight: bold;">[</span><span style="color: #dd5555;">0</span><span style="color: #444477; font-weight: bold;">].</span><span style="color: #000044;">pre_match</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">length</span>
      <span style="color: #337777;">@source</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #337777;">@source</span><span style="color: #444477; font-weight: bold;">[</span><span style="color: #000044;">p</span> <span style="color: #444477; font-weight: bold;">+</span> <span style="color: #000044;">match</span><span style="color: #444477; font-weight: bold;">[</span><span style="color: #dd5555;">0</span><span style="color: #444477; font-weight: bold;">].</span><span style="color: #000044;">to_s</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">length</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #337777;">@source</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">length</span><span style="color: #444477; font-weight: bold;">]</span>

      <span style="color: #aa0000; font-weight: bold;">if</span> <span style="color: #000044;">p</span> <span style="color: #444477; font-weight: bold;">==</span> <span style="color: #dd5555;">0</span> <span style="color: #000055; font-style: italic;">#delimiter</span>
        <span style="color: #000044;">match</span>
      <span style="color: #aa0000; font-weight: bold;">else</span> <span style="color: #000055; font-style: italic;">#text</span>
        <span style="color: #337777;">@match_cache</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #000044;">match</span>
        <span style="color: #444477; font-weight: bold;">[</span><span style="color: #000044;">match</span><span style="color: #444477; font-weight: bold;">[</span><span style="color: #dd5555;">0</span><span style="color: #444477; font-weight: bold;">].</span><span style="color: #000044;">pre_match</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #009999;">:text</span><span style="color: #444477; font-weight: bold;">]</span>
      <span style="color: #aa0000; font-weight: bold;">end</span>
    <span style="color: #aa0000; font-weight: bold;">end</span>

    <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">all_tokens</span>
      <span style="color: #000044;">tokens</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #444477; font-weight: bold;">[]</span>
      <span style="color: #aa0000; font-weight: bold;">while</span> <span style="color: #000044;">has_next?</span>
        <span style="color: #000044;">tokens</span> <span style="color: #444477; font-weight: bold;">&lt;&lt;</span> <span style="color: #000044;">next_token</span>
      <span style="color: #aa0000; font-weight: bold;">end</span>
      <span style="color: #000044;">tokens</span>
    <span style="color: #aa0000; font-weight: bold;">end</span>
  <span style="color: #aa0000; font-weight: bold;">end</span>
<span style="color: #aa0000; font-weight: bold;">end</span></pre>
</pre>
<p>Y si miran los tests de unidad, van a ver que también quedaron más lindos:</p>
<pre class="ruby">
<pre style="font-size: 1.1em; background-color: #ffffcc; color: #000000; overflow-x: auto; overflow-y: auto; margin-top: 4px; margin-right: 0px; margin-bottom: 4px; margin-left: 0px; width: 608px; padding: 10px; border: thin dashed initial;"><span style="color: #000044;">require</span> <span style="color: #444477; font-weight: bold;">'</span><span style="color: #994444;">test/unit</span><span style="color: #444477; font-weight: bold;">'</span>
<span style="color: #000044;">require</span> <span style="color: #444477; font-weight: bold;">'</span><span style="color: #994444;">rapidito/tokenizer</span><span style="color: #444477; font-weight: bold;">'</span>

<span style="color: #000044;">include</span> <span style="color: #0077ff;">Rapidito</span>

<span style="color: #aa0000; font-weight: bold;">class </span><span style="color: #007744;">TokenizerTest</span> <span style="color: #444477; font-weight: bold;">&lt;</span> <span style="color: #0077ff;">Test</span><span style="color: #444477; font-weight: bold;">::</span><span style="color: #0077ff;">Unit</span><span style="color: #444477; font-weight: bold;">::</span><span style="color: #0077ff;">TestCase</span>

  <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">test_no_token</span>
    <span style="color: #000044;">tok</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #0077ff;">Tokenizer</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">new</span>
    <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">source</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #444477; font-weight: bold;">"</span><span style="color: #994444;">aaaa</span><span style="color: #444477; font-weight: bold;">"</span>
    <span style="color: #000044;">assert_equal</span> <span style="color: #0077ff;">true</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">has_next?</span>
    <span style="color: #000044;">assert_equal</span> <span style="color: #444477; font-weight: bold;">["</span><span style="color: #994444;">aaaa</span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #009999;">:text</span><span style="color: #444477; font-weight: bold;">],</span> <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">next_token</span>
    <span style="color: #000044;">assert_equal</span> <span style="color: #0077ff;">false</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">has_next?</span>
  <span style="color: #aa0000; font-weight: bold;">end</span>

  <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">assert_all_tokens</span><span style="color: #444477; font-weight: bold;">(</span> <span style="color: #000044;">expected</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #000044;">tokenizer</span> <span style="color: #444477; font-weight: bold;">)</span>
    <span style="color: #000044;">assert_equal</span> <span style="color: #000044;">expected</span><span style="color: #444477; font-weight: bold;">,</span>
      <span style="color: #000044;">tokenizer</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">all_tokens</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">map</span> <span style="color: #444477; font-weight: bold;">{</span> <span style="color: #444477; font-weight: bold;">|</span><span style="color: #000044;">token</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #000044;">kind</span><span style="color: #444477; font-weight: bold;">|</span> <span style="color: #444477; font-weight: bold;">[</span><span style="color: #000044;">token</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">to_s</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #000044;">kind</span><span style="color: #444477; font-weight: bold;">]</span> <span style="color: #444477; font-weight: bold;">}</span>
  <span style="color: #aa0000; font-weight: bold;">end</span>

  <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">test_two_delimiters</span>
    <span style="color: #000044;">tok</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #0077ff;">Tokenizer</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">new</span><span style="color: #444477; font-weight: bold;">(</span>
      <span style="color: #444477; font-weight: bold;">/</span><span style="color: #bb6666;"><span>\|</span></span><span style="color: #444477; font-weight: bold;">/,</span> <span style="color: #444477; font-weight: bold;">/</span><span style="color: #bb6666;">;;</span><span style="color: #444477; font-weight: bold;">/</span>
    <span style="color: #444477; font-weight: bold;">)</span>

    <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">source</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #444477; font-weight: bold;">"</span><span style="color: #994444;">aa|bbb;;;;cccc</span><span style="color: #444477; font-weight: bold;">"</span>
    <span style="color: #000044;">assert_all_tokens</span> \
      <span style="color: #444477; font-weight: bold;">[</span> <span style="color: #444477; font-weight: bold;">["</span><span style="color: #994444;">aa</span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #009999;">:text</span><span style="color: #444477; font-weight: bold;">],</span> <span style="color: #444477; font-weight: bold;">["</span><span style="color: #994444;">|</span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #444477; font-weight: bold;">/</span><span style="color: #bb6666;"><span>\|</span></span><span style="color: #444477; font-weight: bold;">/],</span> <span style="color: #444477; font-weight: bold;">["</span><span style="color: #994444;">bbb</span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #009999;">:text</span><span style="color: #444477; font-weight: bold;">],</span>
        <span style="color: #444477; font-weight: bold;">["</span><span style="color: #994444;">;;</span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #444477; font-weight: bold;">/</span><span style="color: #bb6666;">;;</span><span style="color: #444477; font-weight: bold;">/],</span> <span style="color: #444477; font-weight: bold;">["</span><span style="color: #994444;">;;</span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #444477; font-weight: bold;">/</span><span style="color: #bb6666;">;;</span><span style="color: #444477; font-weight: bold;">/],</span> <span style="color: #444477; font-weight: bold;">["</span><span style="color: #994444;">cccc</span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #009999;">:text</span><span style="color: #444477; font-weight: bold;">]</span> <span style="color: #444477; font-weight: bold;">],</span>
      <span style="color: #000044;">tok</span>

    <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">source</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #444477; font-weight: bold;">"</span><span style="color: #994444;">aa;;bbb||cccc</span><span style="color: #444477; font-weight: bold;">"</span>
    <span style="color: #000044;">assert_all_tokens</span> \
      <span style="color: #444477; font-weight: bold;">[</span> <span style="color: #444477; font-weight: bold;">["</span><span style="color: #994444;">aa</span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #009999;">:text</span><span style="color: #444477; font-weight: bold;">],</span> <span style="color: #444477; font-weight: bold;">["</span><span style="color: #994444;">;;</span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #444477; font-weight: bold;">/</span><span style="color: #bb6666;">;;</span><span style="color: #444477; font-weight: bold;">/],</span> <span style="color: #444477; font-weight: bold;">["</span><span style="color: #994444;">bbb</span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #009999;">:text</span><span style="color: #444477; font-weight: bold;">],</span>
        <span style="color: #444477; font-weight: bold;">["</span><span style="color: #994444;">|</span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #444477; font-weight: bold;">/</span><span style="color: #bb6666;"><span>\|</span></span><span style="color: #444477; font-weight: bold;">/],</span> <span style="color: #444477; font-weight: bold;">["</span><span style="color: #994444;">|</span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #444477; font-weight: bold;">/</span><span style="color: #bb6666;"><span>\|</span></span><span style="color: #444477; font-weight: bold;">/],</span> <span style="color: #444477; font-weight: bold;">["</span><span style="color: #994444;">cccc</span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #009999;">:text</span><span style="color: #444477; font-weight: bold;">]</span> <span style="color: #444477; font-weight: bold;">],</span>
      <span style="color: #000044;">tok</span>
  <span style="color: #aa0000; font-weight: bold;">end</span>

  <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">test_choose_longest_match</span>
    <span style="color: #000044;">tok</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #0077ff;">Tokenizer</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">new</span><span style="color: #444477; font-weight: bold;">(</span>
      <span style="color: #444477; font-weight: bold;">/</span><span style="color: #bb6666;">aa</span><span style="color: #444477; font-weight: bold;">/,</span> <span style="color: #444477; font-weight: bold;">/</span><span style="color: #bb6666;">aaa</span><span style="color: #444477; font-weight: bold;">/</span>
    <span style="color: #444477; font-weight: bold;">)</span>
    <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">source</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #444477; font-weight: bold;">"</span><span style="color: #994444;">aaaa</span><span style="color: #444477; font-weight: bold;">"</span>
    <span style="color: #000044;">assert_all_tokens</span> <span style="color: #444477; font-weight: bold;">[</span> <span style="color: #444477; font-weight: bold;">["</span><span style="color: #994444;">aaa</span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #444477; font-weight: bold;">/</span><span style="color: #bb6666;">aaa</span><span style="color: #444477; font-weight: bold;">/],</span> <span style="color: #444477; font-weight: bold;">["</span><span style="color: #994444;">a</span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #009999;">:text</span> <span style="color: #444477; font-weight: bold;">]</span> <span style="color: #444477; font-weight: bold;">],</span> <span style="color: #000044;">tok</span>
  <span style="color: #aa0000; font-weight: bold;">end</span>

  <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">test_reset_precache</span>
    <span style="color: #000044;">tok</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #0077ff;">Tokenizer</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">new</span><span style="color: #444477; font-weight: bold;">(</span>
      <span style="color: #444477; font-weight: bold;">/</span><span style="color: #bb6666;"><span>\|</span></span><span style="color: #444477; font-weight: bold;">/,</span> <span style="color: #444477; font-weight: bold;">/</span><span style="color: #bb6666;">,</span><span style="color: #444477; font-weight: bold;">/</span>
    <span style="color: #444477; font-weight: bold;">)</span>
    <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">source</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #444477; font-weight: bold;">"</span><span style="color: #994444;">original start|original end</span><span style="color: #444477; font-weight: bold;">"</span>
    <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">next_token</span>
    <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">source</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #444477; font-weight: bold;">"</span><span style="color: #994444;">new start,new end</span><span style="color: #444477; font-weight: bold;">"</span>
    <span style="color: #000044;">assert_equal</span> <span style="color: #444477; font-weight: bold;">["</span><span style="color: #994444;">new start</span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #009999;">:text</span><span style="color: #444477; font-weight: bold;">],</span> <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">next_token</span>
  <span style="color: #aa0000; font-weight: bold;">end</span>

  <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">test_almost_finished</span>
    <span style="color: #000044;">tok</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #0077ff;">Tokenizer</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">new</span><span style="color: #444477; font-weight: bold;">(</span> <span style="color: #444477; font-weight: bold;">/</span><span style="color: #bb6666;">!</span><span style="color: #444477; font-weight: bold;">/</span> <span style="color: #444477; font-weight: bold;">)</span>
    <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">source</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #444477; font-weight: bold;">"</span><span style="color: #994444;">bang!</span><span style="color: #444477; font-weight: bold;">"</span>
    <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">next_token</span>
    <span style="color: #000044;">assert_equal</span> <span style="color: #0077ff;">true</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">has_next?</span>
    <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">next_token</span>
    <span style="color: #000044;">assert_equal</span> <span style="color: #0077ff;">false</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">has_next?</span>
  <span style="color: #aa0000; font-weight: bold;">end</span>

  <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">test_carriage_return_ending</span>
    <span style="color: #000044;">tok</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #0077ff;">Tokenizer</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">new</span><span style="color: #444477; font-weight: bold;">(</span> <span style="color: #444477; font-weight: bold;">/</span><span style="color: #bb6666;">!</span><span style="color: #444477; font-weight: bold;">/</span> <span style="color: #444477; font-weight: bold;">)</span>
    <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">source</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #444477; font-weight: bold;">"</span><span style="color: #994444;">bang!<span>\n</span></span><span style="color: #444477; font-weight: bold;">"</span>
    <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">next_token</span>
    <span style="color: #000044;">assert_equal</span> <span style="color: #0077ff;">true</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">has_next?</span>
    <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">next_token</span>
    <span style="color: #000044;">assert_equal</span> <span style="color: #0077ff;">true</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">has_next?</span>
    <span style="color: #000044;">assert_equal</span> <span style="color: #444477; font-weight: bold;">"</span><span style="color: #994444;"><span>\n</span></span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">next_token</span><span style="color: #444477; font-weight: bold;">[</span><span style="color: #dd5555;">0</span><span style="color: #444477; font-weight: bold;">].</span><span style="color: #000044;">to_s</span>
    <span style="color: #000044;">assert_equal</span> <span style="color: #0077ff;">false</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">has_next?</span>
  <span style="color: #aa0000; font-weight: bold;">end</span>

  <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">test_transparent_caching</span>
    <span style="color: #000044;">tok</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #0077ff;">Tokenizer</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">new</span><span style="color: #444477; font-weight: bold;">(</span> <span style="color: #444477; font-weight: bold;">/</span><span style="color: #bb6666;">!</span><span style="color: #444477; font-weight: bold;">/</span> <span style="color: #444477; font-weight: bold;">)</span>
    <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">source</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #444477; font-weight: bold;">"</span><span style="color: #994444;">bang!pum</span><span style="color: #444477; font-weight: bold;">"</span>
    <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">next_token</span>

    <span style="color: #000044;">assert_equal</span> <span style="color: #444477; font-weight: bold;">"</span><span style="color: #994444;">!pum</span><span style="color: #444477; font-weight: bold;">",</span> <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">source</span>
  <span style="color: #aa0000; font-weight: bold;">end</span>

  <span style="color: #aa0000; font-weight: bold;">def </span><span style="color: #007777;">test_match_klass</span>
    <span style="color: #000044;">tok</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #0077ff;">Tokenizer</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">new</span><span style="color: #444477; font-weight: bold;">(</span> <span style="color: #444477; font-weight: bold;">/</span><span style="color: #bb6666;">!</span><span style="color: #444477; font-weight: bold;">/</span> <span style="color: #444477; font-weight: bold;">)</span>
    <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">source</span> <span style="color: #444477; font-weight: bold;">=</span> <span style="color: #444477; font-weight: bold;">"</span><span style="color: #994444;">!bang!pum</span><span style="color: #444477; font-weight: bold;">"</span>

    <span style="color: #000044;">assert_equal</span> \
      <span style="color: #444477; font-weight: bold;">[</span><span style="color: #0077ff;">MatchData</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #0077ff;">String</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #0077ff;">MatchData</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #0077ff;">String</span><span style="color: #444477; font-weight: bold;">],</span>
      <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">all_tokens</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #000044;">map</span> <span style="color: #444477; font-weight: bold;">{</span> <span style="color: #444477; font-weight: bold;">|</span><span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">,</span> <span style="color: #000044;">kind</span><span style="color: #444477; font-weight: bold;">|</span> <span style="color: #000044;">tok</span><span style="color: #444477; font-weight: bold;">.</span><span style="color: #aa0000; font-weight: bold;">class </span><span style="color: #007744;">}</span>
  <span style="color: #000044;">end</span>
<span style="color: #aa0000; font-weight: bold;">end</span></pre>
</pre>
<p>Happy hacking,<br />
Aureliano.</p>
<div class="blogger-post-footer"><img src="https://blogger.googleusercontent.com/tracker/1437970354124720603-1410164064116629157?l=aurelianito.blogspot.com" alt="" width="1" height="1" /></div>
<p>(Via <a href="http://aurelianito.blogspot.com/">aurelianito</a>.)  Original Link: <a href="http://aurelianito.blogspot.com/2009/06/mas-rapidito.html">Más rapidito</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/07/01/mas-rapidito/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Configurar passenger con nginx</title>
		<link>http://www.mundoruby.com.ar/2009/06/07/configurar-passenger-con-nginx/</link>
		<comments>http://www.mundoruby.com.ar/2009/06/07/configurar-passenger-con-nginx/#comments</comments>
		<pubDate>Sun, 07 Jun 2009 22:04:22 +0000</pubDate>
		<dc:creator>FreedomCoder</dc:creator>
				<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[Enterprise]]></category>
		<category><![CDATA[how-to]]></category>

		<guid isPermaLink="false">http://www.mundoruby.com.ar/?p=98</guid>
		<description><![CDATA[
Instalar Ruby Enterprise Edition


sudo apt-get install build-essential zlib1g-dev libssl-dev libreadline5-dev




wget http://rubyforge.org/frs/download.php/51100/ruby-enterprise-1.8.6-20090201.tar.gz
tar xvfz ruby-enterprise-1.8.6-20090201.tar.gz
rm ruby-enterprise-1.8.6-20090201.tar.gz
cd ruby-enterprise-1.8.6-20090201/
sudo ./installer


Agregar ruby entrerprise al path del sistema


echo &#34;export PATH=/opt/ruby-enterprise-1.8.6-20090201/bin:$PATH&#34; &#62;&#62; ~/.profile &#38;&#38; . ~/.profile


Nginx


sudo /opt/ruby-enterprise-1.8.6-20090201/bin/passenger-install-nginx-module


Elegir la opcion 1. Yes: download, compile and install Nginx for me. (recommended)
Script de inicio Nginx
Agregar el siguiente codigo en


/etc/init.d/nginx
sudo chown root:root /etc/init.d/nginx


Probar una aplicacion rails [...]]]></description>
			<content:encoded><![CDATA[<p>
<p><strong>Instalar Ruby Enterprise Edition</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="ruby ruby" style="font-family:monospace;">sudo apt<span style="color:#006600; font-weight:bold;">-</span>get install build<span style="color:#006600; font-weight:bold;">-</span>essential zlib1g<span style="color:#006600; font-weight:bold;">-</span>dev libssl<span style="color:#006600; font-weight:bold;">-</span>dev libreadline5<span style="color:#006600; font-weight:bold;">-</span>dev</pre>
</div>
</div>
<div class="wp_syntax">
<div class="code">
<pre class="ruby ruby" style="font-family:monospace;">wget http:<span style="color:#006600; font-weight:bold;">//</span>rubyforge.<span style="color:#9900CC;">org</span><span style="color:#006600; font-weight:bold;">/</span>frs<span style="color:#006600; font-weight:bold;">/</span>download.<span style="color:#9900CC;">php</span><span style="color:#006600; font-weight:bold;">/</span><span style="color:#006666;">51100</span><span style="color:#006600; font-weight:bold;">/</span>ruby<span style="color:#006600; font-weight:bold;">-</span>enterprise<span style="color:#006600; font-weight:bold;">-</span>1.8.6<span style="color:#006600; font-weight:bold;">-</span>20090201.<span style="color:#9900CC;">tar</span>.<span style="color:#9900CC;">gz</span>
tar xvfz ruby<span style="color:#006600; font-weight:bold;">-</span>enterprise<span style="color:#006600; font-weight:bold;">-</span>1.8.6<span style="color:#006600; font-weight:bold;">-</span>20090201.<span style="color:#9900CC;">tar</span>.<span style="color:#9900CC;">gz</span>
rm ruby<span style="color:#006600; font-weight:bold;">-</span>enterprise<span style="color:#006600; font-weight:bold;">-</span>1.8.6<span style="color:#006600; font-weight:bold;">-</span>20090201.<span style="color:#9900CC;">tar</span>.<span style="color:#9900CC;">gz</span>
cd ruby<span style="color:#006600; font-weight:bold;">-</span>enterprise<span style="color:#006600; font-weight:bold;">-</span>1.8.6<span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">20090201</span><span style="color:#006600; font-weight:bold;">/</span>
sudo .<span style="color:#006600; font-weight:bold;">/</span>installer</pre>
</div>
</div>
<p>Agregar ruby entrerprise al path del sistema</p>
<div class="wp_syntax">
<div class="code">
<pre class="ruby ruby" style="font-family:monospace;">echo <span style="color:#996600;">&quot;export PATH=/opt/ruby-enterprise-1.8.6-20090201/bin:$PATH&quot;</span> <span style="color:#006600; font-weight:bold;">&gt;&gt;</span> ~<span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#9900CC;">profile</span> <span style="color:#006600; font-weight:bold;">&amp;&amp;</span> . ~<span style="color:#006600; font-weight:bold;">/</span>.<span style="color:#9900CC;">profile</span></pre>
</div>
</div>
<p><strong>Nginx</strong></p>
<div class="wp_syntax">
<div class="code">
<pre class="ruby ruby" style="font-family:monospace;">sudo <span style="color:#006600; font-weight:bold;">/</span>opt<span style="color:#006600; font-weight:bold;">/</span>ruby<span style="color:#006600; font-weight:bold;">-</span>enterprise<span style="color:#006600; font-weight:bold;">-</span>1.8.6<span style="color:#006600; font-weight:bold;">-</span><span style="color:#006666;">20090201</span><span style="color:#006600; font-weight:bold;">/</span>bin<span style="color:#006600; font-weight:bold;">/</span>passenger<span style="color:#006600; font-weight:bold;">-</span>install<span style="color:#006600; font-weight:bold;">-</span>nginx<span style="color:#006600; font-weight:bold;">-</span><span style="color:#9966CC; font-weight:bold;">module</span></pre>
</div>
</div>
<p><em>Elegir la opcion 1. Yes: download, compile and install Nginx for me. (recommended)</em></p>
<p><strong>Script de inicio Nginx</strong></p>
<p>Agregar el <a href="http://gist.github.com/125465">siguiente codigo</a> en</p>
<div class="wp_syntax">
<div class="code">
<pre class="ruby ruby" style="font-family:monospace;"><span style="color:#006600; font-weight:bold;">/</span>etc<span style="color:#006600; font-weight:bold;">/</span>init.<span style="color:#9900CC;">d</span><span style="color:#006600; font-weight:bold;">/</span>nginx
sudo chown root:root <span style="color:#006600; font-weight:bold;">/</span>etc<span style="color:#006600; font-weight:bold;">/</span>init.<span style="color:#9900CC;">d</span><span style="color:#006600; font-weight:bold;">/</span>nginx</pre>
</div>
</div>
<p><strong>Probar una aplicacion rails en nginx</strong><br />
agregar un virtual host</p>
<div class="wp_syntax">
<div class="code">
<pre class="ruby ruby" style="font-family:monospace;">server <span style="color:#006600; font-weight:bold;">&#123;</span>
    listen <span style="color:#006666;">80</span>;
    <span style="color:#008000; font-style:italic;"># server_name www.mycook.com;</span>
    root <span style="color:#006600; font-weight:bold;">/</span>home<span style="color:#006600; font-weight:bold;">/</span>deploy<span style="color:#006600; font-weight:bold;">/</span>testapp<span style="color:#006600; font-weight:bold;">/</span>public;
    passenger_enabled on;
<span style="color:#006600; font-weight:bold;">&#125;</span></pre>
</div>
</div>
<p>(Via <a href="http://www.chebyte.com.ar">Chebyte&#8217;s Blog</a>.) Original Link: <a href="http://www.chebyte.com.ar/2009/06/07/configurar-passenger-con-nginx/#comments">Configurar passenger con nginx</a></p>
<p><script type="text/javascript"><!--
google_ad_client = "pub-7949681675937032";
google_ad_slot = "0874687580";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
 </p>
]]></content:encoded>
			<wfw:commentRss>http://www.mundoruby.com.ar/2009/06/07/configurar-passenger-con-nginx/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

