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.
-
#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.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/configuration.rb', line 15 def initialize @ansible_directory = 'ansible' @stack_directory = 'stacks' @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.
13 14 15 |
# File 'lib/configuration.rb', line 13 def project_root @project_root 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
31 32 33 34 |
# File 'lib/configuration.rb', line 31 def inventory path = File.join(@inventory_directory, '*') Dir.glob(path) end |
#load_shelterfile ⇒ Object
27 28 29 |
# File 'lib/configuration.rb', line 27 def load_shelterfile load shelterfile if @shelterfile.nil? end |