Sha256: 51a1a4a0db180f49f764b1eecf2cb431a2703c62247c0a445074289c32a8736a

Contents?: true

Size: 1.1 KB

Versions: 17

Compression:

Stored size: 1.1 KB

Contents

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

    def initialize(options={})
      @options = options
    end

    def add_to_user_data!(user_data)
      user_data
    end

    def auto_terminate_after_timeout
      load_template("auto_terminate_after_timeout.sh")
    end

    def auto_terminate
      # set variables for the template
      @ami_name = @options[:ami_name]
      load_template("auto_terminate.sh")
    end

    def cloudwatch
      load_template("cloudwatch.sh")
    end

    def create_ami
      # set 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

    def extract_aws_ec2_scripts
      load_template("extract_aws_ec2_scripts.sh")
    end

  private
    def load_template(name)
      template = IO.read(File.expand_path("script/templates/#{name}", File.dirname(__FILE__)))
      text = ERB.new(template, nil, "-").result(binding)
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
aws-ec2-1.4.9 lib/aws_ec2/script.rb
aws-ec2-1.4.8 lib/aws_ec2/script.rb
aws-ec2-1.4.7 lib/aws_ec2/script.rb
aws-ec2-1.4.6 lib/aws_ec2/script.rb
aws-ec2-1.4.5 lib/aws_ec2/script.rb
aws-ec2-1.4.4 lib/aws_ec2/script.rb
aws-ec2-1.4.3 lib/aws_ec2/script.rb
aws-ec2-1.4.2 lib/aws_ec2/script.rb
aws-ec2-1.4.1 lib/aws_ec2/script.rb
aws-ec2-1.4.0 lib/aws_ec2/script.rb
aws-ec2-1.3.2 lib/aws_ec2/script.rb
aws-ec2-1.3.1 lib/aws_ec2/script.rb
aws-ec2-1.3.0 lib/aws_ec2/script.rb
aws-ec2-1.2.2 lib/aws_ec2/script.rb
aws-ec2-1.2.1 lib/aws_ec2/script.rb
aws-ec2-1.2.0 lib/aws_ec2/script.rb
aws-ec2-1.1.0 lib/aws_ec2/script.rb