diff options
author | Jamie Gaskins <jgaskins@gmail.com> | 2012-06-03 05:33:37 +0800 |
---|---|---|
committer | Jamie Gaskins <jgaskins@gmail.com> | 2012-06-03 05:51:13 +0800 |
commit | a3a3efabc00253be86beb3024600bc66d75c81e4 (patch) | |
tree | 1e62c606a059fb7d8f8cbdd3f02b3512fb1dab60 | |
parent | 14a0648e597058998dc22d4c8bad559c1e1d498d (diff) | |
download | bundler-a3a3efabc00253be86beb3024600bc66d75c81e4.tar.gz |
Add :gist option for gems embedded in gists
-rw-r--r-- | lib/bundler/dsl.rb | 6 | ||||
-rw-r--r-- | spec/bundler/dsl_spec.rb | 12 |
2 files changed, 17 insertions, 1 deletions
diff --git a/lib/bundler/dsl.rb b/lib/bundler/dsl.rb index f54b0d9ef8..eaaab4c984 100644 --- a/lib/bundler/dsl.rb +++ b/lib/bundler/dsl.rb @@ -200,7 +200,7 @@ module Bundler def _normalize_options(name, version, opts) _normalize_hash(opts) - valid_keys = %w(group groups git github path name branch ref tag require submodules platform platforms type) + valid_keys = %w(group groups git gist github path name branch ref tag require submodules platform platforms type) invalid_keys = opts.keys - valid_keys if invalid_keys.any? plural = invalid_keys.size > 1 @@ -234,6 +234,10 @@ module Bundler opts["git"] = "git://github.com/#{github}.git" end + if gist = opts.delete("gist") + opts["git"] = "git://gist.github.com/#{gist}.git" + end + ["git", "path"].each do |type| if param = opts[type] if version.first && version.first =~ /^\s*=?\s*(\d[^\s]*)\s*$/ diff --git a/spec/bundler/dsl_spec.rb b/spec/bundler/dsl_spec.rb index 2bc0e40696..392657dd31 100644 --- a/spec/bundler/dsl_spec.rb +++ b/spec/bundler/dsl_spec.rb @@ -13,6 +13,18 @@ describe Bundler::Dsl do subject.dependencies.first.source.uri.should == github_uri end + it "should convert numeric :gist to :git" do + subject.gem("not-really-a-gem", :gist => 2859988) + github_uri = "git://gist.github.com/2859988.git" + subject.dependencies.first.source.uri.should == github_uri + end + + it "should convert :gist to :git" do + subject.gem("not-really-a-gem", :gist => "2859988") + github_uri = "git://gist.github.com/2859988.git" + subject.dependencies.first.source.uri.should == github_uri + end + it "should convert 'rails' to 'rails/rails'" do subject.gem("rails", :github => "rails") github_uri = "git://github.com/rails/rails.git" |