Sha256: 00c6f3ae483b4b7441dde5c5412fd1136a2f2d396080ff734004f6a5c488b665

Contents?: true

Size: 691 Bytes

Versions: 2

Compression:

Stored size: 691 Bytes

Contents

require 'fileutils'

module AwsEc2
  class Compile < Base
    include TemplateHelper
    BUILD_ROOT = "tmp"

    def compile
      clean
      compile_folder("scripts")
      compile_folder("user-data")
    end

    def compile_folder(folder)
      puts "Compiling app/#{folder}:"
      Dir.glob("#{AwsEc2.root}/app/#{folder}/**/*").each do |path|
        next if File.directory?(path)
        result = erb_result(path)
        tmp_path = path.sub(%r{.*/app/}, "#{BUILD_ROOT}/app/")
        puts "  #{tmp_path}"
        FileUtils.mkdir_p(File.dirname(tmp_path))
        IO.write(tmp_path, result)
      end
    end

    def clean
      FileUtils.rm_rf("#{BUILD_ROOT}/app")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
aws-ec2-0.7.0 lib/aws_ec2/compile.rb
aws-ec2-0.6.0 lib/aws_ec2/compile.rb