class AwsEc2::Script::Compile

Public Instance Methods

clean() click to toggle source
# File lib/aws_ec2/script/compile.rb, line 36
def clean
  FileUtils.rm_rf("#{BUILD_ROOT}/app")
end
compile_all() click to toggle source

use in compile cli command

# File lib/aws_ec2/script/compile.rb, line 15
def compile_all
  clean
  compile_folder("scripts")
  layout_path = context.layout_path(@options[:layout])
  compile_folder("user-data", layout_path)
end
compile_folder(folder, layout_path=false) click to toggle source
# File lib/aws_ec2/script/compile.rb, line 22
def compile_folder(folder, layout_path=false)
  puts "Compiling app/#{folder} to tmp/app/#{folder}.".colorize(:green)
  Dir.glob("#{AwsEc2.root}/app/#{folder}/**/*").each do |path|
    next if File.directory?(path)
    next if path.include?("layouts")

    result = RenderMePretty.result(path, layout: layout_path, context: context)
    tmp_path = path.sub(%r{.*/app/}, "#{BUILD_ROOT}/app/")
    puts "  #{tmp_path}" if @options[:verbose]
    FileUtils.mkdir_p(File.dirname(tmp_path))
    IO.write(tmp_path, result)
  end
end
compile_scripts() click to toggle source

used in upload

# File lib/aws_ec2/script/compile.rb, line 9
def compile_scripts
  clean
  compile_folder("scripts")
end