<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anatoli Babenia</title>
    <description>The latest articles on DEV Community by Anatoli Babenia (@abitrolly).</description>
    <link>https://dev.to/abitrolly</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F248868%2Fd86a5513-3158-4ad9-ac7f-ca6ab7a1d242.png</url>
      <title>DEV Community: Anatoli Babenia</title>
      <link>https://dev.to/abitrolly</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abitrolly"/>
    <language>en</language>
    <item>
      <title>Find delegated methods in Ruby on Rails</title>
      <dc:creator>Anatoli Babenia</dc:creator>
      <pubDate>Wed, 09 Nov 2022 16:39:30 +0000</pubDate>
      <link>https://dev.to/abitrolly/find-delegated-methods-in-ruby-on-rails-96e</link>
      <guid>https://dev.to/abitrolly/find-delegated-methods-in-ruby-on-rails-96e</guid>
      <description>&lt;p&gt;I needed a way to find delegated methods in GitLab codebase for testing, so I came up with this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;delegated&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;delegates&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:ci_cd_settings&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;delegates&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;fromobj&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tosym&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="c1"&gt;# Get map of delegated methods.&lt;/span&gt;

  &lt;span class="c1"&gt;# Rails doesn't maintain a table of delegated methods, so it needs to be&lt;/span&gt;
  &lt;span class="c1"&gt;# reconstructed by parsing methods source.&lt;/span&gt;
  &lt;span class="n"&gt;regex&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sr"&gt;/^\s*delegate .*to: \s*:&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;tosym&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sr"&gt;.*/mx&lt;/span&gt;

  &lt;span class="n"&gt;delegated&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
  &lt;span class="n"&gt;fromobj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;methods&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;each&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;symname&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
    &lt;span class="nb"&gt;method&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fromobj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;method&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;symname&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;next&lt;/span&gt; &lt;span class="k"&gt;unless&lt;/span&gt; &lt;span class="nb"&gt;method&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;source_location&lt;/span&gt;

    &lt;span class="k"&gt;next&lt;/span&gt; &lt;span class="k"&gt;unless&lt;/span&gt; &lt;span class="nb"&gt;method&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;source&lt;/span&gt; &lt;span class="o"&gt;=~&lt;/span&gt; &lt;span class="n"&gt;regex&lt;/span&gt;

    &lt;span class="nb"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;symname&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_s&lt;/span&gt;
    &lt;span class="c1"&gt;# Example for `Project.last.method("ci_opt_in_jwt").source``&lt;/span&gt;
    &lt;span class="c1"&gt;# "  delegate :opt_in_jwt, :opt_in_jwt=, to: :ci_cd_settings, prefix: :ci, allow_nil: true\n"&lt;/span&gt;
    &lt;span class="n"&gt;prefix_match&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;method&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;source&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;match&lt;/span&gt; &lt;span class="sr"&gt;/prefix: \s+ :(\w+)/mx&lt;/span&gt;
    &lt;span class="n"&gt;delegated&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;name&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;prefix_match&lt;/span&gt;
        &lt;span class="nb"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;delete_prefix&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;#{&lt;/span&gt;&lt;span class="n"&gt;prefix_match&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;_"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;else&lt;/span&gt;
        &lt;span class="nb"&gt;name&lt;/span&gt;
      &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
  &lt;span class="n"&gt;delegated&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>rails</category>
      <category>ruby</category>
    </item>
    <item>
      <title>Hate of Leadership</title>
      <dc:creator>Anatoli Babenia</dc:creator>
      <pubDate>Tue, 20 Jul 2021 09:31:48 +0000</pubDate>
      <link>https://dev.to/abitrolly/hate-of-leadership-3f8a</link>
      <guid>https://dev.to/abitrolly/hate-of-leadership-3f8a</guid>
      <description>&lt;p&gt;I've just read the post &lt;a href="https://sourcehut.org/blog/2021-07-17-the-10x-programmer-is-a-leader/"&gt;https://sourcehut.org/blog/2021-07-17-the-10x-programmer-is-a-leader/&lt;/a&gt; from Drew DeVault and triggered. Usually my hate for "leaders" is so strong that I can't even write, but here I agree with everything Drew said, except for the word "leader". Maybe it was my experience, but I often encounter self-proclaimed "leaders" who are people that want to put themselves above others.&lt;/p&gt;

&lt;p&gt;First time I encountered this pattern in MLM sect. The sect had no real product. Everything they did was paid teaching on how to wear a suit, and how to mess with people to bring more paying followers.&lt;/p&gt;

