Class: Terraspace::CLI::Fmt

Inherits:
Object
  • Object
show all
Includes:
Concerns::SourceDirs, Util::Logging
Defined in:
lib/terraspace/cli/fmt.rb,
lib/terraspace/cli/fmt/runner.rb

Defined Under Namespace

Classes: Runner

Constant Summary collapse

@@exit_status =
0

Instance Method Summary collapse

Methods included from Util::Logging

#logger

Methods included from Concerns::SourceDirs

#app_source_dirs, #source_dirs

Constructor Details

#initialize(options = {}) ⇒ Fmt

Returns a new instance of Fmt.



6
7
8
9
# File 'lib/terraspace/cli/fmt.rb', line 6

def initialize(options={})
  @options = options
  @mod_name = options[:mod]
end

Instance Method Details

#format(dir) ⇒ Object



21
22
23
# File 'lib/terraspace/cli/fmt.rb', line 21

def format(dir)
  Runner.new(dir, @options).format!
end

#runObject



12
13
14
15
16
17
18
19
# File 'lib/terraspace/cli/fmt.rb', line 12

def run
  logger.info "Formatting terraform files"
  dirs.each do |dir|
    exit_status = format(dir)
    @@exit_status = exit_status if exit_status != 0
  end
  exit(@@exit_status)
end