Welcome to mirror list, hosted at ThFree Co, Russian Federation.

parsers.rb « ci « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: a44105d53c2f5585e6324166078f39ec795c4706 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true

module Gitlab
  module Ci
    module Parsers
      prepend_if_ee('::EE::Gitlab::Ci::Parsers') # rubocop: disable Cop/InjectEnterpriseEditionModule

      ParserNotFoundError = Class.new(ParserError)

      def self.parsers
        {
          junit: ::Gitlab::Ci::Parsers::Test::Junit,
          cobertura: ::Gitlab::Ci::Parsers::Coverage::Cobertura
        }
      end

      def self.fabricate!(file_type)
        parsers.fetch(file_type.to_sym).new
      rescue KeyError
        raise ParserNotFoundError, "Cannot find any parser matching file type '#{file_type}'"
      end
    end
  end
end