Sha256: c5194014c9807281e8e12a67d48ef919373c028aba560a43c591df1ad92601d8

Contents?: true

Size: 1.14 KB

Versions: 6

Compression:

Stored size: 1.14 KB

Contents

module Forger
  class Script
    autoload :Compile, "forger/script/compile"
    autoload :Compress, "forger/script/compress"
    autoload :Upload, "forger/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 = 'us-east-1' if ENV['TEST']
      @region ||= `aws configure get region`.strip rescue 'us-east-1'
      load_template("ami_creation.sh")
    end

    def extract_forger_scripts
      load_template("extract_forger_scripts.sh")
    end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
forger-2.0.5 lib/forger/script.rb
forger-2.0.4 lib/forger/script.rb
forger-2.0.3 lib/forger/script.rb
forger-2.0.2 lib/forger/script.rb
forger-2.0.1 lib/forger/script.rb
forger-2.0.0 lib/forger/script.rb