Use Base class for default config assignment
This commit is contained in:
@@ -1,4 +1,11 @@
|
|||||||
module Mrsk::Commands
|
module Mrsk::Commands
|
||||||
|
class Base
|
||||||
|
attr_accessor :config
|
||||||
|
|
||||||
|
def initialize(config)
|
||||||
|
@config = config
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
require "mrsk/commands/app"
|
require "mrsk/commands/app"
|
||||||
|
|||||||
@@ -1,10 +1,4 @@
|
|||||||
class Mrsk::Commands::App
|
class Mrsk::Commands::App < Mrsk::Commands::Base
|
||||||
attr_accessor :config
|
|
||||||
|
|
||||||
def initialize(config)
|
|
||||||
@config = config
|
|
||||||
end
|
|
||||||
|
|
||||||
def push
|
def push
|
||||||
# TODO: Run 'docker buildx create --use' when needed
|
# TODO: Run 'docker buildx create --use' when needed
|
||||||
"docker buildx build --push --platform=linux/amd64,linux/arm64 -t #{config.image_with_version} ."
|
"docker buildx build --push --platform=linux/amd64,linux/arm64 -t #{config.image_with_version} ."
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Mrsk::Commands::Registry
|
class Mrsk::Commands::Registry < Mrsk::Commands::Base
|
||||||
def login
|
def login
|
||||||
if (user = ENV["DOCKER_USER"]).present? && (password = ENV["DOCKER_PASSWORD"]).present?
|
if (user = ENV["DOCKER_USER"]).present? && (password = ENV["DOCKER_PASSWORD"]).present?
|
||||||
# FIXME: Find a way to hide PW so it's not shown on terminal
|
# FIXME: Find a way to hide PW so it's not shown on terminal
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
class Mrsk::Commands::Traefik
|
class Mrsk::Commands::Traefik < Mrsk::Commands::Base
|
||||||
def start
|
def start
|
||||||
"docker run --name traefik " +
|
"docker run --name traefik " +
|
||||||
"--rm -d " +
|
"--rm -d " +
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
require_relative "setup"
|
require_relative "setup"
|
||||||
|
|
||||||
traefik = Mrsk::Commands::Traefik.new
|
traefik = Mrsk::Commands::Traefik.new(MRSK_CONFIG)
|
||||||
|
|
||||||
namespace :mrsk do
|
namespace :mrsk do
|
||||||
namespace :traefik do
|
namespace :traefik do
|
||||||
|
|||||||
Reference in New Issue
Block a user