Skip to content

Commit

Permalink
Expand github paths when no slash is found
Browse files Browse the repository at this point in the history
This matches bundler behavior for github gem dependencies.
  • Loading branch information
drbrain committed Jul 31, 2014
1 parent 708d40b commit d710c08
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/rubygems/request_set/gem_dependency_api.rb
Expand Up @@ -415,6 +415,8 @@ def gem_git name, options # :nodoc:
def gem_github name, options # :nodoc:
return unless path = options.delete(:github)

path = "#{path}/#{path}" unless path.include? "/"

options[:git] = "git://github.com/#{path}.git"

gem_git name, options
Expand Down
13 changes: 13 additions & 0 deletions test/rubygems/test_gem_request_set_gem_dependency_api.rb
Expand Up @@ -151,6 +151,19 @@ def test_gem_github
assert_equal expected, @gda.dependencies
end

def test_gem_github_expand_path
@gda.gem 'a', :github => 'example'

assert_equal [dep('a')], @set.dependencies

assert_equal %w[git://github.com/example/example.git master],
@git_set.repositories['a']

expected = { 'a' => '!' }

assert_equal expected, @gda.dependencies
end

def test_gem_group
@gda.gem 'a', :group => :test

Expand Down

0 comments on commit d710c08

Please sign in to comment.