Method: Jets::Builders::HandlerGenerator#copy_source_as_handler

Defined in:
lib/jets/builders/handler_generator.rb

#copy_source_as_handler(fun) ⇒ Object

app/shared/functions/kevin.py => /tmp/jets/demo/app_root/handlers/shared/functions/kevin.py



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/jets/builders/handler_generator.rb', line 121

def copy_source_as_handler(fun)
  return if fun.internal?

  source_path = fun.source_file
  unless source_path
    attributes = fun.template.values.first
    function_name = attributes['Properties']['FunctionName']
    puts "WARN: missing source file for: '#{function_name}' function".color(:yellow)
    return
  end

  dest_path = "#{tmp_code}/#{fun.handler_dest}"
  FileUtils.mkdir_p(File.dirname(dest_path))
  FileUtils.cp(source_path, dest_path)
end