Skip to content

Instantly share code, notes, and snippets.

@slowjud
Created April 24, 2014 06:34
Show Gist options
  • Save slowjud/11243763 to your computer and use it in GitHub Desktop.
Save slowjud/11243763 to your computer and use it in GitHub Desktop.
An empty ruby gem
$:.push File.expand_path("../lib", __FILE__)
# Maintain your gem's version:
require "foobar/version"
# Describe your gem and declare its dependencies:
Gem::Specification.new do |s|
s.name = "foobar"
s.version = Foobar::VERSION
s.authors = ["Foo", "Bar"]
s.email = ["you@foobar.com"]
s.homepage = "http://www.foobar.com"
s.summary = "I make FOOBAR"
s.description = "I make FOOBAR"
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
s.add_dependency "rails", '~> 3.2'
s.add_dependency "multi_json"
s.add_development_dependency 'pry'
s.add_development_dependency 'rspec'
s.add_development_dependency 'webmock'
end
# Path: lib/foobar.rb
require "foobar/version"
module Foobar
class << self
attr_accessor :configuration
end
def self.configure
self.configuration ||= Configuration.new
yield(configuration)
end
class Configuration
attr_accessor :base_uri
def initialize
@base_uri = 'http://example.com'
end
end
end
source "https://rubygems.org"
# Declare your gem's dependencies in service_qualification.gemspec.
# Bundler will treat runtime dependencies like base dependencies, and
# development dependencies will be added by default to the :development group.
gemspec
# Declare any dependencies that are still in development here instead of in
# your gemspec. These might include edge Rails or gems from your path or
# Git. Remember to move these dependencies to your gemspec before releasing
# your gem to rubygems.org.
# To use debugger
# gem 'debugger'
begin
require 'bundler/setup'
rescue LoadError
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
end
require 'rdoc/task'
RDoc::Task.new(:rdoc) do |rdoc|
rdoc.rdoc_dir = 'rdoc'
rdoc.title = 'foobar'
rdoc.options << '--line-numbers'
rdoc.rdoc_files.include('README.rdoc')
rdoc.rdoc_files.include('lib/**/*.rb')
end
Bundler::GemHelper.install_tasks
# Path: lib/foobar/version.rb
module Foobar
VERSION = "1.0.0"
API_VERSION = '1'
API_ACCEPT_HEADER = "application/vnd.foobar.v#{API_VERSION}"
end
@lbain
Copy link

lbain commented Apr 29, 2014

Could be a full (public?) repo that you can just clone to get going. Then you wouldn't need to include the "Path" comments - everything would be in the right place already.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment