As you know, ReProfit Lab is all about showing you how you can also produce measurable results with your work, stand out from your peers and be the most helpful programmer to your team, consulting clients and/or employer.

If you’re anything like the ambitious programmers that I work with at DYR Hackcamp and Hackchella, there’s a good chance you have similar career goals as the highly-skilled, highly-paid professional programmers you admire.

There’s no question you want to accelerate your progress, so that you can…

  • Start freelance-consulting and get paid for your skills and knowledge
  • Get a full-time programming position, locally or remotely
  • Build a micro SaaS app or niche website that could generate enough income to replace your current salary and give you both time and location freedom

Still, it’s taking you longer than you expect – more than one year – to achieve any one of these goals, so that you can finally call yourself a professional programmer.

You don’t have the confidence you desperately need to sell yourself to potential consulting clients or employers, so that you can get paid to use your programming skills and knowledge.

You don’t believe in your own capabilities to build useful web and mobile applications from scratch, without following another step-by-step tutorial that’s outdated and impractical.

You don’t have clarity about what your next steps are…

…and whether you’re good enough to start looking for a full-time programming position, freelance-consulting clients or even start working on your own niche website or micro SaaS product.

So, let’s get you one step closer to your big goal…

If you’d like to start building useful software products that sell, so that you can proudly tell your friends, family and colleagues you’re a professional programmer now…

…this crash course, Create Your First Useful Ruby Gem, will show you that you’re good enough to start approaching potential consulting clients and employers for work, using everything you already know.

And without a blessing from the Pope.

Once you complete this crash course, you’ll have the confidence you desperately need to start selling yourself to potential consulting clients and employers so that you get paid to use your skills and knowledge.

Let’s get started, ambitious programmer…

Context – Automating a Marketing Workflow

The marketing team at StartupYou wants to improve the search engine rankings for their business blog so that they can get free traffic and leads.

Their process starts with a thorough analysis of their competitors’ blogs.

They compile data from several blog posts, so that they can identify patterns, create a better content marketing strategy and produce blog posts that’ll rank in the top 3 spots of Google and other search engines.

The data they collect includes:

  1. The title used for each blog post
  2. The keywords that are targeted in each blog post
  3. The meta description of each blog post
  4. The name of the author of each blog post
  5. The canonical link for each blog post

Right now, the Chief Marketing Officer uses the browser’s “View Source” feature to read the data and then copies them into a spreadsheet.

SEO Research

You’ve been hired as the Chief Technology Officer to create an Open Source Ruby program that automates this workflow.

You must build an Open Source Ruby program, a command-line tool that works on Windows, MacOS and Linux and has 100% test coverage.

The Ruby CLI tool must extract these data from the web, save it into a CSV or TXT file and make the file available to all stakeholders at StartupYou.

As the CTO, you’re allowed to give this brief to new hires as part of their training, so that they can create this Ruby app for the team at StartupYou.

Business Goals

Your primary goal is to free up the CMO’s time so that she can work on advanced marketing strategies that’ll improve StartupYou’s market share by 33.33 percent within one year.

Your secondary goal is keep all stakeholders informed about StartupYou’s content marketing strategy at all times, so that your team can reduce employee turnover by 50 percent within 90 days.

Usage Scenario

Here’s how your Ruby Open Source program, I called mine Spydec, will be used by your Chief Marketing Officer and her team via the command-line.

(Using Spydec in Terminal)
$ sudo gem install spydec
Password:
Successfully installed spydec-0.0.4
Parsing documentation for spydec-0.0.4
Done installing documentation for spydec after 0 seconds
1 gem installed
$ spydec --help

Spydec makes it simple to compile and analyze data about your competitors

    Usage: spydec [options] page_url
  
    -a, --author                Spy on the name of the page author
    -t, --title                 Spy on the title of the page
    -k, --keywords            	Spy on the keywords for the page
    -d, --desc                  Spy on the description of the page
    -c, --canonical            	Spy on the canonical link
        --all                   Spy on every metadata at once
$ spydec -k https://lab.hookops.com/rails-starter-app.html
rails starter app
rails application templates
rails composer alternative
rails boilerplate

You can find a complete video demo for Spydec here, for you and your team.

RSpec Test Cases

I’d like to give you a hand-up because you’re a valuable member of the Kingmakers community. Use the RSpec test cases below so that you can get started today, accelerate your product development and release your Ruby program in record time.

You’ll know you’re moving towards Ruby mastery and you’ve achieved your specific goals for this project once all of the tests are green…green…green.

There are also pending RSpec test cases that you must implement before writing the methods that’ll make all of them pass.

(Use these to test the Ruby library itself)
# ../spec/spydec_spec.rb
require 'spec_helper'
  describe Spydec do
   it 'has a version number' do
    expect(Spydec::VERSION).not_to be nil
  end

   it 'instantiates a website class' do
    expect(Spydec::Website).to be_a(Class)
   end
  end
(Use these to test each method of your library)
#../spec/spydec/website_spec.rb
require 'spec_helper'
module Spydec
  describe Website do
    before do
      @com_page =
      Spydec::Website.new("https://lab.hookops.com/")
    end
    
  describe "#author" do
    it "returns the page author’s name" do
      expect(@com_page.author).to eql("Raymond Cudjoe")
    end
  end

  
  describe "#title" do
    it "returns the title of the page" do
      expect(@com_page.title).to include("ReProfit Lab")
   end
  end
    
  describe "#keywords" do
    it "returns an array of keywords for the page" do
      expect(@com_page.keywords).to be_a(Array)
    end
  end
    
  
  describe "#desc" do
    it "returns the meta description of the page" do
      expect(@com_page.desc).to 
      include("Let's make your micro SaaS app eat
               competitors' launch.")
    end
  end
    
  describe "#canonical" do
    it "returns the canonical link for the page" do
      expect(@com_page.canonical).to
      eql("http://lab.hookops.com/")
     end
  end

  describe "#all" do
    it "returns an array of every metadata" do
      expect(@com_page.all).to be_a(Array)
    end
      
    it "contains 5 elements" do
      expect(@com_page.all.count).to eql(5)
    end
      
    it "includes the title of the page" do
      expect(@com_page.all).to include(@com_page.title)
    end
      
    it "includes the canonical link of the page" do
      expect(@com_page.all).to   
      include(@com_page.canonical)
    end
      
    it "includes the description of the page" do
      expect(@com_page.all).to include(@com_page.desc)
    end
      
    it "includes the page author's name" do
      expect(@com_page.all).to include(@com_page.author)
    end
      
    it "includes the target keywords for the page" do
      expect(@com_page.all).to
        include(@com_page.keywords)
    end
  end
    
  describe "#save_data" do
    it "creates a new CSV file or uses an existing one"
    it "adds a new row of metadata to CSV file"
  end
  
    it "returns data from any password-free site"
    end
  end

Remember, you can always get help and ask for feedback on your work from your fellow Kingmakers in the comments section below.

Libraries and Tools

Here are the Ruby libraries I recommend you use during this training to simplify the process of getting the support and accountability you need.

Once you complete this training, you can go ahead and experiment with all the other libraries available for implementing similar functionalities.

You should also use only the latest version of each recommended library.

Bundler provides a consistent environment for Ruby projects by tracking and installing the exact gems and versions that are needed. Bundler is an exit from dependency hell, and ensures that the gems you need are present in development, staging, and production.

You can also use bundler for developing your own gems easily, because it provides a way to automate repetitive work based on conventions, configuration and templates.

OptionParser is a Ruby class for command-line option analysis. Some features of the OptionParser class includes the ability to write the argument specification and the code to handle it in the same place.

It prints out an option summary, so you don’t need to maintain a separate summary string in order to provide helpful messages to your users.

Also, optional and mandatory arguments are specified very gracefully.

Additionally, when you use option parser, arguments can be automatically converted to a specified class and can be restricted to a certain set.

RSpec is a popular Behaviour-Driven Development (BDD) tool amongst Ruby programmers. RSpec helps you focus on the documentation and design aspects of Test-Driven Development (TDD).

Nokogiri is an open source library used for parsing and extracting data from HTML and XML documents in Ruby. It’s used as a dependency in Mechanize, a library that’s used for automating interactions with website, such as filling out and submitting forms, following links and redirects.

That should give you a good idea of what could be done using Nokogiri.

Your Ideal Next Step

You’ll know it’s time to move to the next step in your Ruby and Rails development career (ie, create Ruby API libraries) once all of the RSpec test cases I’ve included in this project brief are passing.

You’ll finally confirm that you’re familiar with packaging Ruby programs for distribution and that you can apply them on your next Ruby project.

If you really want to ReProfit from your hard work, don’t forget to publish your Open Source Ruby program to Rubygems and showcase your source code on GitHub.

You should also publish a blog post that walks readers through your implementation of this program and share that with the Ruby community, friends and colleagues.

You can also share a link to your blog post in the comments sections below.