Commit 38d84f83 authored by Douwe Maan's avatar Douwe Maan

Select dependency linker based on file type

parent 040fc991
module Gitlab module Gitlab
module DependencyLinker module DependencyLinker
class BaseLinker class BaseLinker
def self.link(plain_text, highlighted_text) class_attribute :file_type
new(plain_text, highlighted_text).link
def self.support?(blob_name)
Gitlab::FileDetector.type_of(blob_name) == file_type
end
def self.link(*args)
new(*args).link
end end
attr_accessor :plain_text, :highlighted_text attr_accessor :plain_text, :highlighted_text
......
module Gitlab module Gitlab
module DependencyLinker module DependencyLinker
class GemfileLinker < BaseLinker class GemfileLinker < BaseLinker
def self.support?(blob_name) self.file_type = :gemfile
blob_name == 'Gemfile' || blob_name == 'gems.rb'
end
private private
......
...@@ -12,6 +12,7 @@ module Gitlab ...@@ -12,6 +12,7 @@ module Gitlab
version: 'version', version: 'version',
gitignore: '.gitignore', gitignore: '.gitignore',
koding: '.koding.yml', koding: '.koding.yml',
gemfile: /\A(Gemfile|gems\.rb)\z/,
gitlab_ci: '.gitlab-ci.yml', gitlab_ci: '.gitlab-ci.yml',
avatar: /\Alogo\.(png|jpg|gif)\z/, avatar: /\Alogo\.(png|jpg|gif)\z/,
route_map: 'route-map.yml' route_map: 'route-map.yml'
......
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