Use rucksack to embed known runtimes in the binary

This commit is contained in:
2024-07-04 23:34:54 -03:00
parent 50ac476437
commit 2df4e01d45
5 changed files with 37 additions and 16 deletions

View File

@@ -1,12 +1,26 @@
require "rucksack"
module Faaso
module Commands
# Creates a new empty funko out of a given runtime
struct New
@@known : Array(String) = {{`find ./runtimes -type d -mindepth 1`.split('\n').reject(&.empty?)}}
def run(options, folder)
if options["RUNTIME"].as(String) == "list"
Log.info {"Known runtimes:"}
if options["-r"].as(String) == "list"
Log.info { "Crystal has some included runtimes:\n" }
@@known.each do |runtime|
Log.info { " * #{Path[runtime].basename}" }
end
Log.info { "\nOr if you have your own, use a folder name" }
return 0
end
end
end
end
end
# Embed runtimes in the binary using rucksack
{% for name in `find ./runtimes -type f`.split('\n') %}
rucksack({{name}})
{% end %}