Skip to content

Instantly share code, notes, and snippets.

@peterc
Last active October 20, 2022 22:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peterc/6077471dd4783c4b476384930d3dc60a to your computer and use it in GitHub Desktop.
Save peterc/6077471dd4783c4b476384930d3dc60a to your computer and use it in GitHub Desktop.
Example of releasing a tiny gem entire on Gist

Hosting a gem in a single GitHub Gist

Let's say you want to make something available as a gem, but it's just too trivial for the rubygems.org repository. GitHub Gists can be accessed via git, so perhaps you could host a Rubygem there? You can!

This gist is an example of a gem I've called 'tinygem'. It has no functionality, but defines a module called Tinygem.

You can use it from any Gemfile like so:

gem 'tinygem', git: 'https://gist.github.com/6077471dd4783c4b476384930d3dc60a.git'

And then the Tinygem module will exist within your app.

source "https://rubygems.org"
gemspec
require "bundler/gem_tasks"
require_relative "tinygem"
Gem::Specification.new do |spec|
spec.name = "tinygem"
spec.version = Tinygem::VERSION
spec.authors = ["Peter Cooper"]
spec.summary = "A demonstration of hosting a gem within a gist"
spec.require_paths = ['.']
spec.files = ['tinygem.rb']
spec.licenses = ['MIT']
# spec.add_dependency "example-gem", "~> 1.0"
end
module Tinygem
VERSION = "0.0.1"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment