Class: Helmsnap::Generate
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(config, snapshots_path: nil) ⇒ Generate
constructor
A new instance of Generate.
Methods inherited from Service
Constructor Details
#initialize(config, snapshots_path: nil) ⇒ Generate
Returns a new instance of Generate.
4 5 6 7 8 |
# File 'lib/helmsnap/generate.rb', line 4 def initialize(config, snapshots_path: nil) super() self.config = config self.snapshots_path = snapshots_path || config.snapshots_path end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/helmsnap/generate.rb', line 10 def call Helmsnap::SetupDependencies.call(config) FileUtils.rmtree(snapshots_path) config.envs.each do |env| run_cmd( "helmfile", "--environment", env.name, "template", "--output-dir-template", snapshots_path.join(env.name).join("{{ .Release.Name }}"), "--skip-deps", ) end 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") content.gsub!(/\d\d\d\d-\d\d-\d\d-\d\d-\d\d-\d\d/, "2022-01-01-00-00-00") content.gsub!(/\d\d\d\d-\d\d-\d\d-\d\d-\d\d/, "2022-01-01-00-00") path.write(content) end end |