&lt;p&gt;I hate self-proclaimed leaders the same way I hate self-proclaimed presidents. I know that both mostly exist in post soviet countries and holywood movies. Types I've rarely seen in successful business environment, but living in hierarchical country where I see some young people want to become a "leader", I imagine that they want to be a suit-case "leader" who rides in a black car and can not give a f* about "plebs". I can understand them. The pressure of living in an authoritarian country, where the rules are dumb and you are punished for everything with no sane explanation is too high. The "peaceful" terror is so draining, that it becomes a dream to climb higher to escape it, and take revenge on others. When you speak of "leadership" this is what it means to me.&lt;/p&gt;

&lt;p&gt;The Drew's article is an awesome reference, and I will probably show it to people, who believe in "leadership" from company management courses. But I would prefer a word that would be neutral towards me, and won't make me suffer, because in the world of "leadership" if I am not the leader, then I am the slave. And I can't be happy in being one or the other. I don't want people like me to hate me, and I don't want to treat others low. There must be a different gameplay. Evolved for 21th century. Now we are all synchronized. Don't need to waste this opportunity until some "leaders" who are uncomfortable without their crowns, to break this down back into medieval times when network connection was a privilege.&lt;/p&gt;

&lt;p&gt;The net made it obvious that people are limited. Those who have the time and interests to see what needs to be done are not necessarily those who can make it done. And people who are doing actual things may not have interest in coordinating and even talking to other people. But why some of the people are starting to name others as "leaders"? I can only have one explanation - they don't know alternative gameplay. And the "leader" will make sure they won't, because then they will lose their authority.&lt;/p&gt;

&lt;p&gt;To explain alternative gameplay, where people can help each other without going through a rigid hierarchical model, there should be different role names than just a single superhero "leader". Roles that would make those who seek to put themselves above others, uninterested.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>LSP client for vim</title>
      <dc:creator>Anatoli Babenia</dc:creator>
      <pubDate>Thu, 17 Jun 2021 06:34:14 +0000</pubDate>
      <link>https://dev.to/abitrolly/lsp-client-for-vim-1028</link>
      <guid>https://dev.to/abitrolly/lsp-client-for-vim-1028</guid>
      <description>&lt;p&gt;&lt;a href="https://github.com/neoclide/coc.nvim"&gt;&lt;code&gt;coc.nvim&lt;/code&gt;&lt;/a&gt; is the best, because.. it is most user friendly - tells what it does and waits for user to read. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--jwAPXXWz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/saxng33vzihy1uow7dtr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--jwAPXXWz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/saxng33vzihy1uow7dtr.png" alt="coc is best for vim"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is important, because &lt;code&gt;vim&lt;/code&gt; has too many things that contain text - windows, buffers, splits, stdout, messages - and new/occassional users are probably not aware how to inspect and leave them.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;vim&lt;/code&gt; is truly a lifelong learning editor.&lt;/p&gt;

</description>
      <category>vim</category>
    </item>
    <item>
      <title>Sacriledger</title>
      <dc:creator>Anatoli Babenia</dc:creator>
      <pubDate>Wed, 02 Dec 2020 10:21:54 +0000</pubDate>
      <link>https://dev.to/abitrolly/sacriledger-3emd</link>
      <guid>https://dev.to/abitrolly/sacriledger-3emd</guid>
      <description>&lt;p&gt;&lt;em&gt;The ledger to burn your money.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Once put in there, you can not extract or control them. You can only hope and pray that they will serve a better purpose. Nothing is sacred anymore, so let's get rid of that.&lt;/p&gt;

</description>
      <category>blockchain</category>
    </item>
    <item>
      <title>Add Haml validation to CI/CD</title>
      <dc:creator>Anatoli Babenia</dc:creator>
      <pubDate>Sat, 25 Jul 2020 12:48:02 +0000</pubDate>
      <link>https://dev.to/abitrolly/add-haml-validation-to-ci-cd-1ino</link>
      <guid>https://dev.to/abitrolly/add-haml-validation-to-ci-cd-1ino</guid>
      <description>&lt;h4&gt;
  
  
  TL;DR
&lt;/h4&gt;

