Sha256: eae5141d3bd9a38c001e2d5a43d46be790545c8038e4a0297eae1189e4d5b292
Contents?: true
Size: 1.11 KB
Versions: 4
Compression:
Stored size: 1.11 KB
Contents
require 'fileutils' require_relative 'download' require_relative 'os' require_relative 'command' module TerraformDevKit class TerragruntInstaller EXTENSION = (OS.host_os == 'windows' ? '.exe' : '').freeze LOCAL_FILE_NAME = "terragrunt#{EXTENSION}".freeze def self.installed_terragrunt_version version = Command.run('terragrunt --version')[0] match = /terragrunt version v(\d+\.\d+\.\d+)/.match(version) match[1] unless match.nil? rescue nil end def self.download_terragrunt(version) TerraformDevKit.download_file( "https://github.com/gruntwork-io/terragrunt/releases/download/v#{version}/terragrunt_#{OS.host_os}_amd64#{EXTENSION}", LOCAL_FILE_NAME, force_download: true ) end def self.install_local(version) if installed_terragrunt_version == version puts 'Terragrunt already installed' return end download_terragrunt(version) unless TerraformDevKit::OS.host_os == 'windows' FileUtils.chmod('u+x', LOCAL_FILE_NAME) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems