Sha256: 3268ef3fa1f5196961a060a1ec63820ded2ab0deecba7ee0268b78fbb08ae297

Contents?: true

Size: 815 Bytes

Versions: 35

Compression:

Stored size: 815 Bytes

Contents

class KuberKit::ServiceDeployer::Deployer
  StrategyNotFoundError = Class.new(KuberKit::NotFoundError)

  include KuberKit::Import[
    "core.service_store",
  ]

  def register_strategy(strategy_name, strategy)
    @@strategies ||= {}

    if !strategy.is_a?(KuberKit::ServiceDeployer::Strategies::Abstract)
      raise ArgumentError.new("should be an instance of KuberKit::ServiceDeployer::Strategies::Abstract, got: #{strategy.inspect}")
    end

    @@strategies[strategy_name] = strategy
  end

  Contract KuberKit::Shell::AbstractShell, KuberKit::Core::Service, Symbol => Any
  def deploy(shell, service, strategy_name)
    deployer = @@strategies[strategy_name]

    raise StrategyNotFoundError, "Can't find strategy with name #{strategy_name}" if deployer.nil?

    deployer.deploy(shell, service)
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
kuber_kit-1.3.8 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.3.7 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.1.8 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.3.6 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.1.7 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.3.5 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.3.4 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.1.6 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.3.3 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.3.2 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.1.5 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.3.1 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.3.0 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.1.4 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.2.7 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.2.6 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.2.5 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.2.4 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.2.2 lib/kuber_kit/service_deployer/deployer.rb
kuber_kit-1.1.2 lib/kuber_kit/service_deployer/deployer.rb