<?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>niczsoft</title>
	<atom:link href="http://niczsoft.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://niczsoft.com</link>
	<description>{ [:consulting, :programing] =&#62; [:ruby, :rails, :linux] }</description>
	<lastBuildDate>Sun, 13 May 2012 02:19:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>rubygems-bundler integration gem reaches 1.0.0</title>
		<link>http://niczsoft.com/2012/05/rubygems-bundler-integration-gem-1-0-0/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rubygems-bundler-integration-gem-1-0-0</link>
		<comments>http://niczsoft.com/2012/05/rubygems-bundler-integration-gem-1-0-0/#comments</comments>
		<pubDate>Wed, 09 May 2012 22:58:23 +0000</pubDate>
		<dc:creator>Michal Papis</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[bundle exec]]></category>
		<category><![CDATA[bundler]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubygems]]></category>

		<guid isPermaLink="false">http://niczsoft.com/?p=500</guid>
		<description><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 30px 0;"><div style="position: absolute; bottom: 10px; right:115px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://niczsoft.com/2012/05/rubygems-bundler-integration-gem-1-0-0/';
var dzone_title = 'rubygems-bundler integration gem reaches 1.0.0';
var dzone_blurb = '';
var dzone_style = '2';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>
No more &#8220;bundle exec &#8230;&#8221; I want to present the testing release of my gem rubygems-bundler 1.0.0 &#8211; integration for rubygems and bundler. Recently I was motivated to get back to it, actually I got back to it twice. The first time thanks to Joshua Hull and his great effort on noexec gem, this gem [...]]]></description>
			<content:encoded><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 30px 0;"><div style="position: absolute; bottom: 10px; right:115px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://niczsoft.com/2012/05/rubygems-bundler-integration-gem-1-0-0/';
var dzone_title = 'rubygems-bundler integration gem reaches 1.0.0';
var dzone_blurb = '';
var dzone_style = '2';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>

<h1>No more &#8220;bundle exec &#8230;&#8221;</h1>
<p>I want to present the testing release of my gem <strong>rubygems-bundler 1.0.0</strong> &#8211; integration for rubygems and bundler. Recently I was motivated to get back to it, actually I got back to it twice.</p>
<p>The first time thanks to <a href="https://github.com/joshbuddy">Joshua Hull</a> and his great effort on <a href="https://github.com/joshbuddy/noexec">noexec gem</a>, this gem was merged in to <code>rubygems-bundler</code> in version <code>0.9.0</code> &#8211; this was a great improvement, providing automatic detection if the gem should be loaded using <code>Bundler.setup</code> or not.</p>
<p>The second time was thanks to discussions with <a href="https://github.com/evanphx">Evan Phoenix</a> and <a href="https://github.com/wycats">Yehuda Katz</a>. Evan motivated me to remove the installation of the wrapper via extensions, which was a hack. Yehuda gave me good ideas on handling the wrapper and automating things, so modification of <code>~/.gemrc</code> is not needed anymore.</p>
<p>So, <a href="https://github.com/mpapis/rubygems-bundler">rubygems-bundler</a> is now at version <code>1.0.0.beta5</code>, and should be available, officially, as <code>1.0.0</code> very shortly.</p>
<h2>Features</h2>
<ul>
<li>Automatically uses <code>custom_shebang</code> when not specified by user in <code>~/.gemrc</code>.</li>
<li>Automatically installs wrapper when not available during <code>gem install ...</code> or <code>gem regenerate_binstubs</code></li>
<li>Backports <code>custom_shebang</code> from rubygems 2.0(master) to any rubygems down to 1.3.7.</li>
<li>Adds the command <code>gem regenerate_binstubs</code> which allows regeneration of binstubs for existing gems. It does not, however, regenerate extensions.</li>
<li>Adds an uninstaller <code>rubygems-bundler-uninstaller</code> which will restore binstubs for gems to use the safer <code>#!/usr/bin/env ruby</code>, and remove the existing wrapper.</li>
</ul>
<h2>Installation / Testing</h2>
<pre><code>gem install rubygems-bundler --pre
</code></pre>
<p>You might get warnings to uninstall, this is needed to prevent collisions with the rubygems plugin in older versions.</p>
<h2>What&#8217;s the future of this gem?</h2>
<p>Yehuda and I discussed it, and we have agreed to merge it into bundler, as it&#8217;s the most user friendly solution that could be done. We will be working hard to integrate it into <strong>bundler 1.3</strong> (1.2 is in testing now).</p>
<p>Some parts of this gem will be made obsolete with the release of <strong>rubygems 2.0</strong>: <code>custom_shebang</code> &#8211; already implemented and <code>gem regenerate_binstubs</code> &#8211; will be part of <code>gem pristine</code> (<a href="https://github.com/rubygems/rubygems/issues/326">#326</a>).</p>
<p>Unfortunately it is to late to merge <code>custom shebang</code> back to <strong>rubygems 1.8</strong> (<a href="https://github.com/rubygems/rubygems/issues/325">#325</a>).</p>
<p>My dream is that we will no longer have to create third-party tools (like my gem) and the integration will be fully done between <strong>rubygems 2.0</strong> and <strong>bundler 1.3</strong>.</p>
<p>But, even then, you can still use my gem if you require lower versions of rubygems or bundler.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://niczsoft.com/2012/05/rubygems-bundler-integration-gem-1-0-0/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Fast deployment using Capistrano, RVM and more</title>
		<link>http://niczsoft.com/2012/03/fast-deployment-using-capistrano-rvm-and-more/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fast-deployment-using-capistrano-rvm-and-more</link>
		<comments>http://niczsoft.com/2012/03/fast-deployment-using-capistrano-rvm-and-more/#comments</comments>
		<pubDate>Tue, 20 Mar 2012 22:32:59 +0000</pubDate>
		<dc:creator>Michal Papis</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Hosting]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[asset pipeline]]></category>
		<category><![CDATA[bundler]]></category>
		<category><![CDATA[capistrano]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rvm]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://niczsoft.com/?p=490</guid>
		<description><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 30px 0;"><div style="position: absolute; bottom: 10px; right:115px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://niczsoft.com/2012/03/fast-deployment-using-capistrano-rvm-and-more/';
