Sha256: 1333ebfb514d581f58fd52109aea9b8129165850b7f1017695b9ebcf7e48e321

Contents?: true

Size: 639 Bytes

Versions: 6

Compression:

Stored size: 639 Bytes

Contents

module AwsEc2
  class Script
    def initialize(options={})
      @options = options
    end

    def auto_terminate
      @ami_name = @options[:ami_name]
      load_template("auto_terminate.sh")
    end

    def create_ami
      # set some variables for the template
      @ami_name = @options[:ami_name]
      @region = `aws configure get region`.strip rescue 'us-east-1'
      load_template("ami_creation.sh")
    end

  private
    def load_template(name)
      template = IO.read(File.expand_path("../scripts/#{name}", __FILE__))
      text = ERB.new(template, nil, "-").result(binding)
      "#" * 60 + "\n#{text}"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
aws-ec2-0.7.0 lib/aws_ec2/script.rb
aws-ec2-0.6.0 lib/aws_ec2/script.rb
aws-ec2-0.5.2 lib/aws_ec2/script.rb
aws-ec2-0.5.1 lib/aws_ec2/script.rb
aws-ec2-0.5.0 lib/aws_ec2/script.rb
aws-ec2-0.4.0 lib/aws_ec2/script.rb