Proper versioning for console and bash

This commit is contained in:
David Heinemeier Hansson
2023-02-03 15:16:40 +01:00
parent 3d71ecdf80
commit a3d998508b

View File

@@ -69,23 +69,19 @@ class Mrsk::Cli::App < Mrsk::Cli::Base
desc "console", "Start Rails Console on primary host (or specific host set by --hosts)" desc "console", "Start Rails Console on primary host (or specific host set by --hosts)"
def console def console
using_version(options[:version] || most_recent_version_available) do say "Get most recent version available as an image...", :magenta unless options[:version]
run_locally do using_version(options[:version] || most_recent_version_available) do |version|
if version say "Launching Rails console of version #{version} on #{MRSK.primary_host}...", :magenta
info "Launching Rails console on #{MRSK.primary_host} [Version: #{version}]" run_locally { exec MRSK.app.console(host: MRSK.primary_host) }
exec MRSK.app.console(host: MRSK.primary_host)
else
error "No image available for #{MRSK.config.repository}"
end
end
end end
end end
desc "bash", "Start a bash session on primary host (or specific host set by --hosts)" desc "bash", "Start a bash session on primary host (or specific host set by --hosts)"
def bash def bash
run_locally do say "Get most recent version available as an image...", :magenta unless options[:version]
info "Launching bash session on #{MRSK.primary_host}" using_version(options[:version] || most_recent_version_available) do |version|
exec MRSK.app.bash(host: MRSK.primary_host) say "Launching bash session of version #{version} on #{MRSK.primary_host}...", :magenta
run_locally { exec MRSK.app.bash(host: MRSK.primary_host) }
end end
end end