<?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>jpcamargo &#187; ruby</title>
	<atom:link href="http://jpcamargo.com/category/tech/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://jpcamargo.com</link>
	<description>ruby &#039;mind.rand&#039; &#124; awk &#039;{ print $1 }&#039;</description>
	<lastBuildDate>Mon, 10 May 2010 17:41:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Termite &#8211; a command line time tracker</title>
		<link>http://jpcamargo.com/2010/05/10/termite-a-command-line-time-tracker/</link>
		<comments>http://jpcamargo.com/2010/05/10/termite-a-command-line-time-tracker/#comments</comments>
		<pubDate>Mon, 10 May 2010 17:40:58 +0000</pubDate>
		<dc:creator>jp</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[adium]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[sqlite]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[time tracking]]></category>

		<guid isPermaLink="false">http://jpcamargo.com/?p=315</guid>
		<description><![CDATA[Recently I felt the need to have some kind of time tracking tool, so I wrote a simple one in ruby. It requires only two gems to work (&#8216;rubygems&#8217; and &#8216;sqlite3-ruby&#8217;). It is definitely a work in progress, but right now it is very easy to use and it gives reports for the last few [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I felt the need to have some kind of time tracking tool, so I wrote a simple one in ruby. It requires only two gems to work (&#8216;rubygems&#8217; and &#8216;sqlite3-ruby&#8217;).</p>
<p>It is definitely a work in progress, but right now it is very easy to use and it gives reports for the last few days, last 3 weeks, and current month. Also, for mac users, it has the option to change your Adium statuses using osascript, with customizable status messages for a few situations.</p>
<p><img src="http://cl.ly/11ok/content" alt="termite report weekly" /><br />
weekly report</p>
<p><img src="http://cl.ly/10uo/content" alt="termite report monthly" /><br />
monthly report</p>
<p>You can find the source code and installation instructions at github (<a href="http://github.com/jao/termite">http://github.com/jao/termite</a>).</p>
<p>I plan to add features like, defining projects and tags to the worked time, and exporting the reports to formats like pdf and csv.</p>
]]></content:encoded>
			<wfw:commentRss>http://jpcamargo.com/2010/05/10/termite-a-command-line-time-tracker/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ports wipe &#124; homebrew + rvm</title>
		<link>http://jpcamargo.com/2010/04/30/ports-wipe-homebrew-rvm/</link>
		<comments>http://jpcamargo.com/2010/04/30/ports-wipe-homebrew-rvm/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 19:33:05 +0000</pubDate>
		<dc:creator>jp</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[homebrew]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[port be gone!]]></category>
		<category><![CDATA[rvm]]></category>

		<guid isPermaLink="false">http://jpcamargo.com/?p=313</guid>
		<description><![CDATA[Recently I&#8217;ve heard about Max Howell&#8216;s homebrew and Wayne E. Seguin&#8217;s rvm from a friend (caffo), and hearing that they were both pretty cool, I decided to give them a shot. So if, like me, you are curious about these tools, I&#8217;ll post what I did to install them. First I made backups (by moving [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve heard about <a href="http://twitter.com/mxcl">Max Howell</a>&#8216;s <a href="http://mxcl.github.com/homebrew/"><strong>homebrew</strong></a> and Wayne E. Seguin&#8217;s <a href="http://rvm.beginrescueend.com/"><abbr title="Rails Version Manager"><strong>rvm</strong></abbr></a> from a friend (<a href="http://rodrigofranco.com">caffo</a>), and hearing that they were both pretty cool, I decided to give them a shot.</p>
<p>So if, like me, you are curious about these tools, I&#8217;ll post what I did to install them.</p>
<p>First I made backups (by moving some folders around)</p>
<pre class="brush: bash; light: true;">
mv ~/.gem ~/gems-old
sudo mv /opt/local ~/macports-old
</pre>
<p>You could also install a gem called &#8216;rubygems_snapshot&#8217; and do a</p>
<pre class="brush: bash; light: true;">
gem snapshot export ~/my_gem_list.yml
</pre>
<p>or a simple</p>
<pre class="brush: bash; light: true;">
gem list > ~/gem_list.txt
</pre>
<p>and just plain delete your user gem repository</p>
<pre class="brush: bash; light: true; inline">
rm -rf ~/.gem/
</pre>
<p>Of course I am assuming you were installing them in your home directory, why wouldn&#8217;t you be?</p>
<p>But if by any chance you have gems installed all over the place you could try running this instead (since this would remove the applicable executables as well):</p>
<pre class="brush: bash; light: true;">
sudo gem list | awk '{print $1}' | xargs sudo gem uninstall -a -x -i
</pre>
<p>Now let&#8217;s get started.</p>
<h3>Installing homebrew</h3>
<p><a href="http://wiki.github.com/mxcl/homebrew/installation"><em>official installation instructions</em></a></p>
<p>Start by running:</p>
<pre class="brush: bash; light: true;">
ruby < <( curl 'http://gist.github.com/raw/323731/25f99360c7de3f72027d8fd07cb369b1c8756ea6/install_homebrew.rb' )
</pre>
<p>or download it from <a href="http://gist.github.com/323731">here</a> and run it yourself.</p>
<p>If by any chance you don't trust or know what that does, you can test it by running the code below that calls this <a href="http://gist.github.com/385387">simple and safe ruby script</a> first.</p>
<pre class="brush: bash; light: true;">
ruby < <( curl 'http://gist.github.com/raw/385387/0cacf4231fceb621c987221ee0aaa380be2bca5d/testing_download_and_run.rb' )
</pre>
<p>If you are curious, this is the source of that gist:</p>
<pre class="brush: ruby; light: true;">
#!/usr/bin/env ruby
puts 'Hello World'
</pre>
<p>Then install <a href="http://developer.apple.com/technologies/xcode.html">Xcode</a>, I recommend downloading the latest version <ins datetime="2010-04-30T17:45:15+00:00">3.2.2 at this moment</ins> from apple's website.</p>
<p>If you are the only person using your computer, you can change the ownership of <em>/usr/local</em> by doing a:</p>
<pre class="brush: bash; light: true;">
sudo chown -R $USER /user/local
</pre>
<p>Delete some folders:</p>
<pre class="brush: bash; light: true;">
rm -rf /usr/local/include
rm -rf /usr/local/lib
</pre>
<p>After that you can start playing around with homebrew i.e.</p>
<pre class="brush: bash; light: true;">
brew install wget
</pre>
<p>I install most if not all of my stuff from brew now, even mysql and other things that I would rather not get from port.<br />
<strong>Warning: do not remove your system's <em>/usr/bin/ruby</em> since brew depends on it.</strong></p>
<h3>Let's move to rvm installation now</h3>
<p>(<a href="http://rvm.beginrescueend.com/rvm/install/"><em>official installation instructions</em></a>)</p>
<p>To Install/update from the github repository, which they recommend, run:</p>
<pre class="brush: bash; light: true;">
bash < <( curl 'http://rvm.beginrescueend.com/releases/rvm-install-head' )
</pre>
<p>I had a version of <abbr title="Ruby Enterprise Edition">ree</abbr> installed in /opt, so I just deleted it, I recommend that you do the same.</p>
<p>Add this to your <em>.bash_profile</em> or <em>.bash_rc</em> file, whichever you use.</p>
<pre class="brush: bash; light: true;">
source ~/.rvm/scripts/rvm
</pre>
<p>They advise you to put it at the end of it, and to make sure you have no <em>return</em>s inside your file.</p>
<p>I have a reload function in my file so I just ran reload</p>
<pre class="brush: bash; light: true;>
reload () { source ~/.bash_profile }
</pre>
<p>but you have to <em>source</em> again the files you usually load when you open a new terminal.</p>
<p>Now start playing with rvm! Install your rubies!</p>
<pre class="brush: bash; light: true;">
rvm install ree
rvm install 1.9.1
rvm install 1.9.2-head
</pre>
<p>Set the one you use the most as the default one, at work is ree:</p>
<pre class="brush: bash; light: true;">
rvm ree --default
</pre>
<p>Everytime you open a new terminal, it should be using the default rvm ruby, but to make you might want to add the rvm-prompt feature to your default PS1. Add <em>~/.rvm/bin/rvm-prompt i v</em> to your PS1 variable, something like:</p>
<pre class="brush: bash; light: true;">
# a fancy ps1
export PS1="\e[1;33m\u\e[0m|\e[1;32m\h\e[0m \e[1;34m\w\e[0m |\e[33m$(~/.rvm/bin/rvm-prompt i v)\e[0m|\n\$ "
</pre>
<p>If you want to install a gem for all of your rubies run</p>
<pre class="brush: bash; light: true;">
rvm gem install gemname
</pre>
<p>if not, you just use your regular gem to install stuff (it should be using the specific gem for your chosen ruby - as you can see below).</p>
<pre class="brush: bash; light: true;">
$ which ruby
/Users/jao/.rvm/rubies/ree-1.8.7-2010.01/bin/ruby
$ which gem
/Users/jao/.rvm/rubies/ree-1.8.7-2010.01/bin/gem
</pre>
<p>I think that sums it up. Have fun!<br />
And ask questions or say if something is wrong in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://jpcamargo.com/2010/04/30/ports-wipe-homebrew-rvm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ruby: print in the same line</title>
		<link>http://jpcamargo.com/2009/10/26/ruby-print-in-the-same-line/</link>
		<comments>http://jpcamargo.com/2009/10/26/ruby-print-in-the-same-line/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 22:34:00 +0000</pubDate>
		<dc:creator>jp</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[inline]]></category>
		<category><![CDATA[response]]></category>

		<guid isPermaLink="false">http:///2009/10/26/ruby-print-in-the-same-line</guid>
		<description><![CDATA[I’ve always tried to make my scripts’ responses prettier and less crowded, and I came across something like the following piece of code, that helped me a lot lately #!/usr/bin/env ruby STDOUT.sync = true bars = ['/','-','\\','&#124;'] i=1 while i do print "\rrunning #{bars[i%4]}" i += 1 sleep 1 end trap("INT") { print "\n\n" exit [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve always tried to make my scripts’ responses prettier and less crowded, and I came across something like the following piece of code, that helped me a lot lately</p>
<p><code>
<pre class="brush: ruby">#!/usr/bin/env ruby
STDOUT.sync = true
bars = ['/','-','\\','|']
i=1
while i do
  print "\rrunning #{bars[i%4]}"
  i += 1
  sleep 1
end
trap("INT") {
  print "\n\n"
  exit
}
</pre>
<p></code><br />
If you like to see updates without flooding your terminal screen, this is one of the best ways to do it.</p>
]]></content:encoded>
			<wfw:commentRss>http://jpcamargo.com/2009/10/26/ruby-print-in-the-same-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
