Sha256: 39941465fac15ae0d8271f563ef7f7d368db0748f3cce1c283228cb548d7e9c5

Contents?: true

Size: 674 Bytes

Versions: 1

Compression:

Stored size: 674 Bytes

Contents

require 'fileutils'

module AwsEc2
  class CompileScripts
    include TemplateHelper
    BUILD_ROOT = "tmp"

    def initialize(options)
      @options = options
    end

    def compile
      puts "Compiling app/scripts to..."
      clean
      Dir.glob("#{AwsEc2.root}/app/scripts/**/*").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
      puts "Compiled app/scripts."
    end

    def clean
      FileUtils.rm_rf(BUILD_ROOT)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aws-ec2-0.4.0 lib/aws_ec2/compile_scripts.rb