Update (2018-05-07): My PR to bundler-site has been accepted so the :glob
option can now be found on the official Bundler Docs. 😊
Sometimes projects, such as the Cloud Foundry Copilot service include their Ruby client gems within subdirectories of the main project itself. While under active development, it can be useful to install the gem directly from the Git repository. Bundler makes this pretty easy for gems that have standalone repos, but there is no clear way to include a gem that is nested deep within a repo. Fortunately, the poorly documented glob
parameter can help. 😊
For example, the cf-copilot
gem above can be included in a Gemfile
like this:
# Gemfile
gem 'cf-copilot', git: 'https://github.com/cloudfoundry/copilot.git', branch: 'master', glob: 'sdk/ruby/*.gemspec'
Just give it a glob
path to the gem’s .gemspec
file that is relative to the repository’s root and bundler
will handle the rest!