Class: Patches::TenantRunner

Inherits:
Object
  • Object
show all
Includes:
TenantRunConcern
Defined in:
lib/patches/tenant_runner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from TenantRunConcern

#run

Constructor Details

#initialize(path: nil, tenants: nil) ⇒ TenantRunner

Returns a new instance of TenantRunner.



5
6
7
8
# File 'lib/patches/tenant_runner.rb', line 5

def initialize(path: nil, tenants: nil)
  @path = path
  @tenants = tenants
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



3
4
5
# File 'lib/patches/tenant_runner.rb', line 3

def path
  @path
end

Instance Method Details

#performObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/patches/tenant_runner.rb', line 10

def perform
  Patches.logger.info("Patches tenant runner for: #{tenants.join(',')}")
  tenants.each do |tenant|
    if parallel?
      Patches::TenantWorker.perform_async(
        tenant,
        path,
        application_version: Patches::Config.configuration.application_version
      )
    else
      run(tenant, path)
    end
  end
end

#tenantsObject



25
26
27
# File 'lib/patches/tenant_runner.rb', line 25

def tenants
  @tenants ||= (Apartment.tenant_names || [])
end