Class: Apartment::CLI::Pool

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


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

def self.exit_on_failure? = true

Instance Method Details

#evictObject



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/apartment/cli/pool.rb', line 33

def evict
  unless Apartment.pool_reaper
    say('Apartment is not configured. Run Apartment.configure first.')
    return
  end

  return say('Cancelled.') if !force? && !yes?('Run pool eviction cycle? [y/N]')

  count = Apartment.pool_reaper.run_cycle
  say("Evicted #{count} pool(s).")
end

#statsObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/apartment/cli/pool.rb', line 16

def stats
  unless Apartment.pool_manager
    say('Apartment is not configured. Run Apartment.configure first.')
    return
  end

  pool_stats = Apartment.pool_manager.stats
  say("Total pools: #{pool_stats[:total_pools]}")
  print_tenant_details(pool_stats[:tenants])
end