Sha256: c7ffc2405b2cb9ba2a7fc9b59304a66e37aebd01282336b51301dbae57e5d86e
Contents?: true
Size: 1.47 KB
Versions: 1
Compression:
Stored size: 1.47 KB
Contents
require 'ctpl/compiler' module Ctpl class Generate < Thor include Thor::Actions class_option :verbose, :type => :boolean, :aliases => '-v', :default => false, :banner => 'Activate verbose mode', :desc => 'If used show errors, stacktraces and more' desc 'compile', 'Compile the pipeline.yaml file from the templates' method_option :basefolder, :aliases => 'b', :required => false, :type => :string, :default => './pipeline', :desc => "Optional - defaults to ./pipeline, falls back to PWD. The base-folder the pipeline-template.yaml, aliases.yaml and the partials are located. \nIf you pass /tmp/foo we will look for /tmp/foo/pipeline.yaml, optionally for /tmp/foo/aliases.yaml and all /tmp/foo/*_.yaml files as partials" method_option :output, :aliases => 'o', :required => false, :type => :string, :default => './pipeline.yaml', :desc => "Optional, defaults to pipeline.yaml. Output path to save the merged yaml in" def compile baseFolder = options[:basefolder] merger = PipelineCompiler.new("#{baseFolder}/pipeline-template.yaml", "#{baseFolder}/aliases.yaml", baseFolder) p = merger.merge say_status 'ok', "Transforming back to yaml ", :white yaml = "# DO NOT CHANGE THIS FILE\n# Generated by ctp (https://github.com/EugenMayer/concourse-pipeline-templateer)\n# See '#{baseFolder}' for the source files\n" + p.to_yaml say_status 'ok', "Saving to #{options[:output]} ", :white File.write(options[:output], yaml) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ctpl-0.0.5 | thor/compile.thor |