var dzone_title = 'Fast deployment using Capistrano, RVM and more';
var dzone_blurb = '';
var dzone_style = '2';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>
There is so much confusion around deploying applications using RVM, I went down and verified. The process was quite straight forward, but I found few points that could be improved. So all my experiments were done using fresh rails app with one model, you can find sources here: https://github.com/mpapis/ad My goal was to be able [...]]]></description>
			<content:encoded><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 30px 0;"><div style="position: absolute; bottom: 10px; right:115px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://niczsoft.com/2012/03/fast-deployment-using-capistrano-rvm-and-more/';
var dzone_title = 'Fast deployment using Capistrano, RVM and more';
var dzone_blurb = '';
var dzone_style = '2';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>

<p>There is so much confusion around deploying applications using RVM, I went down and verified. The process was quite straight forward, but I found few points that could be improved.</p>
<p>So all my experiments were done using fresh rails app with one model, you can find sources here: <a href="https://github.com/mpapis/ad">https://github.com/mpapis/ad</a></p>
<p>My goal was to be able to install rails app on server without complicated recipes and doing much on server.</p>
<p>So the boring part first, setup server:</p>
<ol>
<li>I&#8217;m assuming your domain (DNS) is configured and points to the server</li>
<li>I&#8217;m assuming you have nginx up and running, most distributions have own instructions for it, but the process should be rather easy like <code>apt-get install nginx</code></li>
<li>To keep good security levels we assume one user is created per application, I used this command <code>useradd --comment "AD - Example Rails App" -s /bin/bash -m -U ad</code> but you might need other command depending on the system, do not forget to generate and exchange SSH keys</li>
<li>Then I had to create nginx configuration for my site <code>/etc/nginx/sites-available/ad.niczsoft.com</code><code> the code bellow</code></li>
<li>And finally link the configuration&gt;<code>ln -s /etc/nginx/sites-available/ad.niczsoft.com /etc/nginx/sites-enabled/ad.niczsoft.com</code>, do not forget to restart nginx</li>
</ol>
<pre class="brush: ruby">
server {
  listen 80;
  server_name ad.niczsoft.com;
  access_log /var/log/nginx/ad.niczsoft.com.access.log;
  error_log /var/log/nginx/ad.niczsoft.com.error.log;
  location / {
    proxy_pass http://unix:/home/ad/app/shared/pids/unicorn.socket;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $http_host;
    # this is required for HTTPS (another server section):
    # proxy_set_header X-Forwarded-Proto https;
  }
}
</pre>
<p>Server is at this point ready and trying to proxy incoming connections to our application. As mentioned above I have minimal rails application, so locally I have installed capistrano and generated basic setup with <code>capify .</code> and replaced <code>config/deploy.rb</code> with this <a href="https://github.com/mpapis/ad/blob/master/config/deploy.rb">https://github.com/mpapis/ad/blob/master/config/deploy.rb</a></p>
<p>We need also few gems to be added to Gemfile and then <code>bundle install</code>ed:</p>
<pre class="brush: ruby">
group :development do
  gem &#039;capistrano&#039;
  gem &#039;capistrano-unicorn&#039;
  gem &#039;capistrano-file_db&#039;
