Switch to a Commander base to allow lazy loading config

This commit is contained in:
David Heinemeier Hansson
2023-01-12 14:58:17 +01:00
parent d3ab10be22
commit 4aa96d6578
10 changed files with 93 additions and 68 deletions

View File

@@ -1,7 +1,5 @@
require_relative "setup"
prune = Mrsk::Commands::Prune.new(MRSK_CONFIG)
namespace :mrsk do
desc "Prune unused images and stopped containers"
task prune: %w[ prune:containers prune:images ]
@@ -9,12 +7,12 @@ namespace :mrsk do
namespace :prune do
desc "Prune unused images older than 30 days"
task :images do
on(MRSK_CONFIG.hosts) { verbosity(:debug) { execute *prune.images } }
on(MRSK.config.hosts) { MRSK.verbosity(:debug) { execute *MRSK.prune.images } }
end
desc "Prune stopped containers for the service older than 3 days"
task :containers do
on(MRSK_CONFIG.hosts) { verbosity(:debug) { execute *prune.containers } }
on(MRSK.config.hosts) { MRSK.verbosity(:debug) { execute *MRSK.prune.containers } }
end
end
end