lib/kpm/nexus_helper/actions.rb in kpm-0.9.0 vs lib/kpm/nexus_helper/actions.rb in kpm-0.10.0
- old
+ new
@@ -1,9 +1,10 @@
# frozen_string_literal: true
require_relative 'nexus_api_calls_v2'
require_relative 'github_api_calls'
+require_relative 'cloudsmith_api_calls'
module KPM
module NexusFacade
class Actions
DEFAULT_RETRIES = 3
@@ -27,10 +28,16 @@
overrides[:url] ||= 'https://oss.sonatype.org'
overrides[:repository] ||= 'releases'
@logger = 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)
+ @nexus_api_call = if overrides[:url].start_with?('https://maven.pkg.github.com')
+ GithubApiCalls.new(overrides, ssl_verify, logger)
+ elsif overrides[:url].start_with?('https://dl.cloudsmith.io')
+ CloudsmithApiCalls.new(overrides, ssl_verify, logger)
+ else
+ NexusApiCallsV2.new(overrides, ssl_verify, logger)
+ end
end
def pull_artifact(coordinates, destination = nil)
retry_exceptions("pull_artifact #{coordinates}") { nexus_api_call.pull_artifact(coordinates, destination) }
end