Sha256: d78d54fd2434e14dffe6393e4beeb983efab41dea27da6dbbe5358e356dcefb2
Contents?: true
Size: 1.08 KB
Versions: 9
Compression:
Stored size: 1.08 KB
Contents
class KuberKit::ArtifactsSync::ArtifactUpdater StrategyNotFoundError = Class.new(KuberKit::NotFoundError) include KuberKit::Import[ "ui" ] def use_strategy(strategy, artifact_class:) @@strategies ||= {} if !strategy.is_a?(KuberKit::ArtifactsSync::Strategies::Abstract) raise ArgumentError.new("should be an instance of KuberKit::ArtifactsSync::Strategies::Abstract, got: #{strategy.inspect}") end @@strategies[artifact_class] = strategy end def update(shell, artifact) strategy = @@strategies[artifact.class] ui.print_debug "ArtifactUpdater", "Updating artifact #{artifact.name.to_s.green}" raise StrategyNotFoundError, "Can't find strategy for artifact #{artifact}" if strategy.nil? strategy.update(shell, artifact) end def cleanup(shell, artifact) strategy = @@strategies[artifact.class] ui.print_debug "ArtifactUpdater", "Cleaning artifact #{artifact.name.to_s.green}" raise StrategyNotFoundError, "Can't find strategy for artifact #{artifact}" if strategy.nil? strategy.cleanup(shell, artifact) end end
Version data entries
9 entries across 9 versions & 1 rubygems