&lt;p&gt;Add this to your &lt;code&gt;.gitlab-ci.yml&lt;/code&gt; or whatever CI/CD system you are using.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;find &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="nt"&gt;-name&lt;/span&gt; &lt;span class="s2"&gt;"*.haml"&lt;/span&gt; &lt;span class="nt"&gt;-type&lt;/span&gt; f &lt;span class="nt"&gt;-print0&lt;/span&gt; | xargs &lt;span class="nt"&gt;-0L1&lt;/span&gt; sh &lt;span class="nt"&gt;-c&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="s1"&gt;'for arg do echo -n "$arg .. "; haml --check "$arg"; done'&lt;/span&gt; _
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Explanation
&lt;/h4&gt;

&lt;p&gt;Use &lt;code&gt;find&lt;/code&gt; to find all &lt;code&gt;.haml&lt;/code&gt; files in current directory recursively. Pass paths of find files to &lt;code&gt;xargs&lt;/code&gt;. Use &lt;code&gt;\0&lt;/code&gt; symbol as file delimiter. For each file, run &lt;code&gt;sh&lt;/code&gt; command. In &lt;code&gt;sh&lt;/code&gt; command print path of the file and run &lt;code&gt;haml --check&lt;/code&gt; on it.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;find&lt;/code&gt; is necessary, because &lt;code&gt;haml&lt;/code&gt; utility is unable to search for files on its own. &lt;code&gt;xargs&lt;/code&gt; is needed, because &lt;a href="https://stackoverflow.com/questions/14871147/how-to-exit-from-find-exec-if-it-fails-on-one-of-the-files"&gt;&lt;code&gt;find&lt;/code&gt; can not detect if executed program failed&lt;/a&gt;. &lt;code&gt;sh&lt;/code&gt; is needed, because &lt;a href="https://github.com/haml/haml/issues/1035"&gt;&lt;code&gt;haml&lt;/code&gt; can not report the filename being checked&lt;/a&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Credits
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/14871147/how-to-exit-from-find-exec-if-it-fails-on-one-of-the-files"&gt;https://stackoverflow.com/questions/14871147/how-to-exit-from-find-exec-if-it-fails-on-one-of-the-files&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/6958689/running-multiple-commands-with-xargs"&gt;https://stackoverflow.com/questions/6958689/running-multiple-commands-with-xargs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>haml</category>
      <category>devops</category>
      <category>rails</category>
    </item>
    <item>
      <title>Ruby on Rails is not MVC - it is RCMV</title>
      <dc:creator>Anatoli Babenia</dc:creator>
      <pubDate>Wed, 29 Apr 2020 09:13:12 +0000</pubDate>
      <link>https://dev.to/abitrolly/ruby-on-rails-is-not-mvc-it-is-rcmv-465n</link>
      <guid>https://dev.to/abitrolly/ruby-on-rails-is-not-mvc-it-is-rcmv-465n</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lxCrEMAP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/m26mtjj267j4qpbjudvl.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lxCrEMAP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/m26mtjj267j4qpbjudvl.jpg" alt="Rails is not MVC"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Found it at amazing &lt;a href="http://installfest.railsbridge.org/job-board/the_request_cycle"&gt;RailsBridge pages&lt;/a&gt;. Would be interested to see similar paintings for React and other application frameworks.&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
      <category>mvc</category>
    </item>
    <item>
      <title>Script to move from Bitbucket Hg to Git</title>
      <dc:creator>Anatoli Babenia</dc:creator>
      <pubDate>Sat, 25 Apr 2020 17:10:20 +0000</pubDate>
      <link>https://dev.to/abitrolly/script-to-move-from-bitbucket-hg-to-git-2icg</link>
      <guid>https://dev.to/abitrolly/script-to-move-from-bitbucket-hg-to-git-2icg</guid>
      <description>&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Bitbucket#History"&gt;Bitbucket was born as a Mercurial hosting&lt;/a&gt;, and now the service &lt;a href="https://bitbucket.org/blog/sunsetting-mercurial-support-in-bitbucket"&gt;is being stripped of Hg&lt;/a&gt; by Atlassian. Atlassian warned that it will just remove the repos. It doesn't seem to care &lt;a href="https://code.google.com/archive/"&gt;to archive them&lt;/a&gt;. That's why you are here. &lt;/p&gt;

&lt;p&gt;To use the script, you will need to edit &lt;code&gt;REMOTE&lt;/code&gt; variable to point to your remote Mercurial repository. When your run the script, it will download &lt;a href="https://foss.heptapod.net/mercurial/hg-git"&gt;&lt;code&gt;hg-git&lt;/code&gt;&lt;/a&gt;, clone and convert your repo, and drop you into the shell in newly converted &lt;code&gt;git&lt;/code&gt; repository, which you can immediately &lt;code&gt;git push&lt;/code&gt; to GitHub, GitLab or another hosting of your choice.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="nb"&gt;set&lt;/span&gt; &lt;span class="nt"&gt;-x&lt;/span&gt;

