Class: Kamal::Commander
- Inherits:
-
Object
- Object
- Kamal::Commander
- Defined in:
- lib/kamal/commander.rb
Defined Under Namespace
Classes: Specifics
Instance Attribute Summary collapse
-
#connected ⇒ Object
Returns the value of attribute connected.
-
#holding_lock ⇒ Object
Returns the value of attribute holding_lock.
-
#specific_hosts ⇒ Object
Returns the value of attribute specific_hosts.
-
#specific_roles ⇒ Object
Returns the value of attribute specific_roles.
-
#verbosity ⇒ Object
Returns the value of attribute verbosity.
Instance Method Summary collapse
- #accessories_on(host) ⇒ Object
- #accessory(name) ⇒ Object
- #accessory_names ⇒ Object
- #app(role: nil, host: nil) ⇒ Object
- #auditor(**details) ⇒ Object
- #boot_strategy ⇒ Object
- #builder ⇒ Object
- #config ⇒ Object
- #configure(**kwargs) ⇒ Object
- #connected? ⇒ Boolean
- #docker ⇒ Object
- #healthcheck ⇒ Object
- #holding_lock? ⇒ Boolean
- #hook ⇒ Object
-
#initialize ⇒ Commander
constructor
A new instance of Commander.
- #lock ⇒ Object
- #prune ⇒ Object
- #registry ⇒ Object
- #server ⇒ Object
- #specific_primary! ⇒ Object
- #traefik ⇒ Object
- #with_verbosity(level) ⇒ Object
Constructor Details
#initialize ⇒ Commander
Returns a new instance of Commander.
8 9 10 11 12 13 |
# File 'lib/kamal/commander.rb', line 8 def initialize self.verbosity = :info self.holding_lock = false self.connected = false @specifics = nil end |
Instance Attribute Details
#connected ⇒ Object
Returns the value of attribute connected.
5 6 7 |
# File 'lib/kamal/commander.rb', line 5 def connected @connected end |
#holding_lock ⇒ Object
Returns the value of attribute holding_lock.
5 6 7 |
# File 'lib/kamal/commander.rb', line 5 def holding_lock @holding_lock end |
#specific_hosts ⇒ Object
Returns the value of attribute specific_hosts.
26 27 28 |
# File 'lib/kamal/commander.rb', line 26 def specific_hosts @specific_hosts end |
#specific_roles ⇒ Object
Returns the value of attribute specific_roles.
26 27 28 |
# File 'lib/kamal/commander.rb', line 26 def specific_roles @specific_roles end |
#verbosity ⇒ Object
Returns the value of attribute verbosity.
5 6 7 |
# File 'lib/kamal/commander.rb', line 5 def verbosity @verbosity end |
Instance Method Details
#accessories_on(host) ⇒ Object
63 64 65 |
# File 'lib/kamal/commander.rb', line 63 def accessories_on(host) config.accessories.select { |accessory| accessory.hosts.include?(host.to_s) }.map(&:name) end |
#accessory(name) ⇒ Object
72 73 74 |
# File 'lib/kamal/commander.rb', line 72 def accessory(name) Kamal::Commands::Accessory.new(config, name: name) end |
#accessory_names ⇒ Object
59 60 61 |
# File 'lib/kamal/commander.rb', line 59 def accessory_names config.accessories&.collect(&:name) || [] end |
#app(role: nil, host: nil) ⇒ Object
68 69 70 |
# File 'lib/kamal/commander.rb', line 68 def app(role: nil, host: nil) Kamal::Commands::App.new(config, role: role, host: host) end |
#auditor(**details) ⇒ Object
76 77 78 |
# File 'lib/kamal/commander.rb', line 76 def auditor(**details) Kamal::Commands::Auditor.new(config, **details) end |
#boot_strategy ⇒ Object
129 130 131 132 133 134 135 |
# File 'lib/kamal/commander.rb', line 129 def boot_strategy if config.boot.limit.present? { in: :groups, limit: config.boot.limit, wait: config.boot.wait } else {} end end |
#builder ⇒ Object
80 81 82 |
# File 'lib/kamal/commander.rb', line 80 def builder @builder ||= Kamal::Commands::Builder.new(config) end |
#config ⇒ Object
15 16 17 18 19 20 |
# File 'lib/kamal/commander.rb', line 15 def config @config ||= Kamal::Configuration.create_from(**@config_kwargs).tap do |config| @config_kwargs = nil configure_sshkit_with(config) end end |
#configure(**kwargs) ⇒ Object
22 23 24 |
# File 'lib/kamal/commander.rb', line 22 def configure(**kwargs) @config, @config_kwargs = nil, kwargs end |
#connected? ⇒ Boolean
141 142 143 |
# File 'lib/kamal/commander.rb', line 141 def connected? self.connected end |
#docker ⇒ Object
84 85 86 |
# File 'lib/kamal/commander.rb', line 84 def docker @docker ||= Kamal::Commands::Docker.new(config) end |
#healthcheck ⇒ Object
88 89 90 |
# File 'lib/kamal/commander.rb', line 88 def healthcheck @healthcheck ||= Kamal::Commands::Healthcheck.new(config) end |
#holding_lock? ⇒ Boolean
137 138 139 |
# File 'lib/kamal/commander.rb', line 137 def holding_lock? self.holding_lock end |
#hook ⇒ Object
92 93 94 |
# File 'lib/kamal/commander.rb', line 92 def hook @hook ||= Kamal::Commands::Hook.new(config) end |
#lock ⇒ Object
96 97 98 |
# File 'lib/kamal/commander.rb', line 96 def lock @lock ||= Kamal::Commands::Lock.new(config) end |
#prune ⇒ Object
100 101 102 |
# File 'lib/kamal/commander.rb', line 100 def prune @prune ||= Kamal::Commands::Prune.new(config) end |
#registry ⇒ Object
104 105 106 |
# File 'lib/kamal/commander.rb', line 104 def registry @registry ||= Kamal::Commands::Registry.new(config) end |
#server ⇒ Object
108 109 110 |
# File 'lib/kamal/commander.rb', line 108 def server @server ||= Kamal::Commands::Server.new(config) end |
#specific_primary! ⇒ Object
28 29 30 31 |
# File 'lib/kamal/commander.rb', line 28 def specific_primary! @specifics = nil self.specific_hosts = [ config.primary_host ] end |
#traefik ⇒ Object
112 113 114 |
# File 'lib/kamal/commander.rb', line 112 def traefik @traefik ||= Kamal::Commands::Traefik.new(config) end |
#with_verbosity(level) ⇒ Object
117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/kamal/commander.rb', line 117 def with_verbosity(level) old_level = self.verbosity self.verbosity = level SSHKit.config.output_verbosity = level yield ensure self.verbosity = old_level SSHKit.config.output_verbosity = old_level end |