Added funko export functionality
This commit is contained in:
parent
6a678944a0
commit
adb8ce2667
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@
|
|||||||
/.shards/
|
/.shards/
|
||||||
*.dwarf
|
*.dwarf
|
||||||
tmp/
|
tmp/
|
||||||
|
export/
|
||||||
|
25
src/faaso.cr
25
src/faaso.cr
@ -105,6 +105,31 @@ module Faaso
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class Export
|
||||||
|
@arguments : Array(String) = [] of String
|
||||||
|
@options : Commander::Options
|
||||||
|
|
||||||
|
def initialize(options, arguments)
|
||||||
|
@options = options
|
||||||
|
@arguments = arguments
|
||||||
|
end
|
||||||
|
|
||||||
|
def run
|
||||||
|
funkos = Funko.from_paths(@arguments)
|
||||||
|
funkos.each do |funko|
|
||||||
|
# Create temporary build location
|
||||||
|
dst_path = Path.new("export", funko.name)
|
||||||
|
if File.exists? dst_path
|
||||||
|
puts "Error: #{dst_path} already exists, not exporting #{funko.path}"
|
||||||
|
next
|
||||||
|
end
|
||||||
|
puts "Exporting #{funko.path} to #{dst_path}"
|
||||||
|
Dir.mkdir_p(dst_path)
|
||||||
|
funko.prepare_build dst_path
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
class Down
|
class Down
|
||||||
@arguments : Array(String) = [] of String
|
@arguments : Array(String) = [] of String
|
||||||
@options : Commander::Options
|
@options : Commander::Options
|
||||||
|
@ -12,10 +12,10 @@ class Funko
|
|||||||
# if Nil, it has no template whatsoever
|
# if Nil, it has no template whatsoever
|
||||||
property runtime : (String | Nil)? = nil
|
property runtime : (String | Nil)? = nil
|
||||||
|
|
||||||
# Extra packages shipped with the Docker image
|
# Extra operating system packages shipped with the runtime's Docker image
|
||||||
property ship_packages : Array(String) = [] of String
|
property ship_packages : Array(String) = [] of String
|
||||||
|
|
||||||
# Extra packages used only in the *build* image
|
# Extra operating system packages used only when *building* the funko
|
||||||
property devel_packages : Array(String) = [] of String
|
property devel_packages : Array(String) = [] of String
|
||||||
|
|
||||||
# Where this is located in the filesystem
|
# Where this is located in the filesystem
|
||||||
|
13
src/main.cr
13
src/main.cr
@ -34,12 +34,21 @@ cli = Commander::Command.new do |cmd|
|
|||||||
|
|
||||||
cmd.commands.add do |command|
|
cmd.commands.add do |command|
|
||||||
command.use = "down"
|
command.use = "down"
|
||||||
command.short = "Stop a function"
|
command.short = "Stop a funko"
|
||||||
command.long = "Stop a function in a container"
|
command.long = "Stop a funko in a container"
|
||||||
command.run do |options, arguments|
|
command.run do |options, arguments|
|
||||||
Faaso::Commands::Down.new(options, arguments).run
|
Faaso::Commands::Down.new(options, arguments).run
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
cmd.commands.add do |command|
|
||||||
|
command.use = "export"
|
||||||
|
command.short = "Export a funko to a directory"
|
||||||
|
command.long = "Exports a funko as a self-contained directory."
|
||||||
|
command.run do |options, arguments|
|
||||||
|
Faaso::Commands::Export.new(options, arguments).run
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
Commander.run(cli, ARGV)
|
Commander.run(cli, ARGV)
|
||||||
|
Loading…
Reference in New Issue
Block a user