Sha256: 2b45baa0ac640372b101602822a6d17b1a4f3dc8bd0489be1abce725337eb706

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

module Beanstalkify
    class Application
        attr_accessor :stack, :config

        # config is an array of hashes:
        #   :namespace, :option_name, :value
        def initialize(stack, cnames, config)
            @stack = stack
            @cnames = cnames.split(',')
            @config = config.map { |c| Hash[c.map { |k, v| [k.to_sym,v]}] }
        end

        # Deploy an archive to an environment. 
        # If the environment doesn't exist, it will be created.
        def deploy!(archive, env)
            archive.upload(Beanstalk.api)
            
            if env.status.empty?
                puts "Creating stack '#{@stack}' for #{archive.app_name}-#{archive.version}..."
                env.create!(archive, @stack, @cnames, @config)
                env.wait!("Launching")
            else
                puts "Deploying #{archive.version} to #{env.name}..."
                env.deploy!(archive, @config)
                env.wait!("Updating")
            end
            puts "Done. Visit http://#{env.url} in your browser."
            DeploymentInfo.new env, archive
        end
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
beanstalkify-0.0.6 lib/beanstalkify/application.rb