Pass around Roles instead of Strings

Avoid looking up roles by names everywhere. This avoids the awkward
role/role_config naming as well.
This commit is contained in:
Donal McBreen
2024-03-08 08:44:35 +00:00
parent 52bb40add0
commit 4966d52919
12 changed files with 61 additions and 60 deletions

View File

@@ -3,9 +3,10 @@ class Kamal::Configuration::Role
delegate :argumentize, :optionize, to: Kamal::Utils
attr_accessor :name
alias to_s name
def initialize(name, config:)
@name, @config = name.inquiry, config
@name, @config = name.inquiry, config
end
def primary_host
@@ -113,7 +114,7 @@ class Kamal::Configuration::Role
end
def primary?
@config.primary_role == name
self == @config.primary_role
end