No such file to load when running Ruby 1.9.2 on Ubuntu

I have an existing Rails repo that is trying to run Ruby 1.9.2. I attempted to check out the code and get things running, but had a small problem.

$ rake spec
(in ...)
rake aborted!
no such file to load -- net/https. Try running apt-get install libopenssl-ruby
(See full trace by running task with --trace)

Although I tried sudo apt-get installing the various libopenssl-ruby and libopenssl-dev and whatnot, I kept getting the same error message.

Read on →

Ruby Pretty-Print XML

It's fairly easy to do with some Rails libraries, although it's different from the way that most people have suggested online due to Rails 3 changing the way that some things are laid out. If you want to use IRB or something else to pretty-print XML with Ruby, try the following:

require 'rubygems'
require 'ap'
include ActiveModel::Serializers::Xml

raw = File.read(filename)
parsed = Hash.from_xml(raw)
ap parsed

The ap is the awesome-print gem. It prints out the resultant structure in an easy-to-read format. I like the output of ap better than pp, and I like using RoR's from_xml better than, say, REXML, Nokogiri, or XmlSimple. For the first two, you basically have to roll your own pretty-printer (from what I understand). XmlSimple works, but the output seems to be a bit funky (too many arrays for keys, etc.)

Read on →

Ruby Shebang RVM

If you're wondering what the right shebang line is when you're using RVM, it's:

#!/usr/bin/env ruby

For searchers, it's also called a hashbang, hashpling, pound bang, or crunchbang.

Read on →

Getting Objective Resource Working with SDK 4.2

I cloned Objective Resource from the yfactorial ObjectiveResource github repository, initialized the git submodules, and tried building it under the SDK for 4.2.

I ran into two problems when trying to build. First, it complained about not knowing where the SDK was. To remedy this, I went to Project -> Edit Project Settings -> Build -> Base SDK, and changed it to latest. It was originally looking for the 3.0 SDK, which wasn't installed on my machine.

Read on →

! Fingerprint already exists. Please use one ssh key per Heroku account

Trying to change Heroku command-line users to add add-ons for the user in our organization that has the credit card information associated with him (Bill).

My account info: anthony@example.com His account: bill@example.com

Can run this to clear out my current Heroku username and password:

rm ~/.heroku/credentials

But unfortunately even after I authenticate with the new username and password, things don't quite work right:

Read on →