Sha256: 727b568da881b0fe0fe780e65a1b4cd2409b7bb9b329adf2bcf395ed2ba68ff8

Contents?: true

Size: 734 Bytes

Versions: 6

Compression:

Stored size: 734 Bytes

Contents

module AwsEc2
  class Script
    autoload :Compile, "aws_ec2/script/compile"
    autoload :Upload, "aws_ec2/script/upload"

    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.9.0 lib/aws_ec2/script.rb
aws-ec2-0.8.4 lib/aws_ec2/script.rb
aws-ec2-0.8.3 lib/aws_ec2/script.rb
aws-ec2-0.8.2 lib/aws_ec2/script.rb
aws-ec2-0.8.1 lib/aws_ec2/script.rb
aws-ec2-0.8.0 lib/aws_ec2/script.rb