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
- #accessory(name) ⇒ Object
- #accessory_names ⇒ Object
- #alias(name) ⇒ Object
- #app(role: nil, host: nil) ⇒ Object
- #auditor(**details) ⇒ Object
- #builder ⇒ Object
- #config ⇒ Object
- #configure(**kwargs) ⇒ Object
- #configured? ⇒ Boolean
- #connected? ⇒ Boolean
- #docker ⇒ Object
- #holding_lock? ⇒ Boolean
- #hook ⇒ Object
-
#initialize ⇒ Commander
constructor
A new instance of Commander.
- #lock ⇒ Object
- #proxy ⇒ Object
- #prune ⇒ Object
- #registry ⇒ Object
- #reset ⇒ Object
- #server ⇒ Object
- #specific_primary! ⇒ Object
- #with_specific_hosts(hosts) ⇒ Object
- #with_verbosity(level) ⇒ Object
Constructor Details
#initialize ⇒ Commander
Returns a new instance of Commander.
10 11 12 |
# File 'lib/kamal/commander.rb', line 10 def initialize reset end |
Instance Attribute Details
#connected ⇒ Object
Returns the value of attribute connected.
6 7 8 |
# File 'lib/kamal/commander.rb', line 6 def connected @connected end |
#holding_lock ⇒ Object
Returns the value of attribute holding_lock.
6 7 8 |
# File 'lib/kamal/commander.rb', line 6 def holding_lock @holding_lock end |
#specific_hosts ⇒ Object
Returns the value of attribute specific_hosts.
7 8 9 |
# File 'lib/kamal/commander.rb', line 7 def specific_hosts @specific_hosts end |
#specific_roles ⇒ Object
Returns the value of attribute specific_roles.
7 8 9 |
# File 'lib/kamal/commander.rb', line 7 def specific_roles @specific_roles end |
#verbosity ⇒ Object
Returns the value of attribute verbosity.
6 7 8 |
# File 'lib/kamal/commander.rb', line 6 def verbosity @verbosity end |
Instance Method Details
#accessory(name) ⇒ Object
88 89 90 |
# File 'lib/kamal/commander.rb', line 88 def accessory(name) Kamal::Commands::Accessory.new(config, name: name) end |
#accessory_names ⇒ Object
80 81 82 |
# File 'lib/kamal/commander.rb', line 80 def accessory_names config.accessories&.collect(&:name) || [] end |
#alias(name) ⇒ Object
128 129 130 |
# File 'lib/kamal/commander.rb', line 128 def alias(name) config.aliases[name] end |
#app(role: nil, host: nil) ⇒ Object
84 85 86 |
# File 'lib/kamal/commander.rb', line 84 def app(role: nil, host: nil) Kamal::Commands::App.new(config, role: role, host: host) end |
#auditor(**details) ⇒ Object
92 93 94 |
# File 'lib/kamal/commander.rb', line 92 def auditor(**details) Kamal::Commands::Auditor.new(config, **details) end |
#builder ⇒ Object
96 97 98 |
# File 'lib/kamal/commander.rb', line 96 def builder @commands[:builder] ||= Kamal::Commands::Builder.new(config) end |
#config ⇒ Object
23 24 25 26 27 28 |
# File 'lib/kamal/commander.rb', line 23 def config @config ||= Kamal::Configuration.create_from(**@config_kwargs).tap do |config| @config_kwargs = nil configure_sshkit_with(config) end end |
#configure(**kwargs) ⇒ Object
30 31 32 |
# File 'lib/kamal/commander.rb', line 30 def configure(**kwargs) @config, @config_kwargs = nil, kwargs end |
#configured? ⇒ Boolean
34 35 36 |
# File 'lib/kamal/commander.rb', line 34 def configured? @config || @config_kwargs end |
#connected? ⇒ Boolean
148 149 150 |
# File 'lib/kamal/commander.rb', line 148 def connected? self.connected end |
#docker ⇒ Object
100 101 102 |
# File 'lib/kamal/commander.rb', line 100 def docker @commands[:docker] ||= Kamal::Commands::Docker.new(config) end |
#holding_lock? ⇒ Boolean
144 145 146 |
# File 'lib/kamal/commander.rb', line 144 def holding_lock? self.holding_lock end |
#hook ⇒ Object
104 105 106 |
# File 'lib/kamal/commander.rb', line 104 def hook @commands[:hook] ||= Kamal::Commands::Hook.new(config) end |
#lock ⇒ Object
108 109 110 |
# File 'lib/kamal/commander.rb', line 108 def lock @commands[:lock] ||= Kamal::Commands::Lock.new(config) end |
#proxy ⇒ Object
112 113 114 |
# File 'lib/kamal/commander.rb', line 112 def proxy @commands[:proxy] ||= Kamal::Commands::Proxy.new(config) end |
#prune ⇒ Object
116 117 118 |
# File 'lib/kamal/commander.rb', line 116 def prune @commands[:prune] ||= Kamal::Commands::Prune.new(config) end |
#registry ⇒ Object
120 121 122 |
# File 'lib/kamal/commander.rb', line 120 def registry @commands[:registry] ||= Kamal::Commands::Registry.new(config) end |
#reset ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/kamal/commander.rb', line 14 def reset self.verbosity = :info self.holding_lock = false self.connected = false @specifics = @specific_roles = @specific_hosts = nil @config = @config_kwargs = nil @commands = {} end |
#server ⇒ Object
124 125 126 |
# File 'lib/kamal/commander.rb', line 124 def server @commands[:server] ||= Kamal::Commands::Server.new(config) end |
#specific_primary! ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/kamal/commander.rb', line 38 def specific_primary! @specifics = nil if specific_roles.present? self.specific_hosts = [ specific_roles.first.primary_host ] else self.specific_hosts = [ config.primary_host ] end end |
#with_specific_hosts(hosts) ⇒ Object
73 74 75 76 77 78 |
# File 'lib/kamal/commander.rb', line 73 def with_specific_hosts(hosts) original_hosts, self.specific_hosts = specific_hosts, hosts yield ensure self.specific_hosts = original_hosts end |
#with_verbosity(level) ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/kamal/commander.rb', line 132 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 |