<?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>UahRai! &#187; ruby</title>
	<atom:link href="http://www.gustavocaixeta.com/tag/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gustavocaixeta.com</link>
	<description>rake -D blog</description>
	<lastBuildDate>Sun, 22 Nov 2009 02:09:58 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Utilizando o rails 2.3 na Locaweb</title>
		<link>http://www.gustavocaixeta.com/2009/04/utilizando-o-rails-23-na-locaweb/</link>
		<comments>http://www.gustavocaixeta.com/2009/04/utilizando-o-rails-23-na-locaweb/#comments</comments>
		<pubDate>Sun, 12 Apr 2009 02:50:52 +0000</pubDate>
		<dc:creator>Gustavo Caixeta</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[locaweb]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.gustavocaixeta.com/?p=168</guid>
		<description><![CDATA[Nada como chegar em casa animado para iniciar um novo projetinho  
Primeiro, não sou profissional em sysadmin, e ainda não está 100% na Locaweb, pois não deve ter dado tempo ainda de fazer todos os ajustes necessários.
Desculpe-me qualquer &#8220;besteira&#8221; que eu tenha escrito nesse post ehehee  
Bem, a hospedagem compartilhada linux da locaweb [...]]]></description>
			<content:encoded><![CDATA[<p>Nada como chegar em casa animado para iniciar um novo projetinho <img src='http://www.gustavocaixeta.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Primeiro, não sou profissional em sysadmin, e ainda não está 100% na Locaweb, pois não deve ter dado tempo ainda de fazer todos os ajustes necessários.<br />
Desculpe-me qualquer &#8220;besteira&#8221; que eu tenha escrito nesse post ehehee <img src='http://www.gustavocaixeta.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Bem, a hospedagem compartilhada linux da locaweb hoje conta com aquela receita de passenger.</p>
<p>Basicamente, quis testar o ambiente antes de partir para o abraço.</p>
<p><span id="more-168"></span></p>
<p>Primeiros passos:<br />
- Instalar o &#8220;restful-authentication&#8221; (ainda vou brincar com os outros plugins)<br />
- Testar um cadastro comum via scaffold</p>
<p>Problemas:<br />
1) /signup não cadastrava e dava erro de mod_security (malformed header from script. Bad header)<br />
2) cadastro simples cadastrava, mas sem dados</p>
<p>Resolução:</p>
<p>1) Alterar o armazenamento de sessão do cookie para o banco</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vim</span> config<span style="color: #000000; font-weight: bold;">/</span>initializers<span style="color: #000000; font-weight: bold;">/</span>session_store.rb</pre></div></div>

<p>- Comente as linhas referentes ao &#8220;ActionController::Base.session &#8221;<br />
- Descomente a linha &#8220;ActionController::Base.session_store = :active_record_store&#8221;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rake db:sessions:create
rake db:migrate <span style="color: #007800;">RAILS_ENV</span>=production</pre></div></div>

<p>referências:</p>
<ul>
<li><a href="http://rails_security.lighthouseapp.com/projects/15332/tickets/40-rails-edge-and-passenger">http://rails_security.lighthouseapp.com/projects/15332/tickets/40-rails-edge-and-passenger</a></li>
</ul>
<p>2) Os cadastros ocorriam, porem apresentavam a seguinte diferença:</p>
<p>- Como era o log no ambiente de desenvolvimento via mongrel</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Processing UsersController#create (for 127.0.0.1 at 2009-04-11 22:07:18) [POST]
  Parameters: {&quot;user&quot;=&amp;gt;{&quot;nome&quot;=&amp;gt;&quot;nome&quot;, &quot;idade&quot;=&amp;gt;&quot;2&quot;}, &quot;commit&quot;=&amp;gt;&quot;Create&quot;, &quot;authenticity_token&quot;=&amp;gt;&quot;...&quot;}</pre></div></div>

<p>- Como ficava publicado na locaweb</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Processing UsersController#create (for 127.0.0.1 at 2009-04-11 21:50:10) [POST]
  Parameters: {&quot;commit&quot;=&amp;gt;&quot;Create&quot;, &quot;authenticity_token&quot;=&amp;gt;&quot;...&quot;, &quot;user[idade]&quot;=&amp;gt;&quot;2&quot;, &quot;user[nome]&quot;=&amp;gt;&quot;nome&quot;}</pre></div></div>

