Sam Stelfox

Thoughts from a software engineer, systems hacker and Linux gubernāre.

Initial Gem Setup

This is the process I go through when inititially setting up a gem. For this I will be creating a gem named super_g.

# Create the initial super structure
bundle gem super_g -b -t rspec
cd super_g

# Remove the stock / sample tests
rm -f spec/super_g_spec.rb

Make the initial commit:

git add -A
git commit -m "Setup the support structure for the gem"

Create a new repo on github, add the remote locally, and push the code up:

git remote add origin [email protected]:sstelfox/super_g.git
git push origin master

Fixup the Gemspec File

Once complete run bundle to make sure all the dependencies are available.

Configure RSpec

First off fix the RSpec settings file located at .rspec:

--format progress

Next change spec/spec_helper.rb to support coveralls and be a tad bit nicer to rapid testing.

$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))

require 'coveralls'
require 'simplecov'

SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[

require 'super_g'

RSpec.configure do |config|
  config.treat_symbols_as_metadata_keys_with_true_values = true
  config.run_all_when_everything_filtered = true
  config.filter_run :focus
  config.order = 'random'

Configure Travis-CI

The following is my standard Travis-CI config.

language: ruby
  - 1.9.3
  - 2.0.0
  - 2.1.0

Configure YARD

Create a .yardopts file in the root of the projec with the following contents:

lib/**/*.rb - LICENSE.txt

You can test it out by running 'yard' and opening doc/index.html in your browser.

Configure Coveralls

Setting up the service is still a TODO but part of it was done in RSpec already.

Configure CodeClimate

TODO, partially covered by badges in the README

Configure Gemnasium


Setup RubyGems


Write the README

TODO: see belfort project


Available badges and tracking information:

Badges should be added for all the services in use by this project a sample of this might look like:

# TODO: Your gem name

[![Gem Version][GV img]][Gem Version]
[![Build Status][BS img]][Build Status]
[![Dependency Status][DS img]][Dependency Status]
[![Code Climate][CC img]][Code Climate]
[![Coverage Status][CS img]][Coverage Status]

## Description

TODO: Your gem description

[Gem Version]:<gem name>
[Build Status]:<gem name>
[travis pull requests]:<gem name>/pull_requests
[Dependency Status]:<gem name>
[Code Climate]:<gem name>
[Coverage Status]:<gem name>

[GV img]:<gem name>.png
[BS img]:<gem name>.png
[DS img]:<gem name>.png
[CC img]:<gem name>.png
[CS img]:<gem name>/badge.png?branch=master

More info: