Class: Terraspace::CLI::Up

Inherits:
Base
  • Object
show all
Includes:
Concerns::PlanPath, TfcConcern, Terraspace::Cloud::Streamer, Terraspace::Cloud::Vcs::Commenter
Defined in:
lib/terraspace/cli/up.rb

Instance Method Summary collapse

Methods included from TfcConcern

#backend, #tfc?

Methods included from Terraspace::Cloud::Vcs::Commenter

#able_to_comment?, #cloud_comment, #finalize_vars, #kind, #pr_comment, #vcs, #vcs_vars

Methods included from Terraspace::Cloud::Streamer

#cloud_stream

Methods included from Concerns::PlanPath

#plan_path

Methods inherited from Base

#initialize

Methods included from Util::Pretty

#pretty_path, #pretty_time

Methods included from Util::Sure

#sure?

Methods included from Util::Logging

#logger

Constructor Details

This class inherits a constructor from Terraspace::CLI::Base

Instance Method Details

#performObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/terraspace/cli/up.rb', line 17

def perform
  success = nil
  build
  if @options[:yes] && !@options[:plan] && !tfc?
    success = plan
  else
    skip_plan = true
  end
  if success or skip_plan
    success = apply
  end
  success
rescue Exception => e
  @exception = true
  logger.info "Exception #{e.class}: #{e.message}".color(:red)
  logger.info e.backtrace.join("\n")
  false
end

#runObject



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

def run
  cloud_update.cani?
  @stream = cloud_stream.open("up")
  success = perform
  create_cloud_records(success)
  cloud_stream.close(success, @exception)
  exit 1 unless success
end