Class: Shelter::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/configuration.rb

Overview

Read and manage configuration

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/configuration.rb', line 16

def initialize
  @ansible_directory = 'ansible'
  @stack_directory = 'stacks'
  @resource_directory = 'resources'
  @secure_root = ENV.fetch('SECURE', 'secure')
  @inventory_script = File.join(
    File.dirname($PROGRAM_NAME),
    'shelter-inventory'
  )
  @inventory_directory = 'inventory'
  @plugin_directory = 'plugin'
end

Instance Attribute Details

#ansible_directoryObject

Returns the value of attribute ansible_directory.



6
7
8
# File 'lib/configuration.rb', line 6

def ansible_directory
  @ansible_directory
end

#inventory_directoryObject

Returns the value of attribute inventory_directory.



6
7
8
# File 'lib/configuration.rb', line 6

def inventory_directory
  @inventory_directory
end

#inventory_scriptObject

Returns the value of attribute inventory_script.



6
7
8
# File 'lib/configuration.rb', line 6

def inventory_script
  @inventory_script
end

#plugin_directoryObject

Returns the value of attribute plugin_directory.



6
7
8
# File 'lib/configuration.rb', line 6

def plugin_directory
  @plugin_directory
end

#project_rootObject (readonly)

Returns the value of attribute project_root.



14
15
16
# File 'lib/configuration.rb', line 14

def project_root
  @project_root
end

#resource_directoryObject

Returns the value of attribute resource_directory.



6
7
8
# File 'lib/configuration.rb', line 6

def resource_directory
  @resource_directory
end

#secure_rootObject

Returns the value of attribute secure_root.



6
7
8
# File 'lib/configuration.rb', line 6

def secure_root
  @secure_root
end

#stack_directoryObject

Returns the value of attribute stack_directory.



6
7
8
# File 'lib/configuration.rb', line 6

def stack_directory
  @stack_directory
end

Instance Method Details

#inventoryObject



33
34
35
36
# File 'lib/configuration.rb', line 33

def inventory
  path = File.join(@inventory_directory, '*')
  Dir.glob(path)
end

#load_shelterfileObject



29
30
31
# File 'lib/configuration.rb', line 29

def load_shelterfile
  load shelterfile if @shelterfile.nil?
end