Socket
Book a DemoInstallSign in
Socket

bundler-github

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bundler-github

0.2.0
bundlerRubygems
Version published
Maintainers
1
Created
Source

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 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 expands and swaps the :github option out for :git, other options, like :branch, :ref, etc. will be left untouched.
  • 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 © 2011 Jason L Perry. See MIT-LICENSE for the rights reserved.

FAQs

Package last updated on 02 Aug 2011

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.