Sha256: a87d9e61cebb2c2411c3d98c2fa7d3059a7d6b55127e954617c1ec3865155071

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

require 'pry'
module Pfab
  class Yamls
    def self.generate_for(apps:, application_yaml:, image_name:, env:, sha:, config:)

      apps.map do |app, props|
        puts app

        data = {
          "env" => env.to_s,
          'image_name' => image_name,
          'sha' => sha,
          'container_repository' => config["container.repository"],
          'config' => config,
          'props' => props,
          'deployed_name' => app,
          'application' => application_yaml["name"],
          'application_yaml' => application_yaml
        }

        filename = ".application-k8s-#{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

1 entries across 1 versions & 1 rubygems

Version Path
pfab-0.6.0 lib/pfab/yamls.rb