Sorting Your Gems

Originally published at scottw.com on Mar 25, 2019 ・1 min read

I was looking through the Dev.to source, and the first thing that jumped out at me was the Gemfile was sorted (within each group). This made it much easier to scan and think about their dependencies.

Using Vim, I was able to sort my Gemfile in a couple of seconds.

  1. Select the lines within the group (or all of those outside of a group).
  2. enter command mode (:) and type sort

That’s it. Now, if you were like me, you still sometimes flipflop between β€˜ and β€œ (working on it!), you will need to pick one (β€œ) and do a find and replace %s/'/"/g as well otherwise things will not sort quite right.

DISCUSS (1)
 

We do this on CodeFund. github.com/gitcoinco/code_fund_ads/

I also do it on most of my side projects. I think it makes sense to sort any list that you need/want to scan visually. Things like permitted strong parameter attributes in your controllers, etc... Sorting helps you find things quickly and detect potential issues (like duplicate entries).

Classic DEV Post from Dec 27 '18

Even the Big Ones Mess Up

This morning, my feed blew up due to my friends and family complaining about so...

Boostrapped Founder