Sha256: fc7c2cc626c1eba4dc65039bf679e42fb674881f8033f307b55702791e91ddd3

Contents?: true

Size: 1.49 KB

Versions: 7

Compression:

Stored size: 1.49 KB

Contents

require 'stackster'
require 'simple_deploy/stack/stack_reader'
require 'simple_deploy/stack/stack_lister'

module SimpleDeploy
  class Stack

    def initialize(args)
      @environment = args[:environment]
      @name = args[:name]
      @config = Config.new
    end

    def self.list(args)
      StackLister.new(:config => args[:config]).all
    end

    def create(args)
      stack.create :attributes => args[:attributes],
                   :template => args[:template]
    end

    def update(args)
      stack.update :attributes => args[:attributes]
    end

    def deploy
      deployment = Deployment.new :config => @config,
                                  :environment => @environment,
                                  :instances => instances,
                                  :attributes => attributes
      deployment.execute
    end

    def destroy
      stack.destroy
    end

    def events
      stack.events
    end

    def outputs
      stack.outputs
    end

    def resources
      stack.resources
    end

    def instances
      stack.instances_public_ip_addresses
    end

    def status
      stack.status
    end

    def attributes
      stack.attributes 
    end

    def template
      JSON.parse stack.template
    end
    
    private

    def stack
      @stack ||= Stackster::Stack.new :environment => @environment,
                                      :name        => @name,
                                      :config      => @config.environment(@environment)
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
simple_deploy-0.2.1 lib/simple_deploy/stack.rb
simple_deploy-0.2.0 lib/simple_deploy/stack.rb
simple_deploy-0.1.2 lib/simple_deploy/stack.rb
simple_deploy-0.1.1 lib/simple_deploy/stack.rb
simple_deploy-0.1.0 lib/simple_deploy/stack.rb
simple_deploy-0.0.3 lib/simple_deploy/stack.rb
simple_deploy-0.0.2 lib/simple_deploy/stack.rb