end
</pre>
<p>but feel free to check the whole file: <a href="https://github.com/mpapis/ad/blob/master/Gemfile">https://github.com/mpapis/ad/blob/master/Gemfile</a></p>
<p>On the list is one new gem I have created to simplify deployments <a href="https://github.com/mpapis/capistrano-file_db">capistrano-file_db</a>. It&#8217;s minimalistic gem to support deployment of file based databases (defaults to sqlite3).</p>
<p>I have reused also existing gem <a href="https://github.com/sosedoff/capistrano-unicorn">capistrano-unicorn</a> &#8211; this one was not so straight and needed minimal hacking, but I was able to get it running in few minutes, I will be fixing the problems I found shortly, hopefully my changes get merged to master soon.</p>
<p>Lets go through the <code>config/deploy.rb</code>, the first section is pretty standard and reflects most of the configuration we did for server:</p>
<pre class="brush: ruby">
set :application, &quot;ad&quot;

set :deploy_to, &quot;/home/#{application}/app&quot;
set :user, &quot;#{application}&quot;
set :use_sudo, false
set :scm, :git
set :repository, &quot;git://github.com/mpapis/ad.git&quot;
</pre>
<p>The fun starts later, first we set ruby version to our current local selected ruby.</p>
<pre class="brush: ruby">
set :rvm_ruby_string, ENV[&#039;GEM_HOME&#039;].gsub(/.*\//,&quot;&quot;)
</pre>
<p>Next we tell rvm to check for remote installation in user home &#8211; as by default it checks system installation.</p>
<pre class="brush: ruby">
set :rvm_type, :user
</pre>
<p>Here we instruct rvm to install head version remotely, this line can get removed after 1.11.0 gets out, it will be defaulting back to stable. </p>
<pre class="brush: ruby">
set :rvm_install_type, :head # before rvm 1.11.0 gets released
</pre>
<p>We tell bundler to omit development dependencies, which of course are our capistrano libraries.</p>
<pre class="brush: ruby">
set :bundle_without, [:development]
</pre>
<p>And finally we instruct unicorn plugin about the proper pid path, unfortunately it was not the only place we needed to setup it, check https://github.com/mpapis/ad/blob/master/config/unicorn/production.rb for more details:</p>
<pre class="brush: ruby">
set :unicorn_pid, &quot;#{shared_path}/pids/unicorn.pid&quot;
</pre>
<p>That&#8217;s almost it, now lets tell capistrano where the deploy, and to always do migrations:</p>
<pre class="brush: ruby">
server &quot;niczsoft.com&quot;, :app, :web, :db, :primary =&gt; true

before &#039;deploy:restart&#039;, &#039;deploy:migrate&#039;
</pre>
<p>This two steps are important, they tell capistrano to install rvm and ruby on server, it will also create application gemset if used, it will use <code>rvm_ruby_string</code>, so make sure to set it to something useful like <code>`rvm current`</code>: </p>
<pre class="brush: ruby">
before &#039;deploy:setup&#039;, &#039;rvm:install_rvm&#039;
before &#039;deploy:setup&#039;, &#039;rvm:install_ruby&#039;
</pre>
<p>And on the end all the capistrano plugins we want to use:</p>
<pre class="brush: ruby">
$:.unshift(File.expand_path(&#039;./lib&#039;, ENV[&#039;rvm_path&#039;]))
require &quot;rvm/capistrano&quot;
require &quot;bundler/capistrano&quot;
require &quot;capistrano-unicorn&quot;
require &quot;capistrano-file_db&quot;
load &#039;deploy/assets&#039;
</pre>
<p>For the <code>deploy/assets</code> to work we have <code>gem 'therubyracer'</code> in Gemfile.</p>
<p>That&#8217;s all, let deploy our application, first prepare server</p>
<pre class="brush: ruby">
cap deploy:setup &amp;amp;amp;amp;&amp;amp;amp;amp; cap deploy:cold
</pre>
<p>this will take some time so grab a tee/coffee.</p>
<p>After server is prepared we can deploy application after every commit to repository:</p>
<pre class="brush: ruby">
cap deploy
</pre>
<p>And it&#8217;s thue end of the journey, it takes a lot longer to write this tuttorial then to just do the deployment, doing it second time try to fit in 10 minutes !</p>
<p>You can get more details on RVM / Capistrano integration in the freshly updated documentation page: <a href="http://beginrescueend.com/integration/capistrano/">http://beginrescueend.com/integration/capistrano/</a> also worth reading is the new project files not requiring trusting: <a href="http://beginrescueend.com/workflow/projects/#ruby-versions">http://beginrescueend.com/workflow/projects/#ruby-versions</a></p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://niczsoft.com/2012/03/fast-deployment-using-capistrano-rvm-and-more/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>what you should know about rbenv and RVM</title>
		<link>http://niczsoft.com/2011/11/what-you-should-know-about-rbenv-and-rvm/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=what-you-should-know-about-rbenv-and-rvm</link>
		<comments>http://niczsoft.com/2011/11/what-you-should-know-about-rbenv-and-rvm/#comments</comments>
		<pubDate>Tue, 01 Nov 2011 22:12:04 +0000</pubDate>
		<dc:creator>Michal Papis</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[bundler]]></category>
		<category><![CDATA[conventions]]></category>
		<category><![CDATA[rbenv]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[rubygems]]></category>
		<category><![CDATA[rvm]]></category>

		<guid isPermaLink="false">http://niczsoft.com/?p=480</guid>
		<description><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 30px 0;"><div style="position: absolute; bottom: 10px; right:115px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://niczsoft.com/2011/11/what-you-should-know-about-rbenv-and-rvm/';
var dzone_title = 'what you should know about rbenv and RVM';
var dzone_blurb = '';
var dzone_style = '2';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>
By now you have most likely heard of RVM and rbenv. (There is no mistake in writing one in uppercase and second in lowercase, I’m just following conventions given by their respective authors.) As a contributor in the RVM Project I thought I could find out what really rbenv does. Reading the sources gave me [...]]]></description>
			<content:encoded><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 30px 0;"><div style="position: absolute; bottom: 10px; right:115px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://niczsoft.com/2011/11/what-you-should-know-about-rbenv-and-rvm/';
var dzone_title = 'what you should know about rbenv and RVM';
var dzone_blurb = '';
var dzone_style = '2';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>

<p>By now you have most likely heard of <a title="The awesome Ruby enVironment Manager" href="https://rvm.beginrescueend.com/" target="_blank">RVM</a> and <a href="https://github.com/sstephenson/rbenv" target="_blank">rbenv</a>. (There is no mistake in writing one in uppercase and second in lowercase, I’m just following conventions given by their respective authors.) As a contributor in the RVM Project I thought I could find out what really rbenv does. Reading the sources gave me some insights into rbenv &#8211; unfortunately there was no new shell trick to learn for me from rbenv. Still I could understand how it works and find differences between the two tools. Both claim, and do provide, a way to switch the currently active ruby.</p>
<p>The main difference between them is when the ruby is switched.</p>
<ul>
<li>For RVM, it’s during changing directories &#8211; the process is done once, and from now on the shell already has all ruby and gem binaries available. This can also be triggered manually.</li>
<li>For rbenv, all ruby and gem binaries are always available in shell but will load proper code only when in proper context &#8211; so switching is done each time any binary is executed.</li>
</ul>
<p>Going into more details: RVM will take about 60ms on every called cd, which means you would need to type over 16 cd commands to take a whole second &#8211; try to do that. During the directory change, RVM will set up environment variables to reflect your ruby and gemset selection allowing it to be separated from other rubies and gems, or binaries. You will not be able to run any other binary or gem available in another project, and any auto-loading mechanisms using plugins will not be able to load them from other project environment.</p>
<p>For rbenv, switching directories with cd takes no time (0ms) so it is faster by default for changing directories. After installing some gems, you need to rehash and it takes 60ms. Using ruby or switching to a project dir does not change the user’s environment almost at all, except for the RBENV_VERSION variable for current &#8211; but it does not mean the env is not set at all &#8211; it will be set internally every time ruby and any other ruby or gem binary is run &#8211; with a overhead of about 50ms for each invocation.</p>
<p>To explain in depth what rbenv does here is a quote I was originally going to put in here but I already posted the message on <a title="rbenv shims are bad" href="http://www.reddit.com/r/ruby/comments/lw6gv/rvm_vs_rbenv/c2w6osw" target="_blank">reddit</a>:</p>
<blockquote cite="http://www.reddit.com/r/ruby/comments/lw6gv/rvm_vs_rbenv/c2w6osw"><p>There is one big hole in shims approach &#8211; it makes all the gem and ruby binaries available in your shell &#8230; just not always functional.</p>
<p>Having something installed in one ruby (like haml) will make it shim available in all rubies &#8211; just not working.</p>
<p>Shim approach is working against the system &#8211; building another abstraction layer not respecting UNIX mechanisms &#8211; like PATH search &#8211; just fooling your system (and you).</p>
<p>It is not possible to run a shim/ruby without rbenv loaded &#8211; it s required to to make the environment working as expected &#8211; in contrary RVM by default builds environment files which sourced once make your system aware of the exact combination of ruby and gems you want to use.</p></blockquote>
<p>The environment is set and provided to the ran binary in both cases, only the burden of loading it is shifted, and it means:</p>
<ul>
<li>The loading place makes some difference. In RVM, you can check the state of the environment with ‘rvm info’. For rbenv, there are no changes &#8211; so there is nothing to check.</li>
<li>For RVM, only the selected ruby/gemset related binaries will be available in the shell. In rbenv, all binaries of all rubies and gems all always available in shell &#8211; only they will do nothing when called, it is not possible to check if binary exists in system as the checks always will hit the shim binary and report it as existing.</li>
<li>For those concerned about loading and execution time, you can not see the difference. It can be only measured. Anything that occurs at or below 300ms in a shell is imperceptible.</li>
</ul>
<p>Sam Stephenson provided a <a href="https://github.com/sstephenson/rbenv/blob/master/README.md">list</a> of points that make a difference between the tools, lets consider them:</p>
<ol>
<li><strong>Need to be loaded into your shell. Instead, rbenv&#8217;s shim approach works by adding a directory to your $PATH.</strong><br />
RVM also does not have to be loaded as a function. It allows operation by loading only the environment file, which is done only once and allows single and fast initialization of the current ruby and gemset. RVM also allows operation as a binary when all it’s functionalities are available (except changing environment other than setting default, which behaves identically to rbenv’s only means of operation).</li>
<li><strong>Override shell commands like cd. That&#8217;s dangerous and error-prone.</strong><br />
Overriding of cd is optional. I searchied for almost 8 hours collectively over the last month to find a project that overrides cd &#8211; guess what, I could not find one. There are few shell tricks that allow you to override cd, but as cd override is optional, you can do it in your own function merged with the tricks. As for error prone &#8211; I see no reports of errors about the cd function. Once it is done, nothing bad can happen. Additoinally RVM provides a security feature whereby you can view the code to be executed ahead of time upon cd and choose to trust it or not.</li>
<li><strong>Have a configuration file. There&#8217;s nothing to configure except which version of Ruby you want to use.</strong><br />
rbenv, at present, allows setting over 4 shell variables which influence the running process, there is no configuration file that could collect them &#8211; they have to be set in your shell rc files &#8211; for every shell you use.</li>
<li><strong>Install Ruby. You can build and install Ruby yourself, or use ruby-build to automate the process.</strong><br />
During it’s life RVM collected lots of knowledge how to manage and install rubies &#8211; including patches that make ruby work as expected on different environments. Also supporting fancy things like golf ruby &#8211; where original ruby binary is replaced with goruby binary. Why would you not want to capitalize on other’s experience?</li>
<li><strong>Manage gemsets. Bundler is a better way to manage application dependencies. If you have projects that are not yet using Bundler you can install the rbenv-gemset plugin.</strong><br />
Using gemsets is optional but encouraged as it helps in the separation process, some gems force use of bundler but this does not solve all the separation problems. And the pure existence of rbenv-gemsets proves how useful it is. Even bundler is not impervious to plethora of installed system level gems and their oddities of interaction.</li>
<li><strong>Require changes to Ruby libraries for compatibility. The simplicity of rbenv means as long as it&#8217;s in your $PATH, nothing else needs to know about it.</strong><br />
RVM does not require changes to any gems/libraries although it allows some additions that are meant to make life easier &#8211; like per project changing PATH for bundler generated binaries, or allowing set :rvm_ruby_string to specify a ruby version instead of setting PATH like rbenv requires. All those things are optional and not required for proper work neither of RVM or the tool concerned. Finally, separation of gemsets in RVM allows skipping calls to bundle exec &#8211; which in case of rbenv will be required (unless using my gem <a title="rubygems-bundler - no more bundle exec" href="https://github.com/mpapis/rubygems-bundler" target="_blank">rubygems-bundler</a> gem or other such tricks).</li>
<li><strong>Prompt you with warnings when you switch to a project. Instead of executing arbitrary code, rbenv reads just the version name from each project. There&#8217;s nothing to &#8220;trust.&#8221;</strong><br />
All the warnings appear only when users create the .rvmrc file manually, if it is created automatically with the &#8211;rvmrc flag then a lot less warnings are printed. rbenv actually prints a warning when switching to a project which wants to use ruby that is not installed. Trusting of .rvmrc files can be easily switched to not read them at all or to trust any .rvmrc file.</li>
</ol>
<p>Opposed to Sam Stephenson points above I would like to give my counterarguments for using rbenv:</p>
<ol>
<li><strong>Execution of any binary is 50ms slower as compared to binaries run in rvm &#8211; so if you are using many calls to ruby &#8211; this might get in your way of your performance.</strong></li>
<li><strong>Execution of any binary does not require proper ruby/gem to be available, it will silently fail without any warning if it is not available.</strong></li>
<li><strong>It is not possible to check if ruby or gem binary is available in the system, separate calls to gem, binaries or rbenv are required to find out if it is really available &#8211; which adds more work you have to do / worry about. With RVM you set environment &#8211; and LINUX conventions allow it to work as expected, with rbenv &#8211; the environment is faked with shims, you never know (by linux conventions) what will happen.</strong></li>
</ol>
<p>So summing up the tools are different but they allow developers to do almost exactly the same thing just with different approaches, knowing the differences could help developers chose the right tool for the right job.</p>
<p>Important point mentioned quite often when RVM and rbenv is compared is the size and complication of RVM. Where rbenv is a new tool, it is relatively small and its internals are less complex. rbenv uses the same approaches as RVM and is more readable if only by smaller code base which is due to the fact it is a far less mature piece of software and has far less experience accommodating different environments and platforms. It has not been extensively tested on most available operating systems. While RVM continues to press forward with new features on a solid software foundation, rbenv will continue to grow and progress but will continue to ride RVM&#8217;s coattails. It&#8217;s simple to take an existing piece of open source software and apply hindsight to create a more slim, less feature packed and less tested piece of software. We wish to see rbenv grow and expand into a great piece of software that provides a different solution to ruby environment management so both projects may learn from one another.</p>
<p>There is one additional thing that Is available for RVM which you will not find for rbenv &#8211; <a title="The Official OS X RVM GUI" href="http://unfiniti.com/software/mac/jewelrybox" target="_blank">Jewelery Box</a> &#8211; the official OS X RVM GUI. As rbenv claims to be minimalistic tool it does not seam to need any GUI &#8211; but as popularity of JB shows there is a need for such tool.</p>
<p>In closing, I would like to mention that we know that RVM grow big and could use some refactoring to make it easier to hack on it and to make the code base more readable and maintainable &#8211; we are working on that by planning RVM2 as an SM extension &#8211; <a title="Scripting, System, Stack Management (SM) Framework" href="https://github.com/sm" target="_blank">SM</a> is another project from <a title="Wayne E. Seguin" href="https://github.com/wayneeseguin" target="_blank">Wayne E. Seguin</a> worth checking and big enough to cover few articles. We hear our users loud and clear and have big plans for the future of RVM.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://niczsoft.com/2011/11/what-you-should-know-about-rbenv-and-rvm/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
		</item>
		<item>
		<title>no more bundle exec</title>
		<link>http://niczsoft.com/2011/10/no-more-bundle-exec/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=no-more-bundle-exec</link>
		<comments>http://niczsoft.com/2011/10/no-more-bundle-exec/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 14:46:52 +0000</pubDate>
		<dc:creator>Michal Papis</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bundle]]></category>
		<category><![CDATA[bundler]]></category>
		<category><![CDATA[exec]]></category>
		<category><![CDATA[fork]]></category>
		<category><![CDATA[gem]]></category>
		<category><![CDATA[rubygems]]></category>

		<guid isPermaLink="false">http://niczsoft.com/?p=477</guid>
		<description><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 30px 0;"><div style="position: absolute; bottom: 10px; right:115px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://niczsoft.com/2011/10/no-more-bundle-exec/';