&lt;span class="nv"&gt;REMOTE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ssh://hg@bitbucket.org/rainforce/pyrobot
&lt;span class="nv"&gt;NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;basename&lt;/span&gt; &lt;span class="nv"&gt;$REMOTE&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="nb"&gt;mkdir&lt;/span&gt; /tmp/&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$NAME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
&lt;span class="nb"&gt;cd&lt;/span&gt; /tmp/&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$NAME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;
hg clone https://foss.heptapod.net/mercurial/hg-git
hg clone &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$REMOTE&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="nb"&gt;mkdir&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$NAME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nt"&gt;-git&lt;/span&gt;
&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$NAME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nt"&gt;-git&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
 git init&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$NAME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
 hg bookmarks hg &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
 hg &lt;span class="nt"&gt;--config&lt;/span&gt; extensions.hggit&lt;span class="o"&gt;=&lt;/span&gt;../hg-git/hggit push ../&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$NAME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nt"&gt;-git&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;cd&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$NAME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nt"&gt;-git&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
 git checkout &lt;span class="nt"&gt;-b&lt;/span&gt; master hg &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
 &lt;span class="nv"&gt;$SHELL&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;    
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://engineering.fb.com/core-data/scaling-mercurial-at-facebook/"&gt;Mercurial is still awesome&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>bitbucket</category>
      <category>mercurial</category>
    </item>
    <item>
      <title>Regenerate Gemfile.lock</title>
      <dc:creator>Anatoli Babenia</dc:creator>
      <pubDate>Sat, 14 Dec 2019 12:04:02 +0000</pubDate>
      <link>https://dev.to/abitrolly/updating-gemfile-on-heroku-16n5</link>
      <guid>https://dev.to/abitrolly/updating-gemfile-on-heroku-16n5</guid>
      <description>&lt;h2&gt;
  
  
  TL;DR
&lt;/h2&gt;

&lt;p&gt;With Docker.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;rm &lt;/span&gt;Gemfile.lock
docker run &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$PWD&lt;/span&gt;&lt;span class="s2"&gt;:/app -w /app ruby:2.7 &lt;/span&gt;&lt;span class="se"&gt;\&lt;/span&gt;&lt;span class="s2"&gt;
    bundle install
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With &lt;code&gt;podman&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;rm &lt;/span&gt;Gemfile.lock
podman run &lt;span class="nt"&gt;--rm&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$PWD&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;:/app &lt;span class="nt"&gt;-w&lt;/span&gt; /app &lt;span class="se"&gt;\&lt;/span&gt;
    &lt;span class="nt"&gt;--security-opt&lt;/span&gt; &lt;span class="nv"&gt;label&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;disable ruby:2.7 &lt;span class="se"&gt;\&lt;/span&gt;
    bundle &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For info specific to Heroku scroll down.&lt;/p&gt;

&lt;h2&gt;
  
  
  Backstory
&lt;/h2&gt;

&lt;p&gt;Some time ago I've got a request from my friend to edit information on his website for which the original developer had gone. The web site was written in Ruby on Rails and it was deployed on Heroku using their &lt;code&gt;cedar-14&lt;/code&gt; stack running on Ubuntu 14.&lt;/p&gt;

&lt;p&gt;With no experience with Rails or Ruby or Heroku it took almost two weeks to get that app properly backed up and code running on newer &lt;code&gt;heroku-18&lt;/code&gt; base. The first thing I had to do is to brine dependencies in &lt;code&gt;Gemfile.lock&lt;/code&gt; up-to-date to close security bugs and possible glitches on newer OS.&lt;/p&gt;

&lt;p&gt;Since then I repeated the operation several times for different Ruby projects and recorded it on &lt;code&gt;dev.to&lt;/code&gt; for reference.&lt;/p&gt;

&lt;p&gt;I didn't want to ruin anything in my friend's existing deployment, so I made a copy of the web site both on new Heroku &lt;code&gt;heroku-18&lt;/code&gt; plan and on local machine. My local machine is using Fedora, and to avoid &lt;code&gt;configuration drift&lt;/code&gt; (and keep my system clean) I did all work in a Linux container.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating Linux container
&lt;/h2&gt;

