Installing a Ruby gem from a Github repository using Chef?

Is there a way to install a Ruby gem from its Github repo (or, more specifically, a fork) instead of from Rubygems?

I tried

  • Failing To Find Chef Community Cookbooks Using Chef 12 On AWS Opsworks
  • how to deploy changes with chef's deploy resource?
  • Git authentication in Chef
  • Vagrant to test chef recipies - but how to deal with private git
  • Chef: should I be checking “syntaxcache” files into version control?
  • Resolve recursive git cookbook dependencies with Berkshelf
  •  gem_package 'some_gem' do
      source 'git://'

    and I get

    Cannot load gem at [git://] in /
    Resource Declaration:
    # In /tmp/vagrant-chef-1/chef-solo-1/cookbooks/some_recipe/recipes/default.rb
     15: gem_package 'some_gem' do
     16:   source 'git://'
     17: end
    Compiled Resource:
    # Declared in /tmp/vagrant-chef-1/chef-solo-1/cookbooks/some_gem/recipes/default.rb:15:in `from_file'
    gem_package("some_gem") do
      provider Chef::Provider::Package::Rubygems
      action :install
      retries 0
      retry_delay 2
      package_name "some_gem"
      source "git://"
      cookbook_name :some_cookbook
      recipe_name "default"

    I also tried the same with the source with the error Illformed requirement [""].

  • Is a commit a branch in itself ? - git
  • Tracking changed files with git without saving changes
  • Git - switching between branches in the middle of work
  • Netbeans ignoring files
  • git: getting current revision only
  • How to REALLY delete a git branch (i.e. remove all of its objects/commits)?
  • 2 Solutions collect form web for “Installing a Ruby gem from a Github repository using Chef?”

    I’m not sure that this is the best way to accomplish the task, but I was able get it done this way:

    # temporarily install gem from fork
    git '/usr/local/src/mosql' do
      repository ''
    execute 'gem build mosql.gemspec' do
      cwd '/usr/local/src/mosql'
    gem_package 'mosql' do
      source '/usr/local/src/mosql/mosql-0.2.0.gem'

    Where mosql was the name of the forked gem that I was installing.

    Caveats here are that the version is put into the .gem file’s name, so I had to know that in advance.

    Quite old question, but you can use

    I don’t maintain it actively, but I’m quite open to new PR

    Git Baby is a git and github fan, let's start git clone.