var dzone_title = 'no more bundle exec';
var dzone_blurb = '';
var dzone_style = '2';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>
About half year ago I have written a gem to eliminate the need of using bundle exec &#8211; rubygems-bundler. For now at least 480 developers decide it is useful (downloads count for current version). Yesterday I finally was able to close issue 3 for rubygems-bundler, but as the support for plugins was enabled only on [...]]]></description>
			<content:encoded><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 30px 0;"><div style="position: absolute; bottom: 10px; right:115px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://niczsoft.com/2011/10/no-more-bundle-exec/';
var dzone_title = 'no more bundle exec';
var dzone_blurb = '';
var dzone_style = '2';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>

<p>About half year ago I have written a gem to eliminate the need of using <code>bundle exec</code> &#8211; <a title="rubygems-bundler - no more bundle exec" href="http://rubygems.org/gems/rubygems-bundler" target="_blank">rubygems-bundler</a>. For now at least 480 developers decide it is useful (downloads count for current version).</p>
<p>Yesterday I finally was able to close <a href="https://github.com/mpapis/rubygems-bundler/issues/3" target="_blank">issue 3</a> for rubygems-bundler, but as the support for plugins was enabled only on 1.1 branch &#8211; today I have released a bundler gem fork of the latest version 1.0.21 &#8211; <a title="bundler with support for rubygems plugins" href="http://rubygems.org/gems/mpapis-bundler" target="_blank">mpapis-bundler</a>, including only two changes compared the original gem in version 1.0.21:</p>
<ol>
<li>Support for rubygems plugins cherry picked from <a href="https://github.com/carlhuda/bundler/commit/7b4bd9e3d7a644dd4ad73fe95e2786e8f7411d04" target="_blank">7b4bd9e3d7a644dd4ad73fe95e2786e8f7411d04</a></li>
<li>Rebranding and dependency to rubygems-bundler <a href="https://github.com/mpapis/bundler/commit/8b34ef025d57a6cef58d1d8fdf486d4c25fe7d69" target="_blank">8b34ef025d57a6cef58d1d8fdf486d4c25fe7d69</a></li>
</ol>
<p>So anyone tired of writing <code>bundle exec</code> can now easily avoid it by using <a title="bundler with support for rubygems plugins" href="http://rubygems.org/gems/mpapis-bundler" target="_blank">mpapis-bundler</a> instead of <a title="bundler without support for rubygems plugins" href="http://rubygems.org/gems/bundler" target="_blank">bundler</a>.</p>
<p>Both gems rubygems-bundler and mpapis-bundler are backporting functionalities that will be available in rubygems and bundler &#8211; don&#8217;t wait for future, future is now.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://niczsoft.com/2011/10/no-more-bundle-exec/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>extended less usage</title>
		<link>http://niczsoft.com/2011/06/extended-less-usage/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extended-less-usage</link>
		<comments>http://niczsoft.com/2011/06/extended-less-usage/#comments</comments>
		<pubDate>Mon, 27 Jun 2011 23:03:50 +0000</pubDate>
		<dc:creator>Michal Papis</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[less]]></category>
		<category><![CDATA[shell]]></category>

		<guid isPermaLink="false">http://niczsoft.com/?p=470</guid>
		<description><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 30px 0;"><div style="position: absolute; bottom: 10px; right:115px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://niczsoft.com/2011/06/extended-less-usage/';
