Class: Humidifier::Directory
- Inherits:
-
Object
- Object
- Humidifier::Directory
- Defined in:
- lib/humidifier/directory.rb
Overview
Represents a directory on the filesystem containing YAML files that correspond to resources belonging to a stack. Contains all of the logic for interfacing with humidifier to deploy stacks, validate them, display them.
Defined Under Namespace
Classes: Export
Instance Attribute Summary collapse
-
#exports ⇒ Object
readonly
Returns the value of attribute exports.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
-
#prefix ⇒ Object
readonly
Returns the value of attribute prefix.
-
#stack_name ⇒ Object
readonly
Returns the value of attribute stack_name.
Instance Method Summary collapse
- #create_change_set ⇒ Object
- #deploy(wait = false, parameter_values = {}) ⇒ Object
-
#initialize(name, pattern: nil, prefix: nil) ⇒ Directory
constructor
A new instance of Directory.
- #to_cf ⇒ Object
- #upload ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(name, pattern: nil, prefix: nil) ⇒ Directory
Returns a new instance of Directory.
23 24 25 26 27 28 29 |
# File 'lib/humidifier/directory.rb', line 23 def initialize(name, pattern: nil, prefix: nil) @name = name @pattern = pattern @prefix = prefix @exports = [] @stack_name = "#{prefix || Humidifier.config.stack_prefix}#{name}" end |
Instance Attribute Details
#exports ⇒ Object (readonly)
Returns the value of attribute exports.
21 22 23 |
# File 'lib/humidifier/directory.rb', line 21 def exports @exports end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
21 22 23 |
# File 'lib/humidifier/directory.rb', line 21 def name @name end |
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
21 22 23 |
# File 'lib/humidifier/directory.rb', line 21 def pattern @pattern end |
#prefix ⇒ Object (readonly)
Returns the value of attribute prefix.
21 22 23 |
# File 'lib/humidifier/directory.rb', line 21 def prefix @prefix end |
#stack_name ⇒ Object (readonly)
Returns the value of attribute stack_name.
21 22 23 |
# File 'lib/humidifier/directory.rb', line 21 def stack_name @stack_name end |
Instance Method Details
#create_change_set ⇒ Object
31 32 33 34 35 36 37 |
# File 'lib/humidifier/directory.rb', line 31 def create_change_set return unless valid? stack.create_change_set( capabilities: %w[CAPABILITY_IAM CAPABILITY_NAMED_IAM] ) end |
#deploy(wait = false, parameter_values = {}) ⇒ Object
39 40 41 42 43 44 45 46 47 |
# File 'lib/humidifier/directory.rb', line 39 def deploy(wait = false, parameter_values = {}) return unless valid? stack.public_send( wait ? :deploy_and_wait : :deploy, capabilities: %w[CAPABILITY_IAM CAPABILITY_NAMED_IAM], parameters: parameter_values ) end |
#to_cf ⇒ Object
49 50 51 |
# File 'lib/humidifier/directory.rb', line 49 def to_cf stack.to_cf end |
#upload ⇒ Object
53 54 55 |
# File 'lib/humidifier/directory.rb', line 53 def upload stack.upload if valid? end |
#valid? ⇒ Boolean
57 58 59 |
# File 'lib/humidifier/directory.rb', line 57 def valid? stack.valid? end |