lib/kpm/nexus_helper/actions.rb in kpm-0.8.2 vs lib/kpm/nexus_helper/actions.rb in kpm-0.9.0
- old
+ new
@@ -1,9 +1,9 @@
# frozen_string_literal: true
require_relative 'nexus_api_calls_v2'
-# require_relative 'nexus_api_calls_v3'
+require_relative 'github_api_calls'
module KPM
module NexusFacade
class Actions
DEFAULT_RETRIES = 3
@@ -27,13 +27,10 @@
overrides[:url] ||= 'https://oss.sonatype.org'
overrides[:repository] ||= 'releases'
@logger = logger
- # this is where the version is verified
- # example if
- # @nexus_api_call = overrides['version'] == '3' ? NexusApiCallsV3.new(overrides, ssl_verify) : NexusApiCallsV2.new(overrides, ssl_verify)
- @nexus_api_call = NexusApiCallsV2.new(overrides, ssl_verify, logger)
+ @nexus_api_call = overrides[:url].start_with?('https://maven.pkg.github.com') ? GithubApiCalls.new(overrides, ssl_verify, logger) : NexusApiCallsV2.new(overrides, ssl_verify, logger)
end
def pull_artifact(coordinates, destination = nil)
retry_exceptions("pull_artifact #{coordinates}") { nexus_api_call.pull_artifact(coordinates, destination) }
end