<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Gonzalo on Medium]]></title>
        <description><![CDATA[Stories by Gonzalo on Medium]]></description>
        <link>https://medium.com/@grzuy?source=rss-ef298b625f8c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Gonzalo on Medium</title>
            <link>https://medium.com/@grzuy?source=rss-ef298b625f8c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 15:18:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@grzuy/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Updating gems cheat sheet]]></title>
            <link>https://medium.com/cedarcode/updating-gems-cheat-sheet-346d5666a181?source=rss-ef298b625f8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/346d5666a181</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[dependencies]]></category>
            <category><![CDATA[bundler]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[bundle]]></category>
            <dc:creator><![CDATA[Gonzalo]]></dc:creator>
            <pubDate>Mon, 13 Aug 2018 21:05:56 GMT</pubDate>
            <atom:updated>2019-04-25T12:55:45.289Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<h3>Updating Gems cheat sheet</h3><h4>Using Bundler’s advanced features</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2yEvXGKXsl8zx23I" /><figcaption>Photo by <a href="https://unsplash.com/@glenncarstenspeters?utm_source=medium&amp;utm_medium=referral">Glenn Carstens-Peters</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h4>Fix vulnerable gems</h4><pre>$ gem install bundler-audit<br>$ bundle audit --update</pre><pre>[For each gem listed by the audit]<br>  $ bundle update --conservative --patch &lt;gem-name&gt;</pre><h4>Update non-production gems</h4><pre>$ bundle update --conservative --group test development</pre><h4>Update production gems</h4><pre>$ bundle update --patch --strict<br>$ bundle update --minor --strict<br>$ bundle update --major</pre><h4>List constrained gems</h4><pre>$ bundle outdated --groups</pre><h4>Why?</h4><p>For a detailed version I recommend reading <a href="https://medium.com/cedarcode/reduce-fear-of-bundle-update-with-this-4-step-process-e021e8808c48">A Guide to Update Gems with bundle update</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=346d5666a181" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cedarcode/updating-gems-cheat-sheet-346d5666a181">Updating gems cheat sheet</a> was originally published in <a href="https://medium.com/cedarcode">Cedarcode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Guide to Update Gems with bundle update]]></title>
            <link>https://medium.com/cedarcode/reduce-fear-of-bundle-update-with-this-4-step-process-e021e8808c48?source=rss-ef298b625f8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e021e8808c48</guid>
            <category><![CDATA[rubygems]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[bundler]]></category>
            <category><![CDATA[gemfile]]></category>
            <dc:creator><![CDATA[Gonzalo]]></dc:creator>
            <pubDate>Thu, 19 Jul 2018 21:48:07 GMT</pubDate>
            <atom:updated>2018-11-01T00:06:17.836Z</atom:updated>
            <cc:license>http://creativecommons.org/licenses/by/4.0/</cc:license>
            <content:encoded><![CDATA[<h4>Tips and tricks to master bundle update by following incremental, controlled and safe steps</h4><p><strong>tl;dr</strong>— Synopsis: <a href="https://medium.com/cedarcode/updating-gems-cheat-sheet-346d5666a181">Updating Gems cheat sheet</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*U0AC8YBV-doHQWHD" /><figcaption>“selective focus photography of faceted red gemstone” by <a href="https://unsplash.com/@joshuafuller?utm_source=medium&amp;utm_medium=referral">Joshua Fuller</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Have you ever been part of a massive Rails app upgrade, with tons of gems not being updated for years?</p><p>Was that closer to a joyful experience or a nightmare?</p><p>Have you ever felt that you — or the team — could do better at keeping up-to-date with Gemfile‘s gem updates? Was that in part because of an unexisting process around it?</p><p>If some of this rings true to you, I think you’ll find what follows helpful.</p><h3>Step 1 — Fix security vulnerabilities</h3><p>Before doing any bulk updating of gems, focus on fixing any security vulnerability — if present — in any of your app’s included gems.</p><p>To identify them you can use <a href="https://rubysec.com/">RubySec</a>’s bundler-audit utility:</p><pre>$ gem install bundler-audit</pre><pre>$ <strong>bundle audit --update</strong></pre><p>Say — for an example Rails app — it outputs:</p><pre>Name: sprockets<br>Version: 3.7.1<br>Advisory: CVE-2018-3760<br>Criticality: Unknown<br>URL: <a href="https://groups.google.com/forum/#!topic/ruby-security-ann/2S9Pwz2i16k">https://groups.google.com/forum/#!topic/ruby-security-ann/2S9Pwz2i16k</a><br>Title: Path Traversal in Sprockets<br>Solution: upgrade to &lt; 3.0.0, &gt;= 2.12.5, &lt; 4.0.0, &gt;= 3.7.2, &gt;= 4.0.0.beta8</pre><pre><strong>Vulnerabilities found!</strong></pre><p>If you get “Vulnerabilities found”, you need to find the smallest version update — <a href="https://semver.org/">patch-level</a> only, if possible — that fixes the vulnerability so that feature regressions are less likely.</p><p>From the example above, you can infer that the smallest possible version change that makes sprockets secure again is moving from 3.7.1 to 3.7.2 — given that one of the listed solutions is &gt;= 3.7.2 and the current vulnerable version is 3.7.1.</p><p>In this case, you may use:</p><pre>$ bundle update --patch --conservative &lt;vulnerable-gem-name&gt;</pre><p>to attempt a patch-level only (--patch) update to the Gemfile.lock with as minimal effect on other gems as possible (--conservative).</p><h4>Why not just update everything?</h4><p>What you’ll get from doing this very small update as a separate task — and probably separate pull request — is that it would end up having a higher probability of getting merged fast; being less risky, easier to code review, test and deploy to production.</p><blockquote>You’ll make a potential vulnerability in your app go away quickly.</blockquote><p>What if you mix more updates in one big pull request and it gets temporarily blocked? Maybe a regression in one of the app main user flows — which is being caused by a different gem update — slows down the whole security update. Would you want that?</p><h3>Updating gems</h3><p>Is this when we update everything by running $ bundle update and be done with it? Not exactly.</p><h4>Why not bulk updating?</h4><p>Do you feel you should be equally cautious with every gem update?</p><blockquote>How much more “regression risk” do you have when updating rails compared to a “development” gem likeweb-console?</blockquote><p>Probably updating rails version is much more risky for your app and your end-users.</p><h4>Split updates</h4><p>Following the same reasoning as with security updates (Step 1), you can benefit from splitting updates here as well — given the fact we’ve identified different risk levels for different gem updates.</p><p>So, what’s the split?</p><p>A simple one can be “Non-production”–“Production” gems.¹ Less and more risky respectively.</p><h3>Step 2 — Update “Non-production” gems</h3><pre>$ <strong>bundle update </strong>--conservative --group<strong> test development</strong></pre><p>Bundler’s --conservative option prevents updates in any “Production” gem that is also a dependency of a“Non-production” gem.</p><p><em>Note: Make sure you’re using </em><em>bundler v1.16.4 or higher. There was a known </em><a href="https://github.com/bundler/bundler/issues/6560"><em>issue</em></a><em> when mixing </em><em>--group and </em><em>--conservative options in previous versions.</em></p><h4>Play safe</h4><p>Don’t forget safety measures against feature regressions:</p><ul><li>run <strong>automated</strong> <strong>test</strong> suite — i.e. $ bundle exec rake test or similar;</li><li><strong>test</strong> <strong>manually </strong>— as much as needed.</li></ul><h4>Commit</h4><pre>$ git commit -am &quot;Update non-production gems&quot;</pre><h3>Step 3 — Update “Production” gems</h3><p>If you are fearless you could use $ bundle update.</p><p>Else — a more cautious approach — would be to split bundle update in 3 separate sub-steps, with increasing risk levels.</p><pre>$ <strong>bundle update --patch </strong>--strict</pre><pre>$ git commit -am &quot;Update gems to latest patch version&quot;</pre><pre><br>$ <strong>bundle update --minor </strong>--strict</pre><pre>$ git commit -am &quot;Update gems to latest minor version&quot;</pre><pre><br>$ <strong>bundle update --major</strong></pre><pre>$ git commit -am &quot;Update gems to latest major version&quot;</pre><p>You may even decide to run only a subset of the above.</p><p>It’s up to you if you want to make separate pull requests for these or not. At least, you should have separate commits for each grouped update.</p><p>In case of a feature regression caused only by one of those commits, you could revert — or discard — it in isolation, instead of putting yourself in an “all-or-nothing” situation.</p><blockquote>You’ll have a better chance of making progress</blockquote><h4>Again, be safe</h4><ul><li>run <strong>automated</strong> <strong>test</strong> suite — i.e. $ bundle exec rake test or similar;</li><li><strong>test</strong> <strong>manually </strong>— as much as needed;</li><li>Check each updated gem’s CHANGELOG — if available — for potential backward-incompatible changes.</li></ul><h3>Step 4— What about Gemfile version constraints?</h3><p>What if your Gemfile has rails constrained to:</p><pre>gem &#39;rails&#39;, &#39;~&gt; 5.1.6&#39;</pre><p>and 5.2.0 is already out?</p><p>Well, in that case none of the previous commands updated rails version for you.</p><p>Of course, that’s expected… and probably why you — or someone else — intentionally set a constraint for rails in the Gemfile in the first place.</p><h4>How many gems are constrained from reaching new versions?</h4><p>Here is when bundler’s built-in command <a href="https://bundler.io/man/bundle-outdated.1.html">bundle outdated</a> becomes handy.</p><pre>$ <strong>bundle outdated --groups</strong></pre><pre>Fetching gem metadata from <a href="https://rubygems.org/">https://rubygems.org/</a>.........<br>Fetching gem metadata from <a href="https://rubygems.org/">https://rubygems.org/</a>.<br>Resolving dependencies...</pre><pre>Outdated gems included in the bundle:<br>===== Without group =====<br>  * actioncable (newest 5.2.0, installed 5.1.6)<br>  * actionmailer (newest 5.2.0, installed 5.1.6)<br>  * actionpack (newest 5.2.0, installed 5.1.6)<br>  * actionview (newest 5.2.0, installed 5.1.6)<br>  * activejob (newest 5.2.0, installed 5.1.6)<br>  * activemodel (newest 5.2.0, installed 5.1.6)<br>  * activerecord (newest 5.2.0, installed 5.1.6)<br>  * activesupport (newest 5.2.0, installed 5.1.6)<br>  * arel (newest 9.0.0, installed 8.0.0)<br>  * railties (newest 5.2.0, installed 5.1.6)<br>  * websocket-driver (newest 0.7.0, installed 0.6.5)<br>===== <strong>Group default</strong> =====<br>  * <strong>pg</strong> (newest <strong>1.0.0</strong>, installed <strong>0.21.0</strong>, requested <strong>~&gt; 0.18</strong>)<br>  * <strong>rails</strong> (newest <strong>5.2.0</strong>, installed <strong>5.1.6</strong>, requested <strong>~&gt; 5.1.6</strong>)</pre><p>So pg (postgresql adapter) is also constrained (to the 0.x series while 1.0.0 is already out).</p><blockquote>This last step of the process is the riskiest.</blockquote><h4>Now what?</h4><p>Depending on your context, and which app you are updating, you may think<strong> it’s fine to go ahead</strong> and <strong>update</strong> each — or some —constrained gem by:</p><ol><li><strong>Changing</strong> version constraint string in <strong>Gemfile </strong>entry</li><li>$ <strong>bundle install</strong></li><li>Regression verification; including running automated test suite, manual testing and checking gem’s CHANGELOG for backward-incompatible changes</li><li>$ git commit -am &quot;Update &lt;gem-name&gt; to &lt;new-version&gt;&quot;</li></ol><p>Splitting is your friend here, again.</p><p>Someone from the team—maybe even you— using git bisect in the future, trying to find the cause of a feature regression, will be very thankful to notice that the offending commit is updating only one gem instead of many at the same time.</p><p><strong>If you prefer to execute this 4th step as separate</strong> — more focused —<strong> tasks</strong>, you can create tickets/user-stories in your project/app backlog, so you — or someone from the team — can pick it up at a later time.</p><h3>Conclusion</h3><p>Start small.</p><p>Go to your app and try execute “Step 1”:</p><pre>$ bundle audit --update</pre><p>Any vulnerable gem needs an update? Yes? Update gem and “New pull request”. Win!</p><p><strong>Then</strong> try to update “Non-production” gems with</p><pre>$ bundle update --conservative --group test development</pre><p>Do that — say, once a week — for a couple of weeks.</p><blockquote>Build momentum…</blockquote><p>After a couple of weeks you’ll be confident; your update process is running smooth. Team members are starting to like it; you can now slowly start adding the rest of the steps…</p><h4>Remember, you’ve reduced risk by:</h4><ul><li>approaching less risky tasks first;</li><li>splitting updates in smaller chunks; and</li><li>running this process as frequently as possible.</li></ul><h3>Recap</h3><p>For a short recap and future quick reference see <a href="https://medium.com/cedarcode/updating-gems-cheat-sheet-346d5666a181">Updating Gems cheat sheet</a>.</p><p>[1] You may call them “Development”–“The rest” as well.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e021e8808c48" width="1" height="1" alt=""><hr><p><a href="https://medium.com/cedarcode/reduce-fear-of-bundle-update-with-this-4-step-process-e021e8808c48">A Guide to Update Gems with bundle update</a> was originally published in <a href="https://medium.com/cedarcode">Cedarcode</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>