Sha256: 6827523a29895f6cfb1f08c1fa0d7274a604ff574b9ec376a6a80f91ba3e65ff

Contents?: true

Size: 663 Bytes

Versions: 3

Compression:

Stored size: 663 Bytes

Contents

class Subspace::Commands::Provision < Subspace::Commands::Base
  PASS_THROUGH_PARAMS = ["tags", "start-at-task"]

  def initialize(args, options)
    @environment = args.first
    @options = options
    run
  end

  def run
    ansible_options = ["--diff"]
    PASS_THROUGH_PARAMS.each do |param_name|
      x = param_name.split('-')[1..-1].map(&:upcase).join('_')
      hash_key = (param_name.gsub('-', '_') + (x == '' ? '' : "_#{x}")).to_sym
      value = @options.__hash__[hash_key]
      if value
        ansible_options += ["--#{param_name}", value]
      end
    end
    ansible_command "ansible-playbook", "#{@environment}.yml", *ansible_options
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
subspace-1.0.2 lib/subspace/commands/provision.rb
subspace-1.0.1 lib/subspace/commands/provision.rb
subspace-1.0.0 lib/subspace/commands/provision.rb