Sha256: f55f546b67cf0f178eb32bbc2c58dfdc2a6b17eb446793de4d62c011ab0d3d13

Contents?: true

Size: 736 Bytes

Versions: 43

Compression:

Stored size: 736 Bytes

Contents

require 'securerandom'

class Terraspace::CLI
  class Up < Base
    include TfcConcern

    def run
      build
      if @options[:yes] && !@options[:plan] && !tfc?
        plan
        Commander.new("apply", @options.merge(plan: plan_path)).run
      else
        Commander.new("apply", @options).run
      end
    end

  private
    # must build to compute tfc?
    def build
      Terraspace::Builder.new(@options).run
      @options[:build] = false
    end

    def plan
      FileUtils.mkdir_p(File.dirname(plan_path))
      Commander.new("plan", @options.merge(out: plan_path)).run
    end

    def plan_path
      @@random ||= SecureRandom.hex
      "#{Terraspace.tmp_root}/plans/#{@mod.name}-#{@@random}.plan"
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
terraspace-1.1.7 lib/terraspace/cli/up.rb
terraspace-1.1.6 lib/terraspace/cli/up.rb
terraspace-1.1.5 lib/terraspace/cli/up.rb
terraspace-1.1.4 lib/terraspace/cli/up.rb
terraspace-1.1.3 lib/terraspace/cli/up.rb
terraspace-1.1.2 lib/terraspace/cli/up.rb
terraspace-1.1.1 lib/terraspace/cli/up.rb
terraspace-1.1.0 lib/terraspace/cli/up.rb
terraspace-1.0.6 lib/terraspace/cli/up.rb
terraspace-1.0.5 lib/terraspace/cli/up.rb
terraspace-1.0.4 lib/terraspace/cli/up.rb
terraspace-1.0.3 lib/terraspace/cli/up.rb
terraspace-1.0.2 lib/terraspace/cli/up.rb
terraspace-1.0.1 lib/terraspace/cli/up.rb
terraspace-1.0.0 lib/terraspace/cli/up.rb
terraspace-0.7.2 lib/terraspace/cli/up.rb
terraspace-0.7.1 lib/terraspace/cli/up.rb
terraspace-0.7.0 lib/terraspace/cli/up.rb
terraspace-0.6.23 lib/terraspace/cli/up.rb
terraspace-0.6.22 lib/terraspace/cli/up.rb