installerx

package
v0.0.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 18, 2024 License: Apache-2.0 Imports: 3 Imported by: 2

Documentation

Overview

Package installerx provides functionality for installing various binaries and tools.

Package installerx provides functionality for installing various tools, including Terragrunt.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseInstaller

type BaseInstaller struct {
	// contains filtered or unexported fields
}

BaseInstaller implements the Installer interface and provides common functionality for installing binaries across different platforms and package formats.

func NewBaseInstaller

func NewBaseInstaller(version, releaseURL, binaryName, fileExt string) *BaseInstaller

NewBaseInstaller creates a new BaseInstaller instance.

func (*BaseInstaller) GetInstallCommands

func (bi *BaseInstaller) GetInstallCommands(url string) [][]string

GetInstallCommands returns the commands to install the binary.

func (*BaseInstaller) GetLatestVersion

func (bi *BaseInstaller) GetLatestVersion() (string, error)

GetLatestVersion returns the latest version of the binary.

func (*BaseInstaller) Install

func (bi *BaseInstaller) Install(container *dagger.Container, commands [][]string) *dagger.Container

Install performs the installation on a Dagger container.

type Installer

type Installer interface {
	// GetInstallCommands returns a slice of slices of strings, where each inner slice represents
	// a set of commands to be executed for installation. Each command set is executed in sequence.
	GetInstallCommands() [][]string

	// Install takes a pointer to a dagger.Container and performs the installation process on it.
	// It returns the modified container after the installation is complete.
	Install(container *dagger.Container) *dagger.Container

	// GetLatestVersion fetches the latest version of the software to be installed.
	// It returns the version as a string and an error if there is any issue in fetching the version.
	GetLatestVersion() (string, error)
}

Installer defines the interface for all installers. It provides methods to get installation commands, perform the installation on a given container, and retrieve the latest version of the software.

type OpenTofuInstaller

type OpenTofuInstaller struct {
	*BaseInstaller
}

OpenTofuInstaller represents an installer for OpenTofu. It embeds BaseInstaller to inherit common installation functionality.

func NewOpenTofuInstaller

func NewOpenTofuInstaller(version string) *OpenTofuInstaller

NewOpenTofuInstaller creates and returns a new OpenTofuInstaller instance. It initializes the embedded BaseInstaller with OpenTofu-specific parameters.

Parameters:

  • version: The version of OpenTofu to install.

Returns:

  • *OpenTofuInstaller: A pointer to the newly created OpenTofuInstaller.

func (*OpenTofuInstaller) GetInstallCommands

func (oti *OpenTofuInstaller) GetInstallCommands() [][]string

GetInstallCommands returns a slice of command slices needed to install OpenTofu. It generates the download URL for the specific version and architecture, then delegates to the BaseInstaller to generate the actual install commands.

Returns:

  • [][]string: A slice of command slices, where each inner slice represents a command with its arguments.

func (*OpenTofuInstaller) GetLatestVersion

func (oti *OpenTofuInstaller) GetLatestVersion() (string, error)

GetLatestVersion retrieves the latest version of OpenTofu available.

Returns:

  • string: The latest version number.
  • error: An error if the version retrieval fails.

Note: This is currently a placeholder implementation.

type TerraformInstaller

type TerraformInstaller struct {
	*BaseInstaller
}

TerraformInstaller represents an installer for Terraform

func NewTerraformInstaller

func NewTerraformInstaller(version string) *TerraformInstaller

NewTerraformInstaller creates a new TerraformInstaller instance

Parameters:

  • version: The version of Terraform to install

Returns:

  • *TerraformInstaller: A pointer to the newly created TerraformInstaller

func (*TerraformInstaller) GetInstallCommands

func (ti *TerraformInstaller) GetInstallCommands() [][]string

GetInstallCommands returns the commands needed to install Terraform

This method generates the download URL for the specified Terraform version and returns the installation commands using the BaseInstaller.

Returns:

  • [][]string: A slice of string slices representing the installation commands

func (*TerraformInstaller) GetLatestVersion

func (ti *TerraformInstaller) GetLatestVersion() (string, error)

GetLatestVersion retrieves the latest version of Terraform

This method is currently a placeholder and returns a hardcoded version. TODO: Implement logic to fetch the latest version from Terraform's releases page or API

Returns:

  • string: The latest version of Terraform (currently hardcoded)
  • error: An error if the retrieval fails (currently always nil)

type TerragruntInstaller

type TerragruntInstaller struct {
	*BaseInstaller
}

TerragruntInstaller represents an installer for Terragrunt. It embeds BaseInstaller to inherit common installation functionality.

func NewTerragruntInstaller

func NewTerragruntInstaller(version string) *TerragruntInstaller

NewTerragruntInstaller creates and returns a new TerragruntInstaller. It initializes the embedded BaseInstaller with Terragrunt-specific parameters.

Parameters:

  • version: The version of Terragrunt to install.

Returns:

  • *TerragruntInstaller: A pointer to the newly created TerragruntInstaller.

func (*TerragruntInstaller) GetInstallCommands

func (tgi *TerragruntInstaller) GetInstallCommands() [][]string

GetInstallCommands returns the commands needed to install Terragrunt. It generates the download URL for the specified version and delegates to BaseInstaller.

Returns:

  • [][]string: A slice of command arguments, where each inner slice represents a single command.

func (*TerragruntInstaller) GetLatestVersion

func (tgi *TerragruntInstaller) GetLatestVersion() (string, error)

GetLatestVersion retrieves the latest version of Terragrunt available.

Returns:

  • string: The latest version of Terragrunt.
  • error: An error if the version retrieval fails.

Note: This is currently a placeholder implementation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL