Class: Covalence::EnvironmentTasks
- Inherits:
-
Object
- Object
- Covalence::EnvironmentTasks
- Includes:
- Rake::DSL
- Defined in:
- lib/covalence/environment_tasks.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
Instance Method Summary collapse
-
#initialize ⇒ EnvironmentTasks
constructor
A new instance of EnvironmentTasks.
-
#run ⇒ Object
:reek:NestedIterators :reek:TooManyStatements.
Constructor Details
#initialize ⇒ EnvironmentTasks
Returns a new instance of EnvironmentTasks.
15 16 17 |
# File 'lib/covalence/environment_tasks.rb', line 15 def initialize @logger = Covalence::LOGGER end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
13 14 15 |
# File 'lib/covalence/environment_tasks.rb', line 13 def logger @logger end |
Instance Method Details
#run ⇒ Object
:reek:NestedIterators :reek:TooManyStatements
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/covalence/environment_tasks.rb', line 21 def run task = get_task_attr(ARGV.first) if !task.empty? environments = EnvironmentRepository.find_filtered(task) else environments = EnvironmentRepository.find_all end if !task.has_key? 'environment' all_namespace_terraform_tasks(environments) end environments.each do |environment| # We do not want to render individual tasks for the reserved 'ci' and 'spec' namespaces, or any other specified with COVALENCE_RESERVED_NAMESPACE break if RESERVED_NS.include?(task['environment']) next if task.has_key? 'environment' && environment.name != task['environment'] logger.debug("Rendering #{environment.name} environment tasks") environment_namespace_terraform_tasks(environment) environment_namespace_packer_tasks(environment) environment.stacks.each do |stack| next if task.has_key? 'stack' && stack.name != task['stack'] logger.debug("Rendering #{stack.name} stack tasks") EnvironmentRepository.populate_stack(stack) case stack.type when 'terraform' tf_tasks = TerraformStackTasks.new(stack) stack_namespace_terraform_tasks(tf_tasks) stack.contexts.each do |context| context_namespace_terraform_tasks(tf_tasks, context) end when 'packer' packer_tasks = PackerStackTasks.new(stack) stack.contexts.each do |context| context_namespace_packer_tasks(packer_tasks, context) end end end end end |