Class: Kamal::Cli::Registry

Inherits:
Base
  • Object
show all
Defined in:
lib/kamal/cli/registry.rb

Instance Method Summary collapse

Methods inherited from Base

dynamic_command_class, exit_on_failure?, #initialize

Constructor Details

This class inherits a constructor from Kamal::Cli::Base

Instance Method Details

#loginObject



31
32
33
34
35
36
37
# File 'lib/kamal/cli/registry.rb', line 31

def 
  if KAMAL.registry.local?
    raise "Cannot use login command with a local registry. Use `kamal registry setup` instead."
  end

  setup
end

#logoutObject



42
43
44
45
46
47
48
# File 'lib/kamal/cli/registry.rb', line 42

def logout
  if KAMAL.registry.local?
    raise "Cannot use logout command with a local registry. Use `kamal registry remove` instead."
  end

  remove
end

#removeObject



19
20
21
22
23
24
25
26
# File 'lib/kamal/cli/registry.rb', line 19

def remove
  if KAMAL.registry.local?
    run_locally    { execute *KAMAL.registry.remove, raise_on_non_zero_exit: false } unless options[:skip_local]
  else
    run_locally    { execute *KAMAL.registry.logout } unless options[:skip_local]
    on(KAMAL.hosts) { execute *KAMAL.registry.logout } unless options[:skip_remote]
  end
end

#setupObject



5
6
7
8
9
10
11
12
13
14
# File 'lib/kamal/cli/registry.rb', line 5

def setup
  ensure_docker_installed unless options[:skip_local]

  if KAMAL.registry.local?
    run_locally    { execute *KAMAL.registry.setup } unless options[:skip_local]
  else
    run_locally    { execute *KAMAL.registry. } unless options[:skip_local]
    on(KAMAL.hosts) { execute *KAMAL.registry. } unless options[:skip_remote]
  end
end