Sha256: e4598e74dc83b51e4f60c4b1709d469e1455a378125eacdcc07984cbb42416ce

Contents?: true

Size: 781 Bytes

Versions: 2

Compression:

Stored size: 781 Bytes

Contents

# frozen_string_literal: true

class Helmsnap::Generate < Helmsnap::Service
  def initialize(chart_path:, snapshots_path:, values_path:)
    super()
    self.chart_path = chart_path
    self.snapshots_path = snapshots_path
    self.values_path = values_path
  end

  def call
    Helmsnap::SetupDependencies.call(chart_path)

    FileUtils.rmtree(snapshots_path)

    run_cmd(
      "helm", "template", chart_path, "--values", values_path, "--output-dir", snapshots_path
    )

    snapshots_path.glob(["**/*yaml", "**/*.yml"]).each do |path|
      content = path.read
      content.gsub!(/\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\.\d+/, "2022-01-01 00:00:00.000") or next
      path.write(content)
    end
  end

  private

  attr_accessor :chart_path, :snapshots_path, :values_path
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
helmsnap-0.5.1 lib/helmsnap/generate.rb
helmsnap-0.5.0 lib/helmsnap/generate.rb