class DockerCompose

Public Class Methods

new(project_name, app_name) click to toggle source
# File lib/deploy/docker_compose.rb, line 3
def initialize(project_name, app_name)
    @project_name = project_name
    @app_name = app_name

end

Public Instance Methods

generate_compose_yaml(dist_file_path, port, image_tag, out_filename) click to toggle source

@param [string] dist_file_path @param [int] port @param [string] image_tag @return [File]

# File lib/deploy/docker_compose.rb, line 13
def generate_compose_yaml(dist_file_path, port, image_tag, out_filename)
    path = File.dirname(dist_file_path)
    file_path = "#{path}/#{out_filename}"

    dist = File.read(dist_file_path)

    dist = dist.gsub('<port>', port.to_s)
    dist = dist.gsub('<image>', image_tag)

    out_file = File.new(file_path, 'w')
    out_file.puts(dist)
    out_file.close

    puts "Generated: #{file_path}"

    out_file
end