<p>Percebeu a diferença?<br />
A solução foi:</p>
<ul>
<li>Instalar a gem rack 0.9.1 primeiro <a href="http://wiki.locaweb.com.br/pt-br/Como_instalar_minhas_Ruby_Gems%3F">instalando gem personalizada</a></li>
<p>Inserindo a gem do rack no environment.rb</p>
<li>Puxando as gems do projeto para a pasta vendor/gems</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">vim</span> config<span style="color: #000000; font-weight: bold;">/</span>environment.rb</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">config.gem &quot;rack&quot;</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rake gems:unpack <span style="color: #007800;">GEM</span>=rack</pre></div></div>

<p>Li algo sobre isso <a href="https://rails.lighthouseapp.com/projects/8994/tickets/2259-params-hash-issues">aqui</a></p>
<p>Observações:</p>
<ul>
<li>O projeto deve já estar com freeze no rails 2.3.2</li>
<li>Não sei se estes são os únicos problemas</li>
</ul>
<p><b> Update: 2009-08-18 </b></p>
<p>Aparentemente não é necessário mais realizar toda essa &#8220;gambi&#8221; descrita ali em cima&#8230;<br />
Realizei novamente o teste e funcionou sem problemas.</p>
<p>Porem, as vezes ainda encontramos alguns problemas na hora de publicar um projeto. Por exemplo o <a href="http://twitter.com/lfsilveira ">@lfsilveira </a> teve problemas sérios em um projeto&#8230; Não sei bem o que aconteceu, parece que tinham migrado ele de servidor(suposição minha), perdido todas as permissões dos arquivos publicados e as gems da máquina haviam sumido :-O (o problema foi as permissões, já que o projeto estava com frezze). Nisso, arrumamos as permissões&#8230; no outro dia estava com problema novamente&#8230; desta vez, todas as gems haviam voltado (?!?) e estava ocorrendo este erro descrito pelo <a href="http://twitter.com/cedugenio">@cedugenio </a> <a href="http://rubyongenio.com/?p=93">em seu post</a>.</p>
<p>É isso <img src='http://www.gustavocaixeta.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  boa sorte nas publicações <img src='http://www.gustavocaixeta.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gustavocaixeta.com/2009/04/utilizando-o-rails-23-na-locaweb/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Gerando diagramas no seu projeto em Rails</title>
		<link>http://www.gustavocaixeta.com/2009/04/gerando-diagramas-no-seu-projeto-em-rails/</link>
		<comments>http://www.gustavocaixeta.com/2009/04/gerando-diagramas-no-seu-projeto-em-rails/#comments</comments>
		<pubDate>Sat, 11 Apr 2009 01:17:56 +0000</pubDate>
		<dc:creator>Gustavo Caixeta</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.gustavocaixeta.com/?p=67</guid>
		<description><![CDATA[No evento de Software Livre do ano passado na Unesp, o TaQ mostrou essa gem (o railroad).
Hoje utilizei ela para gerar um diagrama rápido do meu projeto (não quis pegar a folha de papel na mochila ehehe).

1) Entre no diretório do seu projeto via console
2) Instale a gem railroad

sudo gem install railroad  --no-ri --no-rdoc

3) [...]]]></description>
			<content:encoded><![CDATA[<p>No evento de Software Livre do ano passado na Unesp, o TaQ mostrou essa gem (o railroad).</p>
<p>Hoje utilizei ela para gerar um diagrama rápido do meu projeto (não quis pegar a folha de papel na mochila ehehe).<br />
<span id="more-67"></span><br />
1) Entre no diretório do seu projeto via console</p>
<p>2) Instale a gem railroad</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> railroad  <span style="color: #660033;">--no-ri</span> <span style="color: #660033;">--no-rdoc</span></pre></div></div>

<p>3) Instale o pacote graphviz para poder converter o dot para png</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> graphviz</pre></div></div>

<p>4) Rode o comando para gerar o .dot</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">railroad <span style="color: #660033;">-o</span> model.dot <span style="color: #660033;">-M</span></pre></div></div>

<p>5) Converta o .dot para .png</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dot <span style="color: #660033;">-Tpng</span> model.dot <span style="color: #000000; font-weight: bold;">&gt;</span> model.png</pre></div></div>

<p>Pronto, haverão 2 arquivos na raiz do seu projeto. Basta abrir o model.png e visualizar <img src='http://www.gustavocaixeta.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.gustavocaixeta.com/2009/04/gerando-diagramas-no-seu-projeto-em-rails/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Compilando Ruby na Mão ;)</title>
		<link>http://www.gustavocaixeta.com/2009/03/compilando-ruby-na-mao/</link>
		<comments>http://www.gustavocaixeta.com/2009/03/compilando-ruby-na-mao/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 13:52:54 +0000</pubDate>
		<dc:creator>Gustavo Caixeta</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[8.10]]></category>
		<category><![CDATA[compilacao]]></category>
		<category><![CDATA[intrepid ibex]]></category>

		<guid isPermaLink="false">http://www.gustavocaixeta.com/?p=110</guid>
		<description><![CDATA[Esse post é um tutorial de como compilar o Ruby 1.8.6 ou 1.8.7 no Ubuntu.
Minha motivação para esse post foi, um projeto meu antigo que apresentou uns problemas com o Ruby 1.8.7. Alem de já ter ouvido que o Ruby Compilado tem uma performance muito melhor.
Inicialmente, removemos todos os pacotes do gerenciador padrão do ubuntu.

sudo [...]]]></description>
			<content:encoded><![CDATA[<p>Esse post é um tutorial de como compilar o Ruby 1.8.6 ou 1.8.7 no Ubuntu.<br />
Minha motivação para esse post foi, um projeto meu antigo que apresentou uns problemas com o Ruby 1.8.7. Alem de já ter ouvido que o Ruby Compilado tem uma performance muito melhor.</p>
<p>Inicialmente, removemos todos os pacotes do gerenciador padrão do ubuntu.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> purge ruby ruby1.8 rdoc ri irb libopenssl-ruby ruby-dev libopenssl-ruby1.8 libreadline-ruby1.8 libruby1.8 ruby1.8-dev</pre></div></div>

<p><span id="more-110"></span><br />
Tambem é importante ter os compiladores básicos.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #660033;">-y</span> <span style="color: #c20cb9; font-weight: bold;">install</span> build-essential libssl-dev libreadline5-dev zlib1g-dev</pre></div></div>

<p>Vamos instalar o checkinstall, para que possamos compilar e gerar um .deb e ter um maior controle sobre o que é instalado</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">aptitude</span> <span style="color: #c20cb9; font-weight: bold;">install</span> checkinstall</pre></div></div>

<p>Agora vamos puxar o código fonte do Ruby</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> <span style="color: #c20cb9; font-weight: bold;">ftp</span>:<span style="color: #000000; font-weight: bold;">//</span>ftp.ruby-lang.org<span style="color: #000000; font-weight: bold;">/</span>pub<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span><span style="color: #000000; font-weight: bold;">/</span>ruby-1.8.6-p287.tar.gz
<span style="color: #c20cb9; font-weight: bold;">tar</span> xvzf ruby-1.8.6-p287.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> ruby-1.8.6-p287</pre></div></div>

<p>Agora vamos seguir para o processo de compilação</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #660033;">--with-openssl-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--with-readline-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>usr <span style="color: #660033;">--with-zlib-dir</span>=<span style="color: #000000; font-weight: bold;">/</span>usr
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> checkinstall</pre></div></div>

<p>Para testar se tudo ficou ok:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby <span style="color: #660033;">-ropenssl</span> <span style="color: #660033;">-rzlib</span> <span style="color: #660033;">-rreadline</span> <span style="color: #660033;">-e</span> <span style="color: #ff0000;">&quot;puts :success&quot;</span></pre></div></div>

<p>Criando os links simbólicos</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby</pre></div></div>

<p>Um problema que eu tive, foi com a instalação anterior do RubyGem, que apresentava o seguinte erro:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> gem <span style="color: #660033;">-v</span>
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem:<span style="color: #000000;">8</span>:<span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span>require<span style="color: #ff0000;">': no such file to load -- rubygems (LoadError)
	from /usr/bin/gem:8</span></pre></div></div>

<p>Isso aconteceu, pois a instalação do Ruby e dos Gems mudaram de local.<br />
Para resolver, re-instalamos o gem na nova pasta do Ruby.</p>
<p>A pasta anterior do Ruby era:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">whereis</span> ruby
ruby: <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby1.8 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>man<span style="color: #000000; font-weight: bold;">/</span>man1<span style="color: #000000; font-weight: bold;">/</span>ruby.1.gz</pre></div></div>

<p>E agora mudou para:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">whereis</span> ruby
ruby: <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby1.8 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby</pre></div></div>

<p>Isso aconteceu, pois mudamos o diretório de instalação de &#8220;/usr/&#8221; para &#8220;/usr/local/&#8221; no momento do configure (configure &#8211;prefix=/usr/local)</p>
<p>Para re-instalar o gem:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>rubyforge.org<span style="color: #000000; font-weight: bold;">/</span>frs<span style="color: #000000; font-weight: bold;">/</span>download.php<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">45905</span><span style="color: #000000; font-weight: bold;">/</span>rubygems-1.3.1.tgz
<span style="color: #c20cb9; font-weight: bold;">tar</span> xvzf rubygems-1.3.1.tgz
<span style="color: #7a0874; font-weight: bold;">cd</span> rubygems-1.3.1<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> ruby setup.rb
&nbsp;
gem1.8 <span style="color: #660033;">-v</span>
1.3.1</pre></div></div>

<p>O gem tambem mudou do lugar:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">whereis</span> gem
gem: <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem1.8</pre></div></div>

<p>Para:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">whereis</span> gem
gem: <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem1.8 <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem</pre></div></div>

<p>Com a mudança de diretório do gem, perdemos todas as gems que haviam instaladas.<br />
As gems anteriores, podem ser listadas com o seguinte comando:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span><span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<p>Aprendi boa parte disso nos seguintes sites:</p>
<ul>
<li><a href="http://blog.fiveruns.com/2008/3/3/compiling-ruby-rubygems-and-rails-on-ubuntu">Compiling Ruby, RubyGems and Rails on Ubuntu</a></li>
<li><a href="http://blog.ramonsoares.com/2008/01/02/ubuntu-ruby-rails-sqlite-mongrel.html">Ubuntu + Ruby + Rails + Sqlite + Mongrel</a></li>
</ul>
<p>Ps. Esse post é valido apenas para o Ruby 1.8.6 e 1.8.7</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gustavocaixeta.com/2009/03/compilando-ruby-na-mao/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Instalando o Ruby 1.8.6 no Intrepid Ibex via Downgrade</title>
		<link>http://www.gustavocaixeta.com/2009/03/instalando-o-ruby-186-no-intrepid-ibex-via-downgrade/</link>
		<comments>http://www.gustavocaixeta.com/2009/03/instalando-o-ruby-186-no-intrepid-ibex-via-downgrade/#comments</comments>
		<pubDate>Sun, 22 Mar 2009 01:30:35 +0000</pubDate>
		<dc:creator>Gustavo Caixeta</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[compilacao]]></category>
		<category><![CDATA[xubuntu]]></category>

		<guid isPermaLink="false">http://www.gustavocaixeta.com/?p=99</guid>
		<description><![CDATA[Assim que criei meu tutorial de instalação do Ruby e Rails no Ubuntu Intrepid Ibex (8.10), o Guilherme fez um comentário sobre os problemas que haviam do Ruby 1.8.7 no Ubuntu 8.10 em relação a versões antigas do Rails (anteriores ao 2.1).
Mas parece que mudaram a página do Rails   falando que o 1.8.7 [...]]]></description>
			<content:encoded><![CDATA[<p>Assim que criei meu tutorial de instalação do Ruby e Rails no Ubuntu Intrepid Ibex (8.10), o <a href="http://www.tatri.com.br/">Guilherme</a> fez<a href="http://www.gustavocaixeta.com/2008/11/instalando-ruby-e-rails-no-ubuntu-810-intrepid-ibex/comment-page-1/#comment-17"> um comentário</a> sobre <a href="http://www.rubyonrails.org/down">os problemas que haviam do Ruby 1.8.7</a> no Ubuntu 8.10 em relação a versões antigas do Rails (anteriores ao 2.1).</p>
<p>Mas parece que mudaram a página do Rails <img src='http://www.gustavocaixeta.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  falando que o 1.8.7 já funciona perfeitamente ehehe.<br />
<span id="more-99"></span><br />
Um exemplo clássico disso, era uns problemas com meu primeiro projeto em Rails (O lamina foi feito no Rails 1.2.6).</p>
<p>Basicamente o procedimento é o seguinte:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>sources.list <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>sources.list_backup</pre></div></div>

<p>Depois iremos criar o arquivo /etc/apt/preferences</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">touch</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>preferences
<span style="color: #c20cb9; font-weight: bold;">sudo</span> gedit <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>preferences</pre></div></div>

<p>E insira o seguinte conteudo nele:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Package: ruby
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: ruby1.8
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: libruby1.8
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: rdoc1.8
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: ri1.8
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: libgtk2-ruby1.8
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: libdbd-sqlite3-ruby1.8
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: libopenssl-ruby1.8
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: libsqlite3-ruby1.8
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: ruby1.8-dev
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: libdbi-ruby1.8
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: libatk1-ruby1.8
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: libpango1-ruby1.8
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: libatk1-ruby1.8
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: libgdk-pixbuf2-ruby1.8
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: libglib2-ruby1.8
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: libcairo-ruby1.8
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: irb1.8
Pin: release a=hardy
Pin-Priority: 900
&nbsp;
Package: libreadline-ruby1.8
Pin: release a=hardy
Pin-Priority: 900</pre></div></div>

<p>Agore iremos criar uma cópia das fontes, porem substituindo &#8220;intrepid&#8221; por &#8220;hardy&#8221;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gedit <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apt<span style="color: #000000; font-weight: bold;">/</span>sources.list</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">deb http://archive.ubuntu.com/ubuntu/ hardy main restricted
deb-src http://archive.ubuntu.com/ubuntu/ hardy main restricted
&nbsp;
deb http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted
deb-src http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted
&nbsp;
deb http://archive.ubuntu.com/ubuntu/ hardy universe
deb-src http://archive.ubuntu.com/ubuntu/ hardy universe
deb http://archive.ubuntu.com/ubuntu/ hardy-updates universe
deb-src http://archive.ubuntu.com/ubuntu/ hardy-updates universe
&nbsp;
deb http://archive.ubuntu.com/ubuntu/ hardy multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-updates multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy-updates multiverse
&nbsp;
deb http://archive.ubuntu.com/ubuntu/ hardy-security main restricted
deb-src http://archive.ubuntu.com/ubuntu/ hardy-security main restricted
deb http://archive.ubuntu.com/ubuntu/ hardy-security universe
deb-src http://archive.ubuntu.com/ubuntu/ hardy-security universe
deb http://archive.ubuntu.com/ubuntu/ hardy-security multiverse
deb-src http://archive.ubuntu.com/ubuntu/ hardy-security multiverse</pre></div></div>

<p>Depois de Inserir uma cópia das fontes do hardy no seu arquivo sources.list</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> update</pre></div></div>

<p>Para pegar a lista de pacotes disponivel para o hardy.</p>
<p>Depois disso, iremos remover o Ruby.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> remove ruby ruby1.8 rdoc ri irb libopenssl-ruby ruby-dev libopenssl-ruby1.8 libreadline-ruby1.8 libruby1.8 ruby1.8-dev</pre></div></div>

<p>E depois re-instalar ele</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ruby ruby1.8 rdoc ri irb libopenssl-ruby ruby-dev <span style="color: #660033;">-V</span></pre></div></div>

<p>Agora o resultado da versão do Ruby deve mudar</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">gustavo<span style="color: #000000; font-weight: bold;">@</span>gustavo-mv:~$ ruby <span style="color: #660033;">-v</span>
ruby 1.8.7 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2008</span>-08-<span style="color: #000000;">11</span> patchlevel <span style="color: #000000;">72</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>i486-linux<span style="color: #7a0874; font-weight: bold;">&#93;</span>
&nbsp;
gustavo<span style="color: #000000; font-weight: bold;">@</span>gustavo-mv:~$ ruby <span style="color: #660033;">-v</span>
ruby 1.8.6 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2007</span>-09-<span style="color: #000000;">24</span> patchlevel <span style="color: #000000;">111</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>i486-linux<span style="color: #7a0874; font-weight: bold;">&#93;</span></pre></div></div>

<p>Acho que isso já deixa tudo 100%. Tenho só umas duvidas em relação aos Ruby Gems já instalados.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gustavocaixeta.com/2009/03/instalando-o-ruby-186-no-intrepid-ibex-via-downgrade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Instalando Ruby e Rails no Ubuntu 8.10 &#8211; Intrepid Ibex</title>
		<link>http://www.gustavocaixeta.com/2008/11/instalando-ruby-e-rails-no-ubuntu-810-intrepid-ibex/</link>
		<comments>http://www.gustavocaixeta.com/2008/11/instalando-ruby-e-rails-no-ubuntu-810-intrepid-ibex/#comments</comments>
		<pubDate>Thu, 06 Nov 2008 00:11:02 +0000</pubDate>
		<dc:creator>Gustavo Caixeta</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[8.10]]></category>
		<category><![CDATA[intrepid ibex]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.gustavocaixeta.com/?p=36</guid>
		<description><![CDATA[Está com pressa? Vá direto para o resumo!
Para trabalhar com Ruby e Rails é necessário instalar alguns pacotes.
Primeiro:

sudo apt-get install ruby rdoc ri irb

Descrição dos pacotes instalados via man:
ruby &#8211; Interpreted object-oriented scripting language
rdoc1.8 &#8211; Generate documentation from Ruby script files
ri1.8 &#8211; Ruby Information at your fingertips
irb1.8 &#8211; interactive ruby

ruby -v
ruby 1.8.7 &#40;2008-08-11 patchlevel 72&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>Está com pressa? <a href="#resumo">Vá direto para o resumo</a>!</p>
<p>Para trabalhar com Ruby e Rails é necessário instalar alguns pacotes.</p>
<p>Primeiro:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ruby rdoc ri irb</pre></div></div>

<p>Descrição dos pacotes instalados via man:<br />
ruby &#8211; Interpreted object-oriented scripting language<br />
rdoc1.8 &#8211; Generate documentation from Ruby script files<br />
ri1.8 &#8211; Ruby Information at your fingertips<br />
irb1.8 &#8211; interactive ruby</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ruby <span style="color: #660033;">-v</span>
ruby 1.8.7 <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2008</span>-08-<span style="color: #000000;">11</span> patchlevel <span style="color: #000000;">72</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span>i486-linux<span style="color: #7a0874; font-weight: bold;">&#93;</span>
irb <span style="color: #660033;">-v</span>
irb 0.9.5<span style="color: #7a0874; font-weight: bold;">&#40;</span>05<span style="color: #000000; font-weight: bold;">/</span>04<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">13</span><span style="color: #7a0874; font-weight: bold;">&#41;</span></pre></div></div>

<p>Agora vou até o site do <a href="http://rubyforge.org/projects/rubygems/">RubyGem no RubyForge</a> <a href="http://rubyforge.org/frs/?group_id=126">baixar a ultima versão</a> do mesmo.<br />
Instalar o pacote RubyGem do Ubuntu nem sempre é uma boa idéia&#8230;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>rubyforge.org<span style="color: #000000; font-weight: bold;">/</span>frs<span style="color: #000000; font-weight: bold;">/</span>download.php<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">45905</span><span style="color: #000000; font-weight: bold;">/</span>rubygems-1.3.1.tgz
<span style="color: #c20cb9; font-weight: bold;">tar</span> xvzf rubygems-1.3.1.tgz
<span style="color: #7a0874; font-weight: bold;">cd</span> rubygems-1.3.1<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> ruby setup.rb
&nbsp;
gem1.8 <span style="color: #660033;">-v</span>
1.3.1</pre></div></div>

<p>Vamos criar um link simbólico para o comando gem</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem1.8  <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem</pre></div></div>

<p>Este link simbólico é para que quando você digitar o comando &#8220;gem&#8221; ele chame o &#8220;gem1.8&#8243;</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-l</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">grep</span> gem
gem - <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem1.8
gem1.8</pre></div></div>

<p>Beleza, ruby instalado, gem instalado, agora vamos tentar instalar o Rails.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> rails
&nbsp;
rails <span style="color: #660033;">-v</span>
Rails 2.1.2</pre></div></div>

<p>Agora vamos testar se o Rails está funcionando corretamente (se não falta alguma coisa a ser instalada).<br />
Vamos criar um projeto novo.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rails Teste
<span style="color: #7a0874; font-weight: bold;">cd</span> Teste<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
script<span style="color: #000000; font-weight: bold;">/</span>generate scaffold User nome:string idade:integer</pre></div></div>

<p><span style="color: #ff0000;">Ops</span>, o primeiro problema, esqueci de instalar o ssl do ruby.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span><span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>rails-2.1.2<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>initializer.rb:<span style="color: #000000;">229</span>:<span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span>require_frameworks<span style="color: #ff0000;">': no such file to load -- openssl (RuntimeError)
	from /usr/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/initializer.rb:118:in `process'</span>
	from <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span><span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>rails-2.1.2<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>initializer.rb:<span style="color: #000000;">97</span>:<span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span>send<span style="color: #ff0000;">'
	from /usr/lib/ruby/gems/1.8/gems/rails-2.1.2/lib/initializer.rb:97:in `run'</span>
	from <span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>gcaixeta<span style="color: #000000; font-weight: bold;">/</span>Projetos<span style="color: #000000; font-weight: bold;">/</span>Teste<span style="color: #000000; font-weight: bold;">/</span>config<span style="color: #000000; font-weight: bold;">/</span>environment.rb:<span style="color: #000000;">13</span>
	from <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>site_ruby<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span><span style="color: #000000; font-weight: bold;">/</span>rubygems<span style="color: #000000; font-weight: bold;">/</span>custom_require.rb:<span style="color: #000000;">31</span>:<span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span>gem_original_require<span style="color: #ff0000;">'
	from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'</span>
	from <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>ruby<span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span><span style="color: #000000; font-weight: bold;">/</span>gems<span style="color: #000000; font-weight: bold;">/</span>rails-2.1.2<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>commands<span style="color: #000000; font-weight: bold;">/</span>generate.rb:<span style="color: #000000;">1</span>
	from <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>local<span style="color: #000000; font-weight: bold;">/</span>lib<span style="color: #000000; font-weight: bold;">/</span>site_ruby<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">1.8</span><span style="color: #000000; font-weight: bold;">/</span>rubygems<span style="color: #000000; font-weight: bold;">/</span>custom_require.rb:<span style="color: #000000;">31</span>:<span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span>gem_original_require<span style="color: #ff0000;">'
	from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'</span>
	from script<span style="color: #000000; font-weight: bold;">/</span>generate:<span style="color: #000000;">3</span></pre></div></div>

<p>Vamos instalalo via apt-get</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libopenssl-ruby</pre></div></div>

<p>Novamente vamos tentar gerar o scaffold de exemplo.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">script<span style="color: #000000; font-weight: bold;">/</span>generate scaffold User nome:string idade:integer</pre></div></div>

<p>Agora vamos tentar rodar o migrate.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rake db:migrate</pre></div></div>

<p><span style="color: #ff0000;">ops</span>, esqueci de instalar o sqlite3</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rake aborted<span style="color: #000000; font-weight: bold;">!</span>
no such <span style="color: #c20cb9; font-weight: bold;">file</span> to load <span style="color: #660033;">--</span> sqlite3</pre></div></div>

<p>Vamos instalar primeiro o programa sqlite3</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite3</pre></div></div>

<p>Depois o gem</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite3-ruby</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
	ERROR: Failed to build gem native extension.</pre></div></div>

<p><span style="color: #ff0000;">Ops</span>, deu problema na instalação da gem. Ela precisa compilar extensões nativas em C, então tenho que ter instalado os compiladores básicos.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> build-essential</pre></div></div>

<p>novamente vamos tentar instalar o gem</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite3-ruby</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">ERROR:  Error installing sqlite3-ruby:
	ERROR: Failed to build gem native extension.
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby1.8 extconf.rb <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite3-ruby
extconf.rb:<span style="color: #000000;">1</span>:<span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span>require<span style="color: #ff0000;">': no such file to load -- mkmf (LoadError)
	from extconf.rb:1</span></pre></div></div>

<p><span style="color: #ff0000;">ops</span>, faltou instalar o pacote dev do ruby</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ruby-dev</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Building native extensions.  This could take a while...
ERROR:  Error installing sqlite3-ruby:
	ERROR: Failed to build gem native extension.
&nbsp;
<span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>ruby1.8 extconf.rb <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite3-ruby
checking <span style="color: #000000; font-weight: bold;">for</span> fdatasync<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #000000; font-weight: bold;">in</span> -lrt... <span style="color: #c20cb9; font-weight: bold;">yes</span>
checking <span style="color: #000000; font-weight: bold;">for</span> sqlite3.h... no</pre></div></div>

<p><span style="color: #ff0000;">ops</span>, faltou instalar o pacote de desenvolvimento do sqlite3</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libsqlite3-dev</pre></div></div>

<p>Novamente. vamos tentar instalar o gem do sqlite3</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> sqlite3-ruby</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">Building native extensions.  This could take a while...
Successfully installed sqlite3-ruby-1.2.4
<span style="color: #000000;">1</span> gem installed
Installing ri documentation <span style="color: #000000; font-weight: bold;">for</span> sqlite3-ruby-1.2.4...
Installing RDoc documentation <span style="color: #000000; font-weight: bold;">for</span> sqlite3-ruby-1.2.4...</pre></div></div>

<p><span style="color: #008000;">Finalmente!</span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rake db:migrate
script<span style="color: #000000; font-weight: bold;">/</span>server</pre></div></div>

<h2><a name="resumo">Resumo</a></h2>
<h3>Instalando o Básico</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ruby rdoc ri irb libopenssl-ruby sqlite3 build-essential ruby-dev libsqlite3-dev</pre></div></div>

<h3>Instalando o Ruby Gem</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>rubyforge.org<span style="color: #000000; font-weight: bold;">/</span>frs<span style="color: #000000; font-weight: bold;">/</span>download.php<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">45905</span><span style="color: #000000; font-weight: bold;">/</span>rubygems-1.3.1.tgz
<span style="color: #c20cb9; font-weight: bold;">tar</span> xvzf rubygems-1.3.1.tgz
<span style="color: #7a0874; font-weight: bold;">cd</span> rubygems-1.3.1<span style="color: #000000; font-weight: bold;">/</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> ruby setup.rb
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem1.8  <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>gem</pre></div></div>

<h3>Instalando as Gems</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> rails sqlite3-ruby</pre></div></div>

<h2>Instalando o mongrel</h2>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> mongrel</pre></div></div>

<h2>Instalando o suporte mysql</h2>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"> <span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> libmysqlclient15-dev
<span style="color: #c20cb9; font-weight: bold;">sudo</span> gem <span style="color: #c20cb9; font-weight: bold;">install</span> mysql</pre></div></div>

<p>Update1:<br />
Testei o tutorial da versão Hardy(8.04), a unica diferença é que não há um pacote chamado &#8220;ruby-dev&#8221;, ao invés deste, utilize o &#8220;ruby1.8-dev&#8221;</p>
<p>Update2:</p>
<p>Para testar tudo:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rails Teste
&nbsp;
<span style="color: #7a0874; font-weight: bold;">cd</span> Teste<span style="color: #000000; font-weight: bold;">/</span>
&nbsp;
script<span style="color: #000000; font-weight: bold;">/</span>generate scaffold User nome:string idade:integer
&nbsp;
rake db:migrate
&nbsp;
script<span style="color: #000000; font-weight: bold;">/</span>server
&nbsp;
http:<span style="color: #000000; font-weight: bold;">//</span>localhost:<span style="color: #000000;">3000</span><span style="color: #000000; font-weight: bold;">/</span><span style="color: #c20cb9; font-weight: bold;">users</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.gustavocaixeta.com/2008/11/instalando-ruby-e-rails-no-ubuntu-810-intrepid-ibex/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
	</channel>
</rss>