var dzone_title = 'extended less usage';
var dzone_blurb = '';
var dzone_style = '2';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>
Ever used grep and wanted to check that file with less? Now it is easy with wrapping functions, they parse grep outputted lines. So lets say we search for info in rvm packages: grep -rn &#039;__rvm_use(&#039; ~/.rvm/scripts /home/mpapis/.rvm/scripts/selector:391:__rvm_use() So now you want to see what is inside of &#8216;.rvm/scripts/selector&#8217; at line 391 less -N +j391 [...]]]></description>
			<content:encoded><![CDATA[<div style="position:relative; width: 100%; padding: 0 0 30px 0;"><div style="position: absolute; bottom: 10px; right:115px; width: 42px;"><script type="text/javascript">
<!--
var dzone_url = 'http://niczsoft.com/2011/06/extended-less-usage/';
var dzone_title = 'extended less usage';
var dzone_blurb = '';
var dzone_style = '2';
//-->
</script>
<script language="javascript" src="http://widgets.dzone.com/widgets/zoneit.js"></script> 
</div>
<style type="text/css">
#leftcontainerBox {
	float:left;
	position: fixed;
	top: 60%;
	left: 70px;
}
#leftcontainerBox .buttons {
	float:left;
	clear:both;
	margin:4px 4px 4px 4px;
	padding-bottom:2px;
}
#bottomcontainerBox {
	width: 50%;
	padding-top: 1px;
}
#bottomcontainerBox .buttons {
	float: left;
	margin: 4px 4px 4px 4px;
}
</style>

