Compare commits
No commits in common. "2df4e01d45a6ef9656da9adc31b0a95e32655227" and "ff454de0fdb50a7b3837ecf233b313aa48b9fd2e" have entirely different histories.
2df4e01d45
...
ff454de0fd
2
.gitignore
vendored
2
.gitignore
vendored
@ -5,5 +5,3 @@
|
||||
tmp/
|
||||
export/
|
||||
secrets/
|
||||
.rucksack
|
||||
.rucksack.toc
|
||||
|
@ -40,11 +40,11 @@ shards:
|
||||
git: https://github.com/kemalcr/kemal.git
|
||||
version: 1.5.0
|
||||
|
||||
kemal-basic-auth:
|
||||
git: https://github.com/kemalcr/kemal-basic-auth.git
|
||||
version: 1.0.0
|
||||
|
||||
radix:
|
||||
git: https://github.com/luislavena/radix.git
|
||||
version: 0.4.1
|
||||
|
||||
rucksack:
|
||||
git: https://github.com/busyloop/rucksack.git
|
||||
version: 2.0.0
|
||||
|
||||
|
@ -28,8 +28,3 @@ dependencies:
|
||||
branch: add_exposed_ports
|
||||
kemal:
|
||||
github: kemalcr/kemal
|
||||
rucksack:
|
||||
github: busyloop/rucksack
|
||||
|
||||
scripts:
|
||||
postinstall: cat .rucksack >> bin/faaso
|
@ -1,26 +0,0 @@
|
||||
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["-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 %}
|
@ -1,6 +1,5 @@
|
||||
require "./commands/build.cr"
|
||||
require "./commands/export.cr"
|
||||
require "./commands/new.cr"
|
||||
require "./commands/scale.cr"
|
||||
require "./commands/secret.cr"
|
||||
require "./commands/status.cr"
|
||||
|
55
src/main.cr
55
src/main.cr
@ -18,26 +18,17 @@ struct LogFormat < Log::StaticFormatter
|
||||
end
|
||||
|
||||
def self.setup(verbosity)
|
||||
Colorize.on_tty_only!
|
||||
if verbosity < 3
|
||||
_verbosity = [
|
||||
Log::Severity::Fatal,
|
||||
Log::Severity::Error,
|
||||
Log::Severity::Warn,
|
||||
][[verbosity, 2].min]
|
||||
Log.setup(
|
||||
_verbosity,
|
||||
Log::IOBackend.new(io: STDERR, formatter: LogFormat)
|
||||
)
|
||||
end
|
||||
|
||||
_verbosity = [Log::Severity::Info,
|
||||
Log::Severity::Debug,
|
||||
Log::Severity::Trace,
|
||||
][[verbosity - 3, 3].min]
|
||||
_verbosity = [
|
||||
Log::Severity::Fatal,
|
||||
Log::Severity::Error,
|
||||
Log::Severity::Warn,
|
||||
Log::Severity::Info,
|
||||
Log::Severity::Debug,
|
||||
Log::Severity::Trace,
|
||||
][[verbosity, 5].min]
|
||||
Log.setup(
|
||||
_verbosity,
|
||||
Log::IOBackend.new(io: STDOUT, formatter: LogFormat)
|
||||
Log::IOBackend.new(io: STDERR, formatter: LogFormat)
|
||||
)
|
||||
end
|
||||
end
|
||||
@ -46,21 +37,19 @@ doc = <<-DOC
|
||||
FaaSO CLI tool.
|
||||
|
||||
Usage:
|
||||
faaso build FOLDER ... [-v <level>] [-l]
|
||||
faaso export SOURCE DESTINATION [-v <level>]
|
||||
faaso new -r runtime FOLDER [-v <level>]
|
||||
faaso scale FUNKO [SCALE] [-v <level>] [-l]
|
||||
faaso secret (-d|-a) FUNKO SECRET [-v <level>] [-l]
|
||||
faaso status FUNKO [-v <level>] [-l]
|
||||
faaso version
|
||||
faaso build FOLDER ... [-v=<level>] [-l]
|
||||
faaso scale FUNKO [SCALE] [-v=<level>] [-l]
|
||||
faaso status FUNKO [-v=<level>] [-l]
|
||||
faaso export SOURCE DESTINATION [-v=<level>]
|
||||
faaso secret [-d|-a] FUNKO SECRET [-v=<level>] [-l]
|
||||
|
||||
Options:
|
||||
-a --add Add
|
||||
-l --local Run commands locally instead of against a FaaSO server.
|
||||
-h --help Show this screen.
|
||||
-d --delete Delete
|
||||
-h --help Show this screen
|
||||
-l --local Run commands locally instead of against a FaaSO server
|
||||
-r runtime Runtime for the new funko (use -r list for examples)
|
||||
-v level Control the logging verbosity, 0 to 5 [default: 3]
|
||||
-a --add Add
|
||||
--version Show version.
|
||||
-v=level Control the logging verbosity, 0 to 5 [default: 3]
|
||||
DOC
|
||||
|
||||
ans = Docopt.docopt(doc, ARGV)
|
||||
@ -72,12 +61,10 @@ when .fetch("build", false)
|
||||
Faaso::Commands::Build.new.run(ans, ans["FOLDER"].as(Array(String)))
|
||||
when .fetch("export", false)
|
||||
Faaso::Commands::Export.new.run(ans, ans["SOURCE"].as(String), ans["DESTINATION"].as(String))
|
||||
when .fetch("new", false)
|
||||
Faaso::Commands::New.new.run(ans, ans["FOLDER"].as(Array(String))[0])
|
||||
when .fetch("scale", false)
|
||||
Faaso::Commands::Scale.new.run(ans, ans["FUNKO"].as(String), ans["SCALE"])
|
||||
when .fetch("secret", false)
|
||||
Faaso::Commands::Secret.new.run(ans, ans["FUNKO"].as(String), ans["SECRET"].as(String))
|
||||
when .fetch("status", false)
|
||||
Faaso::Commands::Status.new.run(ans, ans["FUNKO"].as(String))
|
||||
when .fetch("secret", false)
|
||||
Faaso::Commands::Secret.new.run(ans, ans["FUNKO"].as(String), ans["SECRET"].as(String))
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user