Get in touch to talk startups and web apps!

Best bet is to email me or ping me on Linkedin.

Posts tagged: rails

Quick Specs on RetHat Linux Box

I needed to quickly get some specs on a cluster of RedHat linux boxes that were running a Ruby on Rails project our company is enhancing for a client. While this is far from a comprehensive list, running the following commands gave me useful information about the server, linux os, etc.

Server Info:
cat /proc/cpuinfo

OS Info:
cat /etc/redhat-release

OS Architecture (32 v. 64):
uname -a

RAM:
free or grep -i memtotal /proc/meminfo

Disk Space:
df -h

Public IP:
curl checkip.dyndns.org

Private IP:
/sbin/ifconfig | grep ‘inet addr’

Hostname:
cat /etc/sysconfig/network

Mapped Hosts:
cat /etc/hosts

Installing RVM on Ubuntu

I recently did a fresh install of Ubuntu on a Dell laptop for a Rails project I’m working on. Everything was cruising along perfectly until I tried getting RVM installed, which I erroneously assumed would be a breeze. I kept bumping into issues where an installed gem was complaining that it wasn’t compiled against the correct libraries. For each error, I needed to invoke a special rvm package install uninstall the ruby, reinstall the ruby and reinstall the gems. It was turning into a nightmare.

It turns out that Chris Irish had a much cleaner approach: install all the libraries via apt-get and be done with it. Too simple. I followed the steps in his post and was rollin’ with RVM in no time. It appears that the following packages needed to be installed prior to installing the gems:

sudo apt-get install build-essential bison openssl libreadline5 libreadline-dev curl git-core zlib1g zlib1g-dev libssl-dev vim libsqlite3-0 libsqlite3-dev sqlite3 libreadline-dev libxml2-dev git-core subversion autoconf

Good Ole Fashion Javascript and Rails

I have recently been intrigued with a Rails gem called Apotomo, which is an MVC widget framework for Rails. I came across a post by Boban Jovanoski where he outlines the steps he took to build a javascript-based widget using Rails and Apotomo. Very cool tutorial.

The part I enjoy the most from Boban’s post was linking over to his github account and reading his Javascript code in his RJS file. No JS framework here, folks. He went full-on old-school to write bare-bones javascript. It was a trip down memory lane.

I’ll confess that I forgot you could assign a variable to a function and then proceed to treat the variable as an object. Javascript is truly a unique language!

Debugging Capybara/Cucumber Steps Using Firebug

I was having strange issues with an ajax-based cucumber step.  It was working perfectly when I ran the test manually, but for some reason Capybara was choking.

If only I could tinker around with the dom as the test was running. Fortunately for me, Mike Gehard at Pivotal Labs and Jari Bakken (a commentor) blogged about gaining access to Firebug while your features are running.

This approach, combined with a “wait” step definition (see here), gave me just the tools I needed to see what was happening while the tests were running. Brilliant!

Unfortunately, I couldn’t get the process to work as Mike outlined it, but by combining it with Jari’s second suggestion, it is working as advertised.

Opening a Gem – Thanks Bundler

For quite some time, I’ve been using the open_gem gem. It’s a dead simple way to open a gem in your editor and if you subscribe to John Nunemaker’s approach to Stop Googling, it fits perfectly into the workflow.

From the command line, it’s simply:

$> gem open timecop

Today, while reading bundler’s help file, I noticed the open command. It appears to do the same thing as open_gem, but without the need of an extra gem.

Now, I just type:

$> bundle open timecop

I love the world of ruby!

Rails Web App Theme Generator

I spent several hours looking for an admin template for a Rails project I am working on. I clicked through dozens of HTML admin templates on ThemeForest, but was mostly unimpressed with the selection; the majority of which felt like skins for Joomla-driven php sites.

Fortunately, I stumbled upon the web app theme project on Github. Although it would make for a killer web app theme, it is ideally suited for an admin panel. The built-in generators are even ‘admin’ aware. I have a suspicion I’ll be using this gem on a regular basis.

See a live demo of the generated template, along with links to see the various themes with which it ships.

(below: screenshot of the ‘drastic-dark’ theme. Pretty freaking cool, eh?)

Paying Down Technical Debt Includes Major Platform Upgrades

Harvest is on Rails 3! This is exciting news from the Harvest technical team. I’ll detail how the upgrade process went, but first a little history. The initial commit to Harvest was made on November 23rd, 2005 – five years ago. Back then, we ran Rails 0.14.1 and were still discussing how time should be entered into the Harvest. That’s five years of Rails releases since we started, and each upgrade was a painful but worthwhile experience.

I cannot stress that last conviction enough. Besides the obvious technical improvements an upgrade brings, there is also a morale boost from using the very best tools. This comes at a cost: Upgrading a key dependency is challenging for an app of Harvest’s size.

Name Lines
Controllers 12K
Models 25K
Views 28K
Helpers 7K
Libraries 3K
Functional tests 18K
Unit tests 20K
Selenium tests 2K
Our Javascript 10K

Harvest also has 32 plugins, 82 gem dependencies, our widgets, mobile apps, and Co-op integration. These are all potential breaking points during an upgrade.

Good for the people at Harvest for keeping up with the latest version of Rails (and friends)! Having been part of upgrade projects myself, I know how difficult and nerve racking it can be to upgrade to new platform versions.

I love how Dee points out the morale boost that comes with knowing you are developing with the latest and greatest.

Generate Routes in Rails 3 Rake Tasks

In order to create a new admin record, I added a rake task to my rails project. The task prompts the user for the credentials of the new user and creates the admin in the database. Since I don’t have a link on the page for the admin login, I wanted to remind the user how to access the login screen. By default, rake tasks don’t load the url_helper module, so you need to include it in your task.

In Rails 3, add the module as indicated in the gist below.

A short bit on me…

First and foremost, I am a husband to the most incredible woman alive, a father of four amazing children and in general, I love being alive.

After that, I am a passionate Ruby on Rails developer, a {biking|climbing|hiking|swimming} enthusiast, a paleo chef (ahem…in my own kitchen), an avid reader, and a huge fan of tech startups.

My current role is software engineering manager at OveractDev Technology Partners in St. George, UT. We build custom web applications with pride and craftsmanship.

On Approaches and Manifestos

A list of several approaches and manifestos that I try to practice. Know of another one that I would be interested in? Send me a link!

Git Workflow and this one, too.

Getting Things Done

It’s All in { Jira | Tracker | Rally | etc }…Anywhere but Email!

five.sentenc.es

Agile Manifesto

Software Craftsmanship Manifesto

To compound this, it turns out that estimation is fractal. The more fine-grained you break down the requirements, the more “edges” you will discover. This means that the more detailed you estimate, the more the total will tend towards infinity, simply due to rounding errors and the fear factors that we multiply into fine grained estimates. — Dan North