Class: Terraspace::CLI::New::Test

Inherits:
Thor::Group
  • Object
show all
Includes:
Helpers, Thor::Actions
Defined in:
lib/terraspace/cli/new/test.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.optionsObject



8
9
10
11
12
13
14
# File 'lib/terraspace/cli/new/test.rb', line 8

def self.options
  [
    [:force, aliases: %w[y], type: :boolean, desc: "Bypass overwrite are you sure prompt for existing files"],
    [:test_name, desc: "Test name. Defaults to the project, module or stack name"],
    [:type, default: "stack", desc: "project, stack or module"],
  ]
end

Instance Method Details

#autodetect_providerObject

Used in ERB template rspec-terraspace/lib/templates/stack/test/spec/fixtures/config/terraform/provider.tf.tt



56
57
58
# File 'lib/terraspace/cli/new/test.rb', line 56

def autodetect_provider
  Terraspace::Plugin.autodetect
end

#createObject



44
45
46
47
48
49
50
51
52
# File 'lib/terraspace/cli/new/test.rb', line 44

def create
  if type != 'project' && name.nil?
    puts "ERROR: require NAME for type stack and module".color(:red)
    exit 1
  end
  test_template_source(@options[:lang], type)
  puts "=> Creating #{type} test: #{name}"
  directory ".", dest
end