Sha256: d1579212c827935be79d7349ad26b7edea69e6ff9cf43c8213315f2a0e143f1b

Contents?: true

Size: 1.79 KB

Versions: 1

Compression:

Stored size: 1.79 KB

Contents

# frozen_string_literal: true

require_relative 'base'
require_relative '../options/common'

module RubyTerraform
  module Commands
    # Wraps the +terraform get+ command which downloads and installs modules
    # needed for the given configuration.
    #
    # This recursively downloads all modules needed, such as modules imported by
    # the root and so on. If a module is already downloaded, it will not be
    # redownloaded or checked for updates unless +:update+ is +true+.
    #
    # Module installation also happens automatically by default as part of
    # the {Init} command, so you should rarely need to run this
    # command separately.
    #
    # For options accepted on construction, see {#initialize}.
    #
    # When executing an instance of {Get} via {#execute}, the following options
    # are supported:
    #
    # * +:directory+: the directory containing terraform configuration;
    #   required.
    # * +:chdir+: the path of a working directory to switch to before executing
    #   the given subcommand.
    # * +:update+: if +true+, checks already-downloaded modules for available
    #   updates and installs the newest versions available; defaults to +false+.
    # * +:no_color+: whether or not the output from the command should be in
    #   color; defaults to +false+.
    #
    # @example Basic Invocation
    #   RubyTerraform::Commands::Get.new.execute(
    #     directory: 'infra/networking')
    class Get < Base
      include RubyTerraform::Options::Common

      # @!visibility private
      def subcommands
        %w[get]
      end

      # @!visibility private
      def options
        %w[
          -no-color
          -update
        ] + super
      end

      # @!visibility private
      def arguments(parameters)
        [parameters[:directory]]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-terraform-0.65.0.pre.15 lib/ruby_terraform/commands/get.rb