Merge branch 'dm-dependency-linker-file-type' into 'master'
Select dependency linker based on file type See merge request !11357
This commit is contained in:
commit
e2ffb86987
3 changed files with 10 additions and 5 deletions
|
@ -1,8 +1,14 @@
|
|||
module Gitlab
|
||||
module DependencyLinker
|
||||
class BaseLinker
|
||||
def self.link(plain_text, highlighted_text)
|
||||
new(plain_text, highlighted_text).link
|
||||
class_attribute :file_type
|
||||
|
||||
def self.support?(blob_name)
|
||||
Gitlab::FileDetector.type_of(blob_name) == file_type
|
||||
end
|
||||
|
||||
def self.link(*args)
|
||||
new(*args).link
|
||||
end
|
||||
|
||||
attr_accessor :plain_text, :highlighted_text
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
module Gitlab
|
||||
module DependencyLinker
|
||||
class GemfileLinker < BaseLinker
|
||||
def self.support?(blob_name)
|
||||
blob_name == 'Gemfile' || blob_name == 'gems.rb'
|
||||
end
|
||||
self.file_type = :gemfile
|
||||
|
||||
private
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ module Gitlab
|
|||
version: 'version',
|
||||
gitignore: '.gitignore',
|
||||
koding: '.koding.yml',
|
||||
gemfile: /\A(Gemfile|gems\.rb)\z/,
|
||||
gitlab_ci: '.gitlab-ci.yml',
|
||||
avatar: /\Alogo\.(png|jpg|gif)\z/,
|
||||
route_map: 'route-map.yml'
|
||||
|
|
Loading…
Reference in a new issue