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

package_finder.rb « go « packages « finders « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 4573417d11fe38b19927dafc6e62ec04ddb02197 (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
25
26
27
28
29
# frozen_string_literal: true

module Packages
  module Go
    class PackageFinder
      delegate :exists?, to: :candidates

      def initialize(project, module_name, module_version)
        @project = project
        @module_name = module_name
        @module_version = module_version
      end

      def execute
        candidates.first
      end

      private

      def candidates
        @project
          .packages
          .golang
          .with_name(@module_name)
          .with_version(@module_version)
      end
    end
  end
end