Class: Cloudspin::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/cloudspin/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


126
127
128
# File 'lib/cloudspin/cli.rb', line 126

def self.exit_on_failure?
  true
end

Instance Method Details

#downObject



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/cloudspin/cli.rb', line 60

def down
  puts terraform_runner.init_dry if options[:'show-init']
  if options[:plan] && options[:dry]
    puts terraform_runner.plan_dry(plan_destroy: true)
  elsif options[:plan] && ! options[:dry]
    instance.prepare
    puts terraform_runner.plan(plan_destroy: true)
    instance.after
  elsif ! options[:plan] && options[:dry]
    puts terraform_runner.down_dry
  else
    instance.prepare
    terraform_runner.down
    instance.after
  end
end

#infoObject



83
84
85
# File 'lib/cloudspin/cli.rb', line 83

def info
  puts "Configuration files: #{instance_configuration_files}"
end

#prepareObject



48
49
50
51
52
53
54
# File 'lib/cloudspin/cli.rb', line 48

def prepare
  instance.prepare
  puts terraform_runner.init_dry if options[:'show-init']
  puts terraform_runner.init
  puts "Working folder prepared: #{instance.working_folder}"
  puts "Ready:\ncd #{instance.working_folder} && terraform apply"
end

#upObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/cloudspin/cli.rb', line 29

def up
  puts terraform_runner.init_dry if options[:'show-init']
  if options[:plan] && options[:dry]
    puts terraform_runner.plan_dry
  elsif options[:plan] && ! options[:dry]
    instance.prepare
    puts terraform_runner.plan
    instance.after
  elsif ! options[:plan] && options[:dry]
    puts terraform_runner.up_dry
  else
    instance.prepare
    terraform_runner.up
    instance.after
  end
end

#versionObject



78
79
80
# File 'lib/cloudspin/cli.rb', line 78

def version
  puts "cloudspin-stack: #{Cloudspin::Stack::VERSION}"
end