Commit e9d7b6cd authored by Douwe Maan's avatar Douwe Maan

Link Gemfile git URLs

parent 02650d97
......@@ -16,6 +16,9 @@ module Gitlab
"https://github.com/#{name}"
end
# Link `git: "https://gitlab.example.com/user/repo"` to https://gitlab.example.com/user/repo
link_regex(%r{(git:|:git\s*=>)\s*['"](?<name>https?://[^'"]+)['"]}) { |url| url }
# Link `source "https://rubygems.org"` to https://rubygems.org
link_method_call("source", %r{https?://[^'"]+}) { |url| url }
end
......
......@@ -30,7 +30,7 @@ describe Gitlab::DependencyLinker::GemfileLinker, lib: true do
# Specify a sprockets version due to increased performance
# See https://gitlab.com/gitlab-org/gitlab-ce/issues/6069
gem 'sprockets', '~> 3.6.0'
gem 'sprockets', '~> 3.6.0', git: 'https://gitlab.example.com/gems/sprockets'
# Default values for AR models
gem 'default_value_for', '~> 3.0.0'
......@@ -59,5 +59,9 @@ describe Gitlab::DependencyLinker::GemfileLinker, lib: true do
expect(subject).to include(link('rails/rails', 'https://github.com/rails/rails'))
expect(subject).to include(link('rails/responders', 'https://github.com/rails/responders'))
end
it 'links Git repos' do
expect(subject).to include(link('https://gitlab.example.com/gems/sprockets', 'https://gitlab.example.com/gems/sprockets'))
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment