diff options
author | Gilbert Roulot <groulot@gitlab.com> | 2018-11-05 16:45:36 +0300 |
---|---|---|
committer | Kamil TrzciĆski <ayufan@ayufan.eu> | 2018-12-11 13:39:22 +0300 |
commit | e6226e8cb3d7e79500482ba2cef604133f667381 (patch) | |
tree | acf0f3d0b822f122da9125333f210ccce477c0d0 /lib/gitlab/ci/parsers.rb | |
parent | 85f430cb3cde4ff8c4d24c1b2a426670e38dd44f (diff) |
Generalise test compare service
It adds a base class for CompareTestReportsService
containing common code with CompareLicenseManagementReportsService
which is present in GitLab Enterprise Edition.
Diffstat (limited to 'lib/gitlab/ci/parsers.rb')
-rw-r--r-- | lib/gitlab/ci/parsers.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/gitlab/ci/parsers.rb b/lib/gitlab/ci/parsers.rb new file mode 100644 index 00000000000..eb63e6c8363 --- /dev/null +++ b/lib/gitlab/ci/parsers.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +module Gitlab + module Ci + module Parsers + ParserNotFoundError = Class.new(ParserError) + + def self.parsers + { + junit: ::Gitlab::Ci::Parsers::Test::Junit + } + 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 |