Swizec Teller - a geek with a hatswizec.com

Senior Mindset Book

Get promoted, earn a bigger salary, work for top companies

Senior Engineer Mindset cover
Learn more

    How CamelCase ruined my day and my dev environment

    Bitcoin Magazine
    Bitcoin Magazine

    Yesterday everything went so comically wrong I just have to share. This post might be more a confession than a tale of warning, you be the judge.

    My objective, convert prices in USD to prices in bitcoin. Simple. Especially after I discovered someone's already made a gem that talks to the MtGox exchange and tells me how much a single BTC is worth.

    All I had to do was this:

    Gemfile:
    gem 'mtgox'
    
    bundle install
    
    Controller:
    price/MtGox.ticker.sell
    

    Simple, right?

    Because I like to make sure I'm working from a sane state I first ran the test suite. Ruby core dump.

    Right, I've been having these problems randomly for about a week now and they usually go away if you run the tests twice or thrice. This time, it just did not work. I got a ruby core dump, you have probably encountered a ruby bug every single time.

    No wonder! My Ruby interpreter is going to be a year old in a few days! Let's update. It all went downhill from that. And not in a pleasant adrenaline rush kind of way either.

    After about an hour of fiddling with RVM and Ruby versions and aliasing things from ~/.rvm/bin/ to /usr/bin/ the tests are finally running and I can begin.

    Mtgox is not defined.

    Hmm ... okay then. I thought Rails automagically loaded all gems specified in the Gemfile. A quick google later and I discovered that I can list all loaded gems with Gem.loaded_specs.keys.

    Sure thing, the gem was loaded.

    Right, let's make a separate ruby file and make sure things are working.

    require 'rubygems'
    require 'mtgox'
    
    puts Mtgox.ticker.sell
    

    No such gem "mtgox".

    Grrrr, okay fine. gem install mtgox ... already installed, wtf are you doing Swizec, you have that? Oh right, I did just update my Ruby stuff and maybe broke the environment and require paths are confused.

    Let's try this on my mac, I haven't done any fiddling there.

    The mtgox gem only works with Ruby 1.9.2+, you have 1.8.7 ... that's what you get for using your expensive laptop as a Skype and IRC machine. I can just update this, no problem!

    Your Homebrew is out of date. Your XCode does not exist. I have no idea what you're trying to do!

    Grargh.

    Fiddle fiddle fiddle and I eventually get Homebrew installed after at least an hour of effort. Let's try that RVM thing once again.

    After several fails with automake and sometimes just simply saying _"Hey, an error happened" _and the log looking perfectly fine I finally got it to start installing Ruby.

    ruby-1.9.3-p392 - #configuring........
    ruby-1.9.3-p392 - #compiling.
    ruby-1.9.3-p392 - #installing .
    ruby-1.9.3-p392 is not installed.
    To install do: 'rvm install ruby-1.9.3-p392'
    

    What?

    Fine, I give up on you laptop, we will pick this fight another day. Back to the Ubuntu box.

    After deleting all Ruby binaries from /usr/bin it finally decided to start using things in ~/.rvm/ and lo and behold, I can require the mtgox gem.

    Mtgox is undefined.

    God damn it! What now!? What could possibly be wrong now!?

    Find the source. Add some puts. Yes, yes the gem is getting loaded. It's printing to the console and I can ... wait a minute. It says module MtGox, not module Mtgox

    Oh for fuck's sake! Capital G ... All this time. All this effort. And I never, not once, noticed the module was CamelCase instead of just capital first letter.

    Sigh.

    Oh, now running bundle says bundler isn't installed even though I just ran it! What now ...

    Enhanced by Zemanta
    Published on April 16th, 2013 in Bitcoin, CamelCase, Programming, Ruby, RubyGems, Uncategorized

    Did you enjoy this article?

    Continue reading about How CamelCase ruined my day and my dev environment

    Semantically similar articles hand-picked by GPT-4

    Senior Mindset Book

    Get promoted, earn a bigger salary, work for top companies

    Learn more

    Have a burning question that you think I can answer? Hit me up on twitter and I'll do my best.

    Who am I and who do I help? I'm Swizec Teller and I turn coders into engineers with "Raw and honest from the heart!" writing. No bullshit. Real insights into the career and skills of a modern software engineer.

    Want to become a true senior engineer? Take ownership, have autonomy, and be a force multiplier on your team. The Senior Engineer Mindset ebook can help 👉 swizec.com/senior-mindset. These are the shifts in mindset that unlocked my career.

    Curious about Serverless and the modern backend? Check out Serverless Handbook, for frontend engineers 👉 ServerlessHandbook.dev

    Want to Stop copy pasting D3 examples and create data visualizations of your own? Learn how to build scalable dataviz React components your whole team can understand with React for Data Visualization

    Want to get my best emails on JavaScript, React, Serverless, Fullstack Web, or Indie Hacking? Check out swizec.com/collections

    Did someone amazing share this letter with you? Wonderful! You can sign up for my weekly letters for software engineers on their path to greatness, here: swizec.com/blog

    Want to brush up on your modern JavaScript syntax? Check out my interactive cheatsheet: es6cheatsheet.com

    By the way, just in case no one has told you it yet today: I love and appreciate you for who you are ❤️

    Created by Swizec with ❤️