Class: BoringBuilder::Exporters::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/boringbuilder/exporters/resolver.rb

Constant Summary collapse

ADAPTERS =
{
  local: Local,
  boringcache: BoringCache
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project, client, environment: ENV) ⇒ Resolver

Returns a new instance of Resolver.



13
14
15
16
17
18
# File 'lib/boringbuilder/exporters/resolver.rb', line 13

def initialize(project, client, environment: ENV)
  @project = project
  @client = client
  @environment = environment
  @cache = ::BoringBuilder::BoringCache.new(project, client, environment: environment)
end

Instance Attribute Details

#cacheObject (readonly)

Returns the value of attribute cache.



11
12
13
# File 'lib/boringbuilder/exporters/resolver.rb', line 11

def cache
  @cache
end

#clientObject (readonly)

Returns the value of attribute client.



11
12
13
# File 'lib/boringbuilder/exporters/resolver.rb', line 11

def client
  @client
end

#projectObject (readonly)

Returns the value of attribute project.



11
12
13
# File 'lib/boringbuilder/exporters/resolver.rb', line 11

def project
  @project
end

Instance Method Details

#destinationsObject



20
21
22
23
24
# File 'lib/boringbuilder/exporters/resolver.rb', line 20

def destinations
  names = [primary_name].compact
  names << :local if configuration.output && !names.include?(:local)
  names.map { |name| adapter(name) }
end

#planObject



26
27
28
# File 'lib/boringbuilder/exporters/resolver.rb', line 26

def plan
  destinations.map(&:name)
end

#validate!Object



30
31
32
33
# File 'lib/boringbuilder/exporters/resolver.rb', line 30

def validate!
  destinations.each(&:validate!)
  self
end