Sha256: bcddad8942fddc7e5b9b399b108ffb00463fac3840411c1978ce8dc8e57ab052
Contents?: true
Size: 1.38 KB
Versions: 11
Compression:
Stored size: 1.38 KB
Contents
require 'pry' module Pfab class Yamls def initialize(apps:, application_yaml:, image_name:, env:, sha:, config:) @apps = apps @base_data = { "env" => env.to_s, 'image_name' => image_name, 'sha' => sha, 'container_repository' => config["container.repository"], 'config' => config, 'application' => application_yaml["name"], 'application_yaml' => application_yaml } end def env_vars(app) template = Pfab::Templates::Base.new(data_for(app, @apps[app])) template.env_vars end def data_for(app, props) data = @base_data.clone data['props'] = props data['deployed_name'] = app data end def generate_all @apps.map do |app, props| data = data_for(app, props) filename = ".application-k8s-#{data["env"]}-#{app}.yaml" File.open(filename, "w") do |f| case props[:deployable_type] when "web" then processed = Pfab::Templates::Web.new(data).write_to(f) when "job" then processed = Pfab::Templates::Job.new(data).write_to(f) when "daemon" then processed = Pfab::Templates::Daemon.new(data).write_to(f) when "cron" then processed = Pfab::Templates::Cron.new(data).write_to(f) end end filename end end end end
Version data entries
11 entries across 11 versions & 1 rubygems