<p>Ever used grep and wanted to check that file with less? Now it is easy with wrapping functions, they parse grep outputted lines.</p>
<p>So lets say we search for info in <a href="https://rvm.beginrescueend.com/">rvm</a> packages:</p>
<pre class="brush: bash">
grep -rn &#039;__rvm_use(&#039; ~/.rvm/scripts
/home/mpapis/.rvm/scripts/selector:391:__rvm_use()
</pre>
<p>So now you want to see what is inside of &#8216;.rvm/scripts/selector&#8217; at line 391</p>
<pre class="brush: bash">
less -N +j391 /home/mpapis/.rvm/scripts/selector
</pre>
<p>But wouldn&#8217;t be nice to just write less, double click the found line and middle click:</p>
<pre class="brush: bash">
less /home/mpapis/.rvm/scripts/selector:391:__rvm_use
</pre>
<p>This will work when using following function:</p>
<pre class="brush: bash">
less()
{
  local params=() param parsed
  for param in &quot;$@&quot;
  do
    case $param in
    (*:*)
      parsed=( ${param//:/ } )
      params+=( &quot;-N&quot; &quot;+j${parsed[1]}&quot; &quot;${parsed[0]}&quot; )
      ;;
    (*)
      params+=( &quot;$param&quot; )
      ;;
    esac
  done
  command less &quot;${params[@]}&quot;
}
</pre>
<p>Put the above code into ~/.functions and source it in ~/.bashrc</p>
<pre class="brush: bash">
test -s ~/.functions &amp;&amp; . ~/.functions || true
</pre>
<p>Now restart your shell and enjoy you extended less function.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://niczsoft.com/2011/06/extended-less-usage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

