Link Roundup: Technology
Ruby environment set up, rbenv, Vim plugins, Franchise and Probot

Link Roundup: Technology

Ruby environment set up, rbenv, Vim plugins, Franchise and Probot

Monthly we collect some technology related links to share with you. These will often mirror work we are currently engaged in, or tools we are using to improve our workflow. Our hope is that at least one might help you enhance your technology stack, or reduce friction in your daily work.

creating a ruby development environment

I spent several years primarily developing applications using Rails, but more recently I’ve been happily focused on node.js projects. In the past few weeks I started a contract that has me back in Ruby. The MacBook I am using currently has never been used to do any Ruby work, and I made a mess of my .dotfiles. So, I had to start from scratch and get a Ruby environment set up again. Here are some bits I quickly realized I needed.

install some rubies

Managing Ruby versions is a breeze with rbenv, and I like that I can easily understand how it works. $PATH injection is a fine way to deal with this challenge, and I take it a step further by prepending ./bin to my $PATH. Then I can leverage binstubs locally and not have to use the cumbersome bundle exec or ./bin/rails when running scripts.

level up your REPL

You spend a decent amount of time in a Rails console, or IRB. It’s worth configuring some bits to make it more enjoyable. First, just use Pry everywhere.

# ~/.irbrc

begin
  require "rubygems"
  require "pry"
  Pry.start
  exit
rescue LoadError => e
  warn "=> Unable to load pry"
end

Then you can manage how you want all your Ruby REPLs to work in one place, your .pryrc. Here I make sure I always have awesome_print and toss in some examples for how you might extend your environment with methods you find helpful when hacking. I used to require hirb as well, but have not found I miss it enough to add it back (yet).

# ~/.pryrc

# awesome print
begin
  require 'awesome_print'
  AwesomePrint.pry!
rescue LoadError => err
  warn "Couldn't load awesome_print: #{err}"
end

# See https://gist.github.com/807492
class Array
  def self.toy(n=10, &block)
    block_given? ? Array.new(n,&block) : Array.new(n) {|i| i+1}
  end
end

class Hash
  def self.toy(n=10)
    Hash[Array.toy(n).zip(Array.toy(n){|c| (96+(c+1)).chr})]
  end
end

I am still early in my re-setup for active Rails development, but I would expect more Ruby links in the interesting projects sections of upcoming posts. Here are some of the vim plugins I have adopted.

vim-rails

Ruby on Rails power tools

vim-endwise

wisely add “end” in ruby, endfunction/endif/more in vim script, etc

vim-rubocop

The Vim RuboCop plugin runs RuboCop and displays the results in Vim

interesting projects

Franchise

🍟 a notebook SQL client. what you get when you have a lot of sequels.

Like runkit but targeting SQL results, and very cool that you can share a visualization with a colleague who can then re-connect and explore further.

Probot

a trainable robot that responds to activity on GitHub

I want to start using a some of the example bots immediately, especially the Work In Progress bot.

dedent

⬅️ ES6 string tag that strips indentation from multi-line strings.

This simple function solves a common issue I have creating multi-line strings while in a closure.

r2

HTTP client. Spiritual successor to request.

This package is not published to npm yet, but I am very excited about its direction. Be sure to read the companion article, Modern Modules, for insight into Mikeal’s intentions.

keystash

🔑💌 Save secrets in S3 using KMS envelope encryption

I’m not using it for anything, but I love reading the source for clever CLI scripts like this.


Get this sent to your inbox

Let us share our thinking, opinions, practices, valuable resources and everything else that is happening at Studio Elsa.