Module: StillActive::ArtifactoryClient

Extended by:
ArtifactoryClient
Included in:
ArtifactoryClient
Defined in:
lib/still_active/artifactory_client.rb

Defined Under Namespace

Modules: AqlClient, RubygemsClient

Instance Method Summary collapse

Instance Method Details

#artifactory_uri?(uri) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
16
17
18
19
# File 'lib/still_active/artifactory_client.rb', line 13

def artifactory_uri?(uri)
  # Hostnames are case-insensitive, so downcase before the suffix check; an
  # uppercase jfrog host would otherwise be misread as an unqueryable source.
  uri.is_a?(String) && URI(uri).host&.downcase&.end_with?(".jfrog.io")
rescue URI::InvalidURIError
  false
end

#versions(gem_name:, source_uri:) ⇒ Object



21
22
23
24
25
26
27
28
29
# File 'lib/still_active/artifactory_client.rb', line 21

def versions(gem_name:, source_uri:)
  headers = auth_headers(gem_name: gem_name, source_uri: source_uri)
  vs = RubygemsClient.versions(gem_name: gem_name, source_uri: source_uri, headers: headers)
  return vs unless vs.empty?

  AqlClient.versions(gem_name: gem_name, source_uri: source_uri, headers: headers)
rescue Errno::ECONNRESET, Errno::ECONNREFUSED, Net::OpenTimeout, Net::ReadTimeout, SocketError
  []
end