Use rucksack to embed known runtimes in the binary
This commit is contained in:
parent
50ac476437
commit
2df4e01d45
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,3 +5,5 @@
|
|||||||
tmp/
|
tmp/
|
||||||
export/
|
export/
|
||||||
secrets/
|
secrets/
|
||||||
|
.rucksack
|
||||||
|
.rucksack.toc
|
||||||
|
@ -40,11 +40,11 @@ shards:
|
|||||||
git: https://github.com/kemalcr/kemal.git
|
git: https://github.com/kemalcr/kemal.git
|
||||||
version: 1.5.0
|
version: 1.5.0
|
||||||
|
|
||||||
kemal-basic-auth:
|
|
||||||
git: https://github.com/kemalcr/kemal-basic-auth.git
|
|
||||||
version: 1.0.0
|
|
||||||
|
|
||||||
radix:
|
radix:
|
||||||
git: https://github.com/luislavena/radix.git
|
git: https://github.com/luislavena/radix.git
|
||||||
version: 0.4.1
|
version: 0.4.1
|
||||||
|
|
||||||
|
rucksack:
|
||||||
|
git: https://github.com/busyloop/rucksack.git
|
||||||
|
version: 2.0.0
|
||||||
|
|
||||||
|
@ -28,3 +28,8 @@ dependencies:
|
|||||||
branch: add_exposed_ports
|
branch: add_exposed_ports
|
||||||
kemal:
|
kemal:
|
||||||
github: kemalcr/kemal
|
github: kemalcr/kemal
|
||||||
|
rucksack:
|
||||||
|
github: busyloop/rucksack
|
||||||
|
|
||||||
|
scripts:
|
||||||
|
postinstall: cat .rucksack >> bin/faaso
|
@ -1,12 +1,26 @@
|
|||||||
|
require "rucksack"
|
||||||
|
|
||||||
module Faaso
|
module Faaso
|
||||||
module Commands
|
module Commands
|
||||||
# Creates a new empty funko out of a given runtime
|
# Creates a new empty funko out of a given runtime
|
||||||
struct New
|
struct New
|
||||||
|
@@known : Array(String) = {{`find ./runtimes -type d -mindepth 1`.split('\n').reject(&.empty?)}}
|
||||||
|
|
||||||
def run(options, folder)
|
def run(options, folder)
|
||||||
if options["RUNTIME"].as(String) == "list"
|
if options["-r"].as(String) == "list"
|
||||||
Log.info {"Known runtimes:"}
|
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
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Embed runtimes in the binary using rucksack
|
||||||
|
{% for name in `find ./runtimes -type f`.split('\n') %}
|
||||||
|
rucksack({{name}})
|
||||||
|
{% end %}
|
||||||
|
20
src/main.cr
20
src/main.cr
@ -46,12 +46,12 @@ doc = <<-DOC
|
|||||||
FaaSO CLI tool.
|
FaaSO CLI tool.
|
||||||
|
|
||||||
Usage:
|
Usage:
|
||||||
faaso build FOLDER ... [-v=<level>] [-l]
|
faaso build FOLDER ... [-v <level>] [-l]
|
||||||
faaso export SOURCE DESTINATION [-v=<level>]
|
faaso export SOURCE DESTINATION [-v <level>]
|
||||||
faaso new -r <RUNTIME> FOLDER [-v=<level>]
|
faaso new -r runtime FOLDER [-v <level>]
|
||||||
faaso scale FUNKO [SCALE] [-v=<level>] [-l]
|
faaso scale FUNKO [SCALE] [-v <level>] [-l]
|
||||||
faaso secret [-d|-a] FUNKO SECRET [-v=<level>] [-l]
|
faaso secret (-d|-a) FUNKO SECRET [-v <level>] [-l]
|
||||||
faaso status FUNKO [-v=<level>] [-l]
|
faaso status FUNKO [-v <level>] [-l]
|
||||||
faaso version
|
faaso version
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
@ -59,8 +59,8 @@ Options:
|
|||||||
-d --delete Delete
|
-d --delete Delete
|
||||||
-h --help Show this screen
|
-h --help Show this screen
|
||||||
-l --local Run commands locally instead of against a FaaSO server
|
-l --local Run commands locally instead of against a FaaSO server
|
||||||
-r --runtime Runtime for the new funko (use -r list for examples)
|
-r runtime Runtime for the new funko (use -r list for examples)
|
||||||
-v=level Control the logging verbosity, 0 to 5 [default: 3]
|
-v level Control the logging verbosity, 0 to 5 [default: 3]
|
||||||
DOC
|
DOC
|
||||||
|
|
||||||
ans = Docopt.docopt(doc, ARGV)
|
ans = Docopt.docopt(doc, ARGV)
|
||||||
@ -72,8 +72,8 @@ when .fetch("build", false)
|
|||||||
Faaso::Commands::Build.new.run(ans, ans["FOLDER"].as(Array(String)))
|
Faaso::Commands::Build.new.run(ans, ans["FOLDER"].as(Array(String)))
|
||||||
when .fetch("export", false)
|
when .fetch("export", false)
|
||||||
Faaso::Commands::Export.new.run(ans, ans["SOURCE"].as(String), ans["DESTINATION"].as(String))
|
Faaso::Commands::Export.new.run(ans, ans["SOURCE"].as(String), ans["DESTINATION"].as(String))
|
||||||
# when .fetch("new", false)
|
when .fetch("new", false)
|
||||||
# Faaso::Commands::New.new.run(ans, ans["FOLDER"].as(String))
|
Faaso::Commands::New.new.run(ans, ans["FOLDER"].as(Array(String))[0])
|
||||||
when .fetch("scale", false)
|
when .fetch("scale", false)
|
||||||
Faaso::Commands::Scale.new.run(ans, ans["FUNKO"].as(String), ans["SCALE"])
|
Faaso::Commands::Scale.new.run(ans, ans["FUNKO"].as(String), ans["SCALE"])
|
||||||
when .fetch("secret", false)
|
when .fetch("secret", false)
|
||||||
|
Loading…
Reference in New Issue
Block a user