<?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>Mauricio de Amorim &#187; RVM</title>
	<atom:link href="http://mauriciodeamorim.com.br/tag/rvm/feed/" rel="self" type="application/rss+xml" />
	<link>http://mauriciodeamorim.com.br</link>
	<description>Tecnologia e desenvolvimento web</description>
	<lastBuildDate>Tue, 21 Feb 2012 22:09:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Melhorando o prompt do bash para RVM</title>
		<link>http://mauriciodeamorim.com.br/2010/03/16/prompt-bash-para-rvm/</link>
		<comments>http://mauriciodeamorim.com.br/2010/03/16/prompt-bash-para-rvm/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 05:00:00 +0000</pubDate>
		<dc:creator>Mauricio de Amorim</dc:creator>
				<category><![CDATA[Dicas rápidas]]></category>
		<category><![CDATA[Ambientes]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[MacOS]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[RVM]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://mauriciodeamorim.com.br/?p=659</guid>
		<description><![CDATA[Esses dias configurei meus sistemas operacionais para usar RVM que serve para gerenciar diferentes instalações do Ruby na mesma máquina. Para instalar no Snow Leopard segui o tutorial do Akita &#8220;Limpando meu Ambiente de Desenvolvimento&#8221; e para instalar no Ubuntu segui o post do Barenko &#8220;Preparando o Ubuntu para múltiplos ambientes Ruby utilizando RVM&#8221; que [...]]]></description>
			<content:encoded><![CDATA[<p>Esses dias configurei meus sistemas operacionais para usar <a href="http://rvm.beginrescueend.com/" target="_blank">RVM</a> que serve para gerenciar diferentes instalações do Ruby na mesma máquina.</p>
<p>Para instalar no Snow Leopard segui o tutorial do Akita <a href="http://akitaonrails.com/2010/01/01/limpando-meu-ambiente-de-desenvolvimento" target="_blank">&#8220;Limpando meu Ambiente de Desenvolvimento&#8221;</a> e para instalar no Ubuntu segui o post do Barenko <a href="http://barenko.wordpress.com/2010/01/19/preparando-o-ubuntu-para-multiplos-ambientes-ruby-utilizando-rvm/" target="_blank">&#8220;Preparando o Ubuntu para múltiplos ambientes Ruby utilizando RVM&#8221;</a> que é mais ou menos uma &#8220;tradução&#8221; do post do Akita para Ubuntu. Deixei tudo igual com exceção da linha onde tem <strong>&#8220;/var/lib/gems/1.8/bin/rvm-install&#8221;</strong> que alterei para </p>
<pre>
~/rvm-install
</pre>
<p>Porém como eu uso <a href="http://github.com/guides/home" target="_blank">Git</a> uma coisa que estava me incomodando é que o prompt do <a href="https://help.ubuntu.com/community/Beginners/BashScripting" target="_blank">Bash</a> em ambos SO não estavam adequados para mostrar a versão da RVM e o branch atual do Git ao mesmo tempo, então fiz algumas e alterações e encontrei algumas &#8220;frescuras a mais&#8221; para personalizar o prompt.<br />
Substitua a linha que começa com &#8220;expost PS1=&#8217;&#8230;.&#8221; no arquivo ~/.bashrc (Ubuntu) ou ~/.bash_profile (MacOS) para:</p>
<pre>
sudo gedit ~/.bashrc
</pre>
<pre style="background-color:white; color:black">
export PS1='\[\033[38m\]\u\[\033[32m\] \w \[\033[1;33m\]`~/.rvm/bin/rvm-prompt i v
`\[\033[0;31m\] `git branch 2> /dev/null | grep -e ^* | sed -E s/^\\\\\*\ \(.+\)$/\(\\\\\1\)\ /
`\[\033[37m\]$\[\033[00m\] '
</pre>
<p>Com isto o prompt ficará assim </p>
<pre style="background-color:black; color:white">
seu_usuario <span style="color: green">~/projetos/blog</span><span style="color: yellow; font-weight: bold"> ruby-ree </span><span style="color: red"> ( working ) </span>$
</pre>
<p>Segue uma tabela com as cores existentes, se você quiser deixar a fonte em negrito use 1; ao invés de 0;</p>
<pre style="background-color:black; color:white; width: 100px;">
<span style="color: green">"\033[0;32m"</span>
<span style="color: green; font-weight: bold">"\033[1;32m"</span>
</pre>
<p><strong>Cores</strong><br />
corPadrao=&#8221;\033[0m&#8221;<br />
preto=&#8221;\033[0;30m&#8221;<br />
vermelho=&#8221;\033[0;31m&#8221;<br />
verde=&#8221;\033[0;32m&#8221;<br />
marrom=&#8221;\033[0;33m&#8221;<br />
azul=&#8221;\033[0;34m&#8221;<br />
purple=&#8221;\033[0;35m&#8221;<br />
cyan=&#8221;\033[0;36m&#8221;<br />
cinzaClaro=&#8221;\033[0;37m&#8221;<br />
amarelo=&#8221;\033[0;33m&#8221;<br />
branco=&#8221;\033[1;37m&#8221;</p>
<p>Aproveitando que este post é sobre RVM, se alguém tiver dificuldades em rodar o script/console dentro de algum ambiente de RVM dá uma olhada neste <a href="http://www.ortiz.blog.br/dicas/problema-ao-executar-scriptconsole-com-rvm/" target="_blank">post</a> que tem uma solução para este problema.</p>
<p><strong>Referências:</strong><br />
<a href="http://akitaonrails.com/2010/01/01/limpando-meu-ambiente-de-desenvolvimento" target="_blank">Limpando meu Ambiente de Desenvolvimento</a><br />
<a href="http://barenko.wordpress.com/2010/01/19/preparando-o-ubuntu-para-multiplos-ambientes-ruby-utilizando-rvm/" target="_blank">Preparando o Ubuntu para múltiplos ambientes ruby utilizando RVM</a><br />
<a href="http://ubuntuforums.org/archive/index.php/t-31247.html" target="_blank">http://ubuntuforums.org/archive/index.php/t-31247.html</a><br />
<a href="http://www.vivaolinux.com.br/dica/Shell-script-com-texto-colorido" target="_blank">http://www.vivaolinux.com.br/dica/Shell-script-com-texto-colorido</a></p>
]]></content:encoded>
			<wfw:commentRss>http://mauriciodeamorim.com.br/2010/03/16/prompt-bash-para-rvm/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

