2016-07-10 17:13:06 -04:00
|
|
|
module Gitlab
|
|
|
|
module DependencyLinker
|
|
|
|
LINKERS = [
|
2017-05-16 16:26:31 -04:00
|
|
|
GemfileLinker,
|
|
|
|
GemspecLinker,
|
2017-05-16 16:27:50 -04:00
|
|
|
PackageJsonLinker,
|
2017-05-16 16:28:11 -04:00
|
|
|
ComposerJsonLinker,
|
2017-05-16 16:28:52 -04:00
|
|
|
PodfileLinker,
|
2017-05-16 16:29:13 -04:00
|
|
|
PodspecLinker,
|
2017-05-16 16:29:34 -04:00
|
|
|
PodspecJsonLinker,
|
2017-05-16 16:29:56 -04:00
|
|
|
CartfileLinker,
|
2017-05-16 16:30:18 -04:00
|
|
|
GodepsJsonLinker,
|
2017-05-16 16:30:29 -04:00
|
|
|
RequirementsTxtLinker
|
2016-07-10 17:13:06 -04:00
|
|
|
].freeze
|
|
|
|
|
|
|
|
def self.linker(blob_name)
|
|
|
|
LINKERS.find { |linker| linker.support?(blob_name) }
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.link(blob_name, plain_text, highlighted_text)
|
|
|
|
linker = linker(blob_name)
|
|
|
|
return highlighted_text unless linker
|
|
|
|
|
|
|
|
linker.link(plain_text, highlighted_text)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|