BigW Consortium Gitlab

requirements_txt_linker.rb 393 Bytes
Newer Older
1 2 3 4 5 6 7 8
module Gitlab
  module DependencyLinker
    class RequirementsTxtLinker < BaseLinker
      self.file_type = :requirements_txt

      private

      def link_dependencies
9
        link_regex(/^(?<name>(?![a-z+]+:)[^#.-][^ ><=~!;\[]+)/) do |name|
10 11 12 13 14 15 16 17
          "https://pypi.python.org/pypi/#{name}"
        end

        link_regex(%r{^(?<name>https?://[^ ]+)}, &:itself)
      end
    end
  end
end