lib/krane/cli/render_command.rb in kubernetes-deploy-0.30.0 vs lib/krane/cli/render_command.rb in kubernetes-deploy-0.31.0

- old
+ new

@@ -2,24 +2,26 @@ module Krane module CLI class RenderCommand OPTIONS = { - bindings: { type: :array, desc: 'Bindings for erb' }, - filenames: { type: :array, required: true, aliases: 'f', desc: 'Directories and files to render' }, + bindings: { type: :array, banner: "foo=bar abc=def", desc: 'Bindings for erb' }, + filenames: { type: :array, banner: 'config/deploy/production config/deploy/my-extra-resource.yml', + required: true, aliases: 'f', desc: 'Directories and files to render' }, + 'current-sha': { type: :string, banner: "SHA", desc: "Expose SHA `current_sha` in ERB bindings" }, } def self.from_options(options) - require 'kubernetes-deploy/render_task' - require 'kubernetes-deploy/bindings_parser' - require 'kubernetes-deploy/options_helper' + require 'krane/render_task' + require 'krane/bindings_parser' + require 'krane/options_helper' - bindings_parser = KubernetesDeploy::BindingsParser.new + bindings_parser = ::Krane::BindingsParser.new options[:bindings]&.each { |b| bindings_parser.add(b) } - KubernetesDeploy::OptionsHelper.with_processed_template_paths(options[:filenames]) do |paths| - runner = KubernetesDeploy::RenderTask.new( - current_sha: ENV["REVISION"], + ::Krane::OptionsHelper.with_processed_template_paths(options[:filenames]) do |paths| + runner = ::Krane::RenderTask.new( + current_sha: options['current-sha'], template_paths: paths, bindings: bindings_parser.parse, ) runner.run!(STDOUT) end