&lt;p&gt;There are many tools to work with Linux containers. I use &lt;a href="//podman.io"&gt;&lt;code&gt;podman&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Make sure you are in your project dir, because it will be shared with the software in container.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;NAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;basename&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$PWD&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;
podman run &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;:&lt;span class="s2"&gt;"/root/&lt;/span&gt;&lt;span class="nv"&gt;$NAME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;:z &lt;span class="nt"&gt;-w&lt;/span&gt; &lt;span class="s2"&gt;"/root/&lt;/span&gt;&lt;span class="nv"&gt;$NAME&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; heroku/heroku:18-build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;NAME=&lt;/code&gt; takes the name of the current dir. &lt;code&gt;-v&lt;/code&gt; makes the current dir available inside &lt;code&gt;/root&lt;/code&gt; directory in container, and makes it the current dir when container starts. &lt;code&gt;-it&lt;/code&gt; allows to type commands when container starts.&lt;/p&gt;

&lt;p&gt;As I used Heroku, it was important to find an image with all development libraries, needed to compile and install some gems. At first I used just &lt;code&gt;heroku:18&lt;/code&gt; where I had to spend a day or two to find out and install all the dependencies. Then I found the reference to &lt;code&gt;heroku:18-build&lt;/code&gt; image at &lt;a href="https://devcenter.heroku.com/articles/heroku-18-stack#heroku-18-docker-image"&gt;https://devcenter.heroku.com/articles/heroku-18-stack#heroku-18-docker-image&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Updating &lt;code&gt;Gemfile.lock&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The next problem I spent a day or two was a problem with &lt;code&gt;bundler&lt;/code&gt; installer. It is not included in &lt;code&gt;herokiu:18-build&lt;/code&gt; image, and I discovered that the latest &lt;code&gt;bundler&lt;/code&gt; 2.x doesn't work on Heroku. I found a way to install &lt;code&gt;1.x&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gem &lt;span class="nb"&gt;install &lt;/span&gt;bundler &lt;span class="nt"&gt;--version&lt;/span&gt; &lt;span class="s2"&gt;"~&amp;gt; 1"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The rest of it came easy. Remove &lt;code&gt;Gemfile.lock&lt;/code&gt; and regenerate it using &lt;code&gt;bundler install&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;bundler &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Heroku summary
&lt;/h2&gt;

&lt;p&gt;Run this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;podman run &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;:&lt;span class="s2"&gt;"/root/app"&lt;/span&gt;:Z &lt;span class="nt"&gt;-w&lt;/span&gt; &lt;span class="s2"&gt;"/root/app"&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; heroku/heroku:18-build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then inside container this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gem &lt;span class="nb"&gt;install &lt;/span&gt;bundler &lt;span class="nt"&gt;--version&lt;/span&gt; &lt;span class="s2"&gt;"~&amp;gt; 1"&lt;/span&gt;
&lt;span class="nb"&gt;rm &lt;/span&gt;Gemfile.lock
bundle &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you've got this error message.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# bundle install&lt;/span&gt;
Your Ruby version is 2.6.5, but your Gemfile specified ~&amp;gt; 2.5.7
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then do.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;✗ &lt;span class="nb"&gt;rm &lt;/span&gt;Gemfile.lock
✗ podman run &lt;span class="nt"&gt;-v&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="si"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;:&lt;span class="s2"&gt;"/app"&lt;/span&gt;:Z &lt;span class="nt"&gt;-w&lt;/span&gt; &lt;span class="s2"&gt;"/app"&lt;/span&gt; &lt;span class="nt"&gt;-it&lt;/span&gt; ruby:2.5 bundle &lt;span class="nb"&gt;install&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>heroku</category>
      <category>ruby</category>
      <category>rails</category>
    </item>
    <item>
      <title>Install latest Go 1.13.1 on Fedora 30</title>
      <dc:creator>Anatoli Babenia</dc:creator>
      <pubDate>Mon, 14 Oct 2019 19:43:03 +0000</pubDate>
      <link>https://dev.to/abitrolly/install-latest-go-1-13-1-on-fedora-30-1a1a</link>
      <guid>https://dev.to/abitrolly/install-latest-go-1-13-1-on-fedora-30-1a1a</guid>
      <description>&lt;p&gt;Go 1.13 was released just &lt;a href="https://blog.golang.org/go1.13"&gt;a few weeks ago&lt;/a&gt; and I already need it for &lt;a href="https://github.com/golang/go/wiki/ErrorValueFAQ"&gt;a better error control&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I am test driving &lt;a href="https://github.com/fatih/vim-go"&gt;&lt;code&gt;vim-go&lt;/code&gt;&lt;/a&gt; for landing some changes to &lt;a href="https://github.com/wata727/tflint"&gt;&lt;code&gt;tflint&lt;/code&gt;&lt;/a&gt;. Awesome &lt;code&gt;vim-go&lt;/code&gt; can easily install all necessary tools for Go development with simple &lt;code&gt;:GoInstallBinaries&lt;/code&gt; command, except for the &lt;code&gt;go&lt;/code&gt; itself.&lt;/p&gt;

&lt;p&gt;Fedora 30 that I use &lt;a href="https://apps.fedoraproject.org/packages/golang"&gt;comes with&lt;/a&gt; Go 1.12 and I didn't switch to &lt;a href="https://getfedora.org/"&gt;beta 31&lt;/a&gt; yet. The official instructions from &lt;a href="https://golang.org/doc/install#tarball"&gt;golang website&lt;/a&gt; tell to just download and unpack tarball, set some environment variables in profile, and that seemed too burdensome. I will have to repeat that every time when I need some security updates and bugfixes. I also don't want to think about possible version conflicts when I finally switch to Fedora 31.&lt;/p&gt;

&lt;p&gt;Instead I found out that I can install Go from &lt;a href="https://snapcraft.io/"&gt;&lt;code&gt;snapcraft&lt;/code&gt;&lt;/a&gt;, which is official project by Canonical. Thanks to generous people out there, &lt;code&gt;snaps&lt;/code&gt; are available for Fedora, and you can choose the Go version you need.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# install `snapd`, which is necessary to run snaps&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;dnf &lt;span class="nb"&gt;install &lt;/span&gt;snapd
&lt;span class="c"&gt;# classic snaps like `go` require some symlinking&lt;/span&gt;
&lt;span class="nb"&gt;sudo ln&lt;/span&gt; &lt;span class="nt"&gt;-s&lt;/span&gt; /var/lib/snapd/snap /snap
&lt;span class="c"&gt;# `go` snap from will be updated automatically&lt;/span&gt;
&lt;span class="nb"&gt;sudo &lt;/span&gt;snap &lt;span class="nb"&gt;install &lt;/span&gt;go &lt;span class="nt"&gt;--channel&lt;/span&gt; 1.13/stable &lt;span class="nt"&gt;--classic&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;sudo snap info go&lt;/code&gt; reveals channels with all available versions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;snap info go | &lt;span class="nb"&gt;grep &lt;/span&gt;stable
tracking:     1.13/stable
  stable:         1.12.10       2019-09-25 &lt;span class="o"&gt;(&lt;/span&gt;4520&lt;span class="o"&gt;)&lt;/span&gt; 92MB classic
  1.13/stable:    1.13.1        2019-09-25 &lt;span class="o"&gt;(&lt;/span&gt;4517&lt;span class="o"&gt;)&lt;/span&gt; 92MB classic
  1.12/stable:    1.12.10       2019-09-25 &lt;span class="o"&gt;(&lt;/span&gt;4520&lt;span class="o"&gt;)&lt;/span&gt; 92MB classic
  1.11/stable:    1.11.13       2019-08-15 &lt;span class="o"&gt;(&lt;/span&gt;4286&lt;span class="o"&gt;)&lt;/span&gt; 82MB classic
  1.10/stable:    1.10.8        2019-01-24 &lt;span class="o"&gt;(&lt;/span&gt;3133&lt;span class="o"&gt;)&lt;/span&gt; 58MB classic
  1.9/stable:     1.9.7         2018-06-13 &lt;span class="o"&gt;(&lt;/span&gt;2117&lt;span class="o"&gt;)&lt;/span&gt; 58MB classic
  1.8/stable:     1.8.7         2018-02-07 &lt;span class="o"&gt;(&lt;/span&gt;1407&lt;span class="o"&gt;)&lt;/span&gt; 51MB classic
  1.7/stable:     1.7.6         2017-06-02  &lt;span class="o"&gt;(&lt;/span&gt;324&lt;span class="o"&gt;)&lt;/span&gt; 48MB classic
  1.6/stable:     1.6.4         2017-05-17  &lt;span class="o"&gt;(&lt;/span&gt;122&lt;span class="o"&gt;)&lt;/span&gt; 49MB classic
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>go</category>
      <category>fedora</category>
      <category>snapcraft</category>
    </item>
  </channel>
</rss>
