Initial template and merge code

This commit is contained in:
2024-06-28 16:24:52 -03:00
parent 25da2b2e5b
commit 9fb4d7cd04
10 changed files with 35 additions and 68 deletions

View File

@ -1,4 +1,6 @@
require "commander"
require "file_utils"
require "uuid"
# TODO: Write documentation for `Faaso`
module Faaso
@ -19,7 +21,15 @@ module Faaso
puts "Building function... #{arg}"
# A function is a folder with stuff in it
# TODO: decide template based on file extensions or other metadata
template = "templates/crystal"
# TODO: copy template and add function files to it
tmp_dir = "tmp/#{UUID.random}"
Dir.mkdir_p("tmp") unless File.exists? "tmp"
FileUtils.cp_r(template, tmp_dir)
Dir.glob(arg + "/**/*").each do |file|
FileUtils.cp(file, tmp_dir)
end
# TODO: build Docker image
# TODO: push Docker image to registry
# TODO: return image name for testing