Class: OdaniaStaticPages::Deploy::DockerCompose::DockerComposeGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/odania_static_pages/deploy/docker_compose.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, environment, nginx_conf_dir) ⇒ DockerComposeGenerator

Returns a new instance of DockerComposeGenerator.



95
96
97
98
99
100
101
# File 'lib/odania_static_pages/deploy/docker_compose.rb', line 95

def initialize(config, environment, nginx_conf_dir)
	@nginx_volume_html = "#{config.output_site_path}:/srv:ro"
	@nginx_volume_conf_d = "#{nginx_conf_dir}:/etc/nginx/conf.d:ro"
	@nginx_volume_nginx_conf = "#{File.join(config.output_path, 'nginx', 'nginx.conf')}:/etc/nginx/nginx.conf"
	@compose_images = environment.deploy_module.compose_images
	@erb_template = File.join(config.base_dir, 'templates', 'docker-compose', 'docker-compose.yml.erb')
end

Instance Attribute Details

#compose_imagesObject (readonly)

Returns the value of attribute compose_images.



93
94
95
# File 'lib/odania_static_pages/deploy/docker_compose.rb', line 93

def compose_images
  @compose_images
end

#nginx_volume_conf_dObject (readonly)

Returns the value of attribute nginx_volume_conf_d.



93
94
95
# File 'lib/odania_static_pages/deploy/docker_compose.rb', line 93

def nginx_volume_conf_d
  @nginx_volume_conf_d
end

#nginx_volume_htmlObject (readonly)

Returns the value of attribute nginx_volume_html.



93
94
95
# File 'lib/odania_static_pages/deploy/docker_compose.rb', line 93

def nginx_volume_html
  @nginx_volume_html
end

#nginx_volume_nginx_confObject (readonly)

Returns the value of attribute nginx_volume_nginx_conf.



93
94
95
# File 'lib/odania_static_pages/deploy/docker_compose.rb', line 93

def nginx_volume_nginx_conf
  @nginx_volume_nginx_conf
end

Instance Method Details

#renderObject



103
104
105
# File 'lib/odania_static_pages/deploy/docker_compose.rb', line 103

def render
	ERB.new(File.read(@erb_template)).result(binding)
end

#write(out_dir) ⇒ Object



107
108
109
# File 'lib/odania_static_pages/deploy/docker_compose.rb', line 107

def write(out_dir)
	File.write out_dir, render
end