RSpec: Quiet a socketry/console logger in a test

You are writing a test. It raises a well-known exception, and you check for it. Suddenly, there’s log output, since you are working with some concurrent task. Your mood sinks. What’s the way to disable this library’s logging? In this case, I was kindly helped by the library’s author. Quiet a Console.logger in an RSpec …

Ossy: a maintainer’s CLI tool

ossy is a new release, by Piotr Solnica. Solnica releases a lot of software packages, most of it, as Rubygems. Doing that, in the small, one package at a time, is not very time-consuming, and can be wonderfully automated on places such as GitHub: author a Release text in a textarea, press a big green …

Ruby feature: Regular Expression replace once

About a year ago, programmer Tony Arcieri posed a question on the Ruby language bug tracker:  Why was Thread.exclusive deprecated? Among the answers to this question, Shyouhei Urabe’s one of the tersest feature descriptions yet: “we already have such thing, to some extent at least”: /#{@mutex=Mutex.new}/o The pair of slashes are Regular Expression delimiters. A Regular …

How to use very latest Bundler in Travis

TL;DR: When Bundler has fixes in master that you need, use the specific_install Rubygems plugin to install and use Bundler directly from a git branch. Example Travis YAML configuration excerpt: before_install: – gem update –system – gem install specific_install – gem specific_install https://github.com/bundler/bundler.git I will spend the rest of this post unpacking what the above means. …

A disciplined method to fix Rubocop TODOs

Here, a listicle of advice you never asked for! A method to locate and fix linting errors in Rubocop one at a time: choose a “cop” from the .rubocop_todo.yml file remove the line which includes the .rubocop_todo.yml rubocop –only Lint/IneffectiveAccessModifier fix issues and test fixes with the –only invocation rubocop –auto-gen-config to regenerate the .rubocop_todo.yml …

Hold Elasticsearch back on 2.4 for Chewy on macOS

So, Elasticsearch 5.0.0 is out. I’m using Chewy, a Ruby DSL gem that’s quite good. It’s not quite there yet with the deprecated Query APIs, (see Release Notes), so to keep using it you need to hold back to the Elasticsearch 2.4 series which is the last stable release. (Question about this, answered in the issue …

Ruby: Rubocop-friendly Hash pretty-printer

You’re desperate. Your legacy code-generation code outputs a Hash using hash#to_s. You’ve flouted many Rubocop rules to get to where you are. Suddenly, it gets too much. You search the Web for a pretty-print function that you want: a Rubocop-friendly Hash pretty-printer. Empty-handed, you cough up blood, while a police car’s red-blue lights flicker in …

FYI: RAD (Ruby+Arduino) MIDI bounty

A quickie, I found this very interesting. I want to have happened, already: Ruby Arduino MIDI bounty. Ain’t it cool? He is enticing you and me with some undefined hardware bounty. And pointing to GitHub as the place where you should upload your RAD-compatible MIDI library. Note to self: RAD uses some language transformations to …