Class: Shelter::Configuration
- Inherits:
-
Object
- Object
- Shelter::Configuration
- Defined in:
- lib/configuration.rb
Overview
Read and manage configuration
Instance Attribute Summary collapse
-
#ansible_directory ⇒ Object
Returns the value of attribute ansible_directory.
-
#inventory_directory ⇒ Object
Returns the value of attribute inventory_directory.
-
#inventory_script ⇒ Object
Returns the value of attribute inventory_script.
-
#plugin_directory ⇒ Object
Returns the value of attribute plugin_directory.
-
#project_root ⇒ Object
readonly
Returns the value of attribute project_root.
-
#resource_directory ⇒ Object
Returns the value of attribute resource_directory.
-
#secure_root ⇒ Object
Returns the value of attribute secure_root.
-
#stack_directory ⇒ Object
Returns the value of attribute stack_directory.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #inventory ⇒ Object
- #load_shelterfile ⇒ Object
Constructor Details
#initialize ⇒ Configuration
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_directory ⇒ Object
Returns the value of attribute ansible_directory.
6 7 8 |
# File 'lib/configuration.rb', line 6 def ansible_directory @ansible_directory end |
#inventory_directory ⇒ Object
Returns the value of attribute inventory_directory.
6 7 8 |
# File 'lib/configuration.rb', line 6 def inventory_directory @inventory_directory end |
#inventory_script ⇒ Object
Returns the value of attribute inventory_script.
6 7 8 |
# File 'lib/configuration.rb', line 6 def inventory_script @inventory_script end |
#plugin_directory ⇒ Object
Returns the value of attribute plugin_directory.
6 7 8 |
# File 'lib/configuration.rb', line 6 def plugin_directory @plugin_directory end |
#project_root ⇒ Object (readonly)
Returns the value of attribute project_root.
14 15 16 |
# File 'lib/configuration.rb', line 14 def project_root @project_root end |
#resource_directory ⇒ Object
Returns the value of attribute resource_directory.
6 7 8 |
# File 'lib/configuration.rb', line 6 def resource_directory @resource_directory end |
#secure_root ⇒ Object
Returns the value of attribute secure_root.
6 7 8 |
# File 'lib/configuration.rb', line 6 def secure_root @secure_root end |
#stack_directory ⇒ Object
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
#inventory ⇒ Object
33 34 35 36 |
# File 'lib/configuration.rb', line 33 def inventory path = File.join(@inventory_directory, '*') Dir.glob(path) end |
#load_shelterfile ⇒ Object
29 30 31 |
# File 'lib/configuration.rb', line 29 def load_shelterfile load shelterfile if @shelterfile.nil? end |