Sha256: 0e23cf6ca7c0abfeae2b74d6aebd1bbccbd95879c4a39f6e8b7f9880394af8a9

Contents?: true

Size: 834 Bytes

Versions: 36

Compression:

Stored size: 834 Bytes

Contents

class KuberKit::ArtifactsSync::ArtifactUpdater
  ResolverNotFoundError = Class.new(KuberKit::NotFoundError)

  include KuberKit::Import[
    "ui"
  ]

  def use_resolver(artifact_resolver, artifact_class:)
    @@resolvers ||= {}

    if !artifact_resolver.is_a?(KuberKit::ArtifactsSync::AbstractArtifactResolver)
      raise ArgumentError.new("should be an instance of KuberKit::ArtifactsSync::AbstractArtifactResolver, got: #{artifact_resolver.inspect}")
    end

    @@resolvers[artifact_class] = artifact_resolver
  end

  def update(shell, artifact)
    resolver = @@resolvers[artifact.class]

    ui.print_debug "ArtifactUpdater", "Updating artifact #{artifact.name.to_s.green}"
    
    raise ResolverNotFoundError, "Can't find resolver for artifact #{artifact}" if resolver.nil?

    resolver.resolve(shell, artifact)
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
kuber_kit-1.3.2 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-1.1.5 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-1.3.1 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-1.3.0 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-1.1.4 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-1.2.7 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-1.2.6 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-1.2.5 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-1.2.4 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-1.2.2 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-1.1.2 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-1.2.1 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-1.2.0 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-1.1.1 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-1.0.1 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-1.0.0 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-0.9.9 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-0.9.8 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-0.9.7 lib/kuber_kit/artifacts_sync/artifact_updater.rb
kuber_kit-0.9.6 lib/kuber_kit/artifacts_sync/artifact_updater.rb