Class: Navy::TaskContainerBuilder

Inherits:
Object
  • Object
show all
Includes:
ContainerBuilding
Defined in:
lib/navy/task_container_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, config, options) ⇒ TaskContainerBuilder

Returns a new instance of TaskContainerBuilder.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/navy/task_container_builder.rb', line 6

def initialize(app, config, options)
  @app = app
  @config = config
  @options = options
  @convoy_id = options[:convoy]
  @cluster = options[:cluster]
  @specification = {
    :type => "task",
    :env => {},
    :links => [],
    :volumes_from => []
  }
  @dependencies = []
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



4
5
6
# File 'lib/navy/task_container_builder.rb', line 4

def app
  @app
end

#clusterObject (readonly)

Returns the value of attribute cluster.



4
5
6
# File 'lib/navy/task_container_builder.rb', line 4

def cluster
  @cluster
end

#configObject (readonly)

Returns the value of attribute config.



4
5
6
# File 'lib/navy/task_container_builder.rb', line 4

def config
  @config
end

#convoy_idObject (readonly)

Returns the value of attribute convoy_id.



4
5
6
# File 'lib/navy/task_container_builder.rb', line 4

def convoy_id
  @convoy_id
end

#dependenciesObject (readonly)

Returns the value of attribute dependencies.



4
5
6
# File 'lib/navy/task_container_builder.rb', line 4

def dependencies
  @dependencies
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/navy/task_container_builder.rb', line 4

def options
  @options
end

#specificationObject (readonly)

Returns the value of attribute specification.



4
5
6
# File 'lib/navy/task_container_builder.rb', line 4

def specification
  @specification
end

Instance Method Details

#build_postObject



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/navy/task_container_builder.rb', line 34

def build_post
  tasks = config.post_tasks(app.name)
  unless tasks.empty?
    build_task_container_settings(:post, app, config, tasks)
    build_mode_dependencies(app, config)
    build_app_links(app, config)
    build_dep_links(app, config)
    build_env_flags(app, config)
    build_volumes_flags(app, config)
    build_additional_args(app, config)
    build_container
  end
end

#build_preObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/navy/task_container_builder.rb', line 21

def build_pre
  tasks = config.pre_tasks(app.name)
  unless tasks.empty?
    build_task_container_settings(:pre, app, config, tasks)
    build_app_dependencies(app, config)
    build_dep_links(app, config)
    build_env_flags(app, config)
    build_volumes_flags(app, config)
    build_additional_args(app, config)
    build_container
  end
end