Sha256: 10e65d43416cf402db38e827b08411267735926488865560568f47b2a380af77

Contents?: true

Size: 743 Bytes

Versions: 50

Compression:

Stored size: 743 Bytes

Contents

class Terraspace::CLI
  class Fmt
    include Concerns::SourceDirs
    include Terraspace::Util::Logging

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

    def run
      logger.info "Formating terraform files"
      dirs.each do |dir|
        format(dir)
      end
    end

    def format(dir)
      Runner.new(dir).format!
    end

  private
    def dirs
      if @mod_name
        type_dirs.select { |p| p.include?(@mod_name) }
      else
        type_dirs
      end
    end

    def type_dirs
      type = @options[:type]
      if type && type != "all"
        app_source_dirs.select { |p| p.include?("/#{type.pluralize}/") }
      else
        app_source_dirs
      end
    end
  end
end

Version data entries

50 entries across 50 versions & 1 rubygems

Version Path
terraspace-2.2.6 lib/terraspace/cli/fmt.rb
terraspace-2.2.5 lib/terraspace/cli/fmt.rb
terraspace-2.2.4 lib/terraspace/cli/fmt.rb
terraspace-2.2.3 lib/terraspace/cli/fmt.rb
terraspace-2.2.2 lib/terraspace/cli/fmt.rb
terraspace-2.2.1 lib/terraspace/cli/fmt.rb
terraspace-2.2.0 lib/terraspace/cli/fmt.rb
terraspace-2.1.7 lib/terraspace/cli/fmt.rb
terraspace-2.1.6 lib/terraspace/cli/fmt.rb
terraspace-2.1.5 lib/terraspace/cli/fmt.rb
terraspace-2.1.4 lib/terraspace/cli/fmt.rb
terraspace-2.1.3 lib/terraspace/cli/fmt.rb
terraspace-2.1.2 lib/terraspace/cli/fmt.rb
terraspace-2.1.1 lib/terraspace/cli/fmt.rb
terraspace-2.1.0 lib/terraspace/cli/fmt.rb
terraspace-2.0.3 lib/terraspace/cli/fmt.rb
terraspace-2.0.2 lib/terraspace/cli/fmt.rb
terraspace-2.0.1 lib/terraspace/cli/fmt.rb
terraspace-2.0.0 lib/terraspace/cli/fmt.rb
terraspace-1.1.7 lib/terraspace/cli/fmt.rb