Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

THIS IS SOME ALPHA LEVEL SHIT

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 bundler-github.gemspec
README.md

bundler-github

Use shorthand instead of full Github repository URIs in your Gemfile.

Oh, yes... syntactic sugars!

Installation

gem install bundler-github

Note: Currently, this gem must always be installed after Bundler. If you update or re-install Bundler, you'll need to re-install this gem. See the caveat below for details.

Usage

In your Gemfile you can now replace:

gem 'recaptcha', git: 'https://github.com/ambethia/recaptcha.git'

with:

gem 'recaptcha', github: 'ambethia/recaptcha'

But wait! That sugar only gets sweeter! If the repository's name is the same as the gem's name (and it usally is), you can leave out the repo name and just include the repository owner.

gem 'recaptcha', github: 'ambethia'

How you like them apples!?

One inconvenience I haven't figured a work around for is that you'll need to explicitly require bundler/github before you require bundler/setup. In a Rails app you might change your boot.rb (oh, the humanity!) from:

require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])

to look like:

if File.exists?(ENV['BUNDLE_GEMFILE'])
  require 'bundler/github'
  require 'bundler/setup'
end

However, you don't need to require bundler-github from your Gemfile, it's already loaded by the time your application's Gemfile is read anyways.

Private Repositories

By default HTTP transport is used, but you can switch to an authenticated url scheme (ssh) by prepending a : to the account name, like:

gem 'has_secrets', github: ':ambethia'

Other notes on usage

  • bundler-github just catches and replaces the :github option with :git after expanding the URI, other options, like :branch, :ref, etc. will be left untouched. Also, any gems that just use :git don't altered either.
  • I may favor the Ruby 1.9 syntaxes in my examples, but the gem does not. It was developed for and tested against 1.8.7 and 1.9.x.

Caveat emptor!

You coveteth my ice cream bar...

I have no idea if this is going to work for you, in your environment. It's beta-quality software, and as such should not be considered production ready.

The only way I could find to hook in and add the :github option was to make my own bundle command which replaces the executable generated by Rubygems in your $PATH. The new command includes our patch then loads Bunder's original bundle command. For a hack, I think it's pretty elegant.

The unique way bundler is used makes it challenging to extend without any kind of plugin API. If you can suggest a better way to hook it without needing to modify the original gem, I'd love to hear it.

Copyright

Copyright © 2011 Jason L Perry. See MIT-LICENSE for the rights reserved.

Something went wrong with that request. Please try again.