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 installController:price/MtGox.ticker.sell
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!
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'
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.
Oh, now running bundle says bundler isn't installed even though I just ran it! What now ...
Here's how it works 👇
Then get thoughtful letters 💌 on mindsets, tactics, and technical skills for your career.
"Man, love your simple writing! Yours is the only email I open from marketers and only blog that I give a fuck to read & scroll till the end. And wow always take away lessons with me. Inspiring! And very relatable. 👌"
Ready to Stop copy pasting D3 examples and create data visualizations of your own? Learn how to build scalable dataviz components your whole team can understand with React for Data Visualization
Curious about Serverless and the modern backend? Check out Serverless Handbook, modern backend for the frontend engineer.
Ready to learn how it all fits together and build a modern webapp from scratch? Learn how to launch a webapp and make your first 💰 on the side with ServerlessReact.Dev
By the way, just in case no one has told you it yet today: I love and appreciate you for who you are ❤️