2021-03-24 08:09:32 -04:00
|
|
|
# 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
|
2021-05-11 11:10:20 -04:00
|
|
|
.installable
|
2021-03-24 08:09:32 -04:00
|
|
|
.with_name(@module_name)
|
|
|
|
.with_version(@module_version)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|