This repository contains a simple gem with rspec and a native extension.
Add gem to the Gemfile:
# TODO: test on private repository gem 'firstgem', source => 'git://github.com/bdwong/firstgem.git'
Then just bundle install and you're good to go!
Gems installed from github do not show up on the gem list. You can see the gems with:
To make sure things are working properly, you can do this from irb:
require "rubygems" require "bundler/setup" require "firstgem"
Some simple tests
a = Shape.new('triangle') # The ruby part of the gem a.describe => "I am a triangle." b = Calculator.new # The native extension b.Add(2+2) => 4.0
More troubleshooting tips on the Bundler page
Clone the source from Github, then build for development:
$ bundle install # Install prerequisites $ rake compile # Compile extensions if present $ rake spec # run tests, for example.
For local installation, the recommended way is:
$ rake install # Build and install the gem
Or you can do it manually with gem:
$ gem build firstgem.gemspec $ gem install firstgem*.gem
- Using Gemspecs as Intended
- New Gem with Bundler
- Creating and publishing your first rubygem
- Setup rspec to test a gem not rails