Sha256: d5ea4edb2400015390fdc2ca156f4b29d221d72197a86d8ae318b7b01517fecf

Contents?: true

Size: 841 Bytes

Versions: 1

Compression:

Stored size: 841 Bytes

Contents

module Ec2Starter
  def self.start(ami_id, service_options, run_options, &block)
    instance = Instance.new(ami_id, service_options, run_options)
    instance.instance_eval(&block)
    ec2_starter = Ec2Starter::Execution.new(instance)
    ec2_starter.start
    return instance
  end

  class Instance
    attr_accessor :service_options, :default_options, :ami_id, :instance_id, :ips, :volumes, :commands

    def initialize(ami_id, service_options, options)
      @ami_id = ami_id.to_s
      @ips = []
      @volumes = []
      @commands = []
      @default_options = {}.merge(options)
      @service_options = {}.merge(service_options)
    end

    def ip(ip_address)
      @ips << ip_address
    end

    def volume(volume_hash)
      @volumes << volume_hash
    end

    def command(command)
      @commands << command
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ec2-starter-0.1.0 lib/ec2-starter/starter.rb