Class: Apartment::CLI::Tenants

Inherits:
Thor
  • Object
show all
Defined in:
lib/apartment/cli/tenants.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


8
# File 'lib/apartment/cli/tenants.rb', line 8

def self.exit_on_failure? = true

Instance Method Details

#create(tenant = nil) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/apartment/cli/tenants.rb', line 17

def create(tenant = nil)
  if tenant
    create_single(tenant)
  else
    create_all
  end
end

#currentObject



44
45
46
# File 'lib/apartment/cli/tenants.rb', line 44

def current
  say(Apartment::Current.tenant || Apartment.config&.default_tenant || 'none')
end

#drop(tenant) ⇒ Object



31
32
33
34
35
36
# File 'lib/apartment/cli/tenants.rb', line 31

def drop(tenant)
  return say('Cancelled.') if !force? && !yes?("Drop tenant '#{tenant}'? This cannot be undone. [y/N]")

  Apartment::Tenant.drop(tenant)
  say("Dropped tenant: #{tenant}") unless quiet?
end

#listObject



39
40
41
# File 'lib/apartment/cli/tenants.rb', line 39

def list
  Apartment.config.tenants_provider.call.each { |t| say(t) }
end