Class: EcsDeployCli::DSL::Cron::Task

Inherits:
Object
  • Object
show all
Includes:
AutoOptions
Defined in:
lib/ecs_deploy_cli/dsl/cron.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from AutoOptions

#_options, #method_missing

Constructor Details

#initialize(name, config) ⇒ Task

Returns a new instance of Task.



80
81
82
83
# File 'lib/ecs_deploy_cli/dsl/cron.rb', line 80

def initialize(name, config)
  @name = name
  @config = config
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class EcsDeployCli::DSL::AutoOptions

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



78
79
80
# File 'lib/ecs_deploy_cli/dsl/cron.rb', line 78

def name
  @name
end

Instance Method Details

#as_definitionObject



91
92
93
94
# File 'lib/ecs_deploy_cli/dsl/cron.rb', line 91

def as_definition
  # [{"name"=>"cron", "command"=>["rails", "cron:adalytics"]}]
  (_options[:containers] || []).map(&:as_definition)
end

#container(name, &block) ⇒ Object



85
86
87
88
89
# File 'lib/ecs_deploy_cli/dsl/cron.rb', line 85

def container(name, &block)
  container = Container.new(name, @config)
  container.instance_exec(&block)
  (_options[:containers] ||= []) << container
end