Sha256: 72470e0c86b61b684bf4ee1f8fa283ba3f3b9b747cec36bdcdd4df744502b74d

Contents?: true

Size: 1.26 KB

Versions: 20

Compression:

Stored size: 1.26 KB

Contents

require 'lino'
require_relative 'base'

module RubyFly
  module Commands
    class SetPipeline < Base
      def configure_command(builder, opts)
        missing_params = [
            :target,
            :pipeline,
            :config
        ].select { |param| opts[param].nil? }

        unless missing_params.empty?
          description = missing_params.map { |p| "'#{p}'" }.join(', ')
          raise(
              ArgumentError,
              "Error: #{description} required but not provided.")
        end

        target = opts[:target]
        pipeline = opts[:pipeline]
        config = opts[:config]
        vars = opts[:vars] || {}
        var_files = opts[:var_files] || []
        non_interactive = opts[:non_interactive]

        builder
          .with_subcommand('set-pipeline') do |sub|
            sub = sub.with_option('-t', target)
            sub = sub.with_option('-p', pipeline)
            sub = sub.with_option('-c', config)
            vars.each do |key, value|
              sub = sub.with_option('-v', "'#{key}=#{value}'")
            end
            var_files.each do |var_file|
              sub = sub.with_option('-l', var_file)
            end
            sub = sub.with_flag('-n') if non_interactive
            sub
          end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
ruby_fly-0.17.0 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.16.0.pre.2 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.16.0.pre.1 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.15.0 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.14.0.pre.1 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.13.0 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.12.0.pre.1 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.11.0 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.10.0.pre.1 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.9.0 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.8.0.pre.pre.2 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.8.0.pre.pre.1 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.7.0 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.6.0.pre.pre.1 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.5.0 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.4.2.pre1 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.4.1 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.4.0 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.3.0 lib/ruby_fly/commands/set_pipeline.rb
ruby_fly-0.2.0 lib/ruby_fly/commands/set_pipeline.rb