Class: Kamal::Configuration::Validator::Alias

Inherits:
Kamal::Configuration::Validator show all
Defined in:
lib/kamal/configuration/validator/alias.rb

Instance Attribute Summary

Attributes inherited from Kamal::Configuration::Validator

#config, #context, #example

Instance Method Summary collapse

Methods inherited from Kamal::Configuration::Validator

#initialize

Constructor Details

This class inherits a constructor from Kamal::Configuration::Validator

Instance Method Details

#validate!Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/kamal/configuration/validator/alias.rb', line 2

def validate!
  super

  name = context.delete_prefix("aliases/")

  if name !~ /\A[a-z0-9_-]+\z/
    error "Invalid alias name: '#{name}'. Must only contain lowercase letters, alphanumeric, hyphens and underscores."
  end

  if Kamal::Cli::Main.commands.include?(name)
    error "Alias '#{name}' conflicts with a built-in command."
  end
end