installer

package
v0.3.8 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPackageMapping

func AddPackageMapping(mapping PackageMapping) error

AddPackageMapping adds a new package mapping

func BatchInstall added in v0.2.7

func BatchInstall(ctx context.Context, pkgMgr Installer, packages []string, versionedPackages map[string]types.VersionConstraint) error

BatchInstall performs batch installation with progress reporting

func GetPackageManagerName

func GetPackageManagerName(pmType types.PackageManagerType) string

GetPackageManagerName returns the display name for a package manager type

func GetPackageManagerType

func GetPackageManagerType(installerInst Installer) types.PackageManagerType

GetPackageManagerType returns the PackageManagerType for a given installer

func GetPackageName

func GetPackageName(pkg string, pmType types.PackageManagerType) (string, error)

GetPackageName returns the package name for a given package and package manager

func InstallPackage

func InstallPackage(ctx context.Context, pkg string, version ...VersionConstraint) error

InstallPackage installs a package using the best available package manager

func InstallPackages

func InstallPackages(ctx context.Context, packages []string, versions ...map[string]VersionConstraint) error

InstallPackages installs multiple packages using the best available package manager

func VerifyInstallation added in v0.2.7

func VerifyInstallation(ctx context.Context, pkgMgr Installer, pkg string, versionConstraint *types.VersionConstraint) error

VerifyInstallation verifies that a package was installed correctly

Types

type InstallationRecord added in v0.2.7

type InstallationRecord struct {
	ID          string                 `json:"id"`
	Timestamp   time.Time              `json:"timestamp"`
	Packages    map[string]PackageInfo `json:"packages"`
	Environment *types.EnvironmentData `json:"environment,omitempty"`
	Metadata    map[string]string      `json:"metadata,omitempty"`
	Status      InstallationStatus     `json:"status"`
}

InstallationRecord represents a single installation record

type InstallationStatus added in v0.2.7

type InstallationStatus string

InstallationStatus represents the status of an installation

const (
	// StatusInProgress indicates the installation is in progress
	StatusInProgress InstallationStatus = "in_progress"
	// StatusCompleted indicates the installation completed successfully
	StatusCompleted InstallationStatus = "completed"
	// StatusFailed indicates the installation failed
	StatusFailed InstallationStatus = "failed"
	// StatusRolledBack indicates the installation was rolled back
	StatusRolledBack InstallationStatus = "rolled_back"
)

type InstallationTracker added in v0.2.7

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

InstallationTracker tracks package installations and supports rollback

func NewInstallationTracker added in v0.2.7

func NewInstallationTracker(trackerFile string) (*InstallationTracker, error)

NewInstallationTracker creates a new InstallationTracker

func (*InstallationTracker) AddPackage added in v0.2.7

func (t *InstallationTracker) AddPackage(installationID string, pkg types.PackageInfo) error

AddPackage adds a package to an installation record

func (*InstallationTracker) CompleteInstallation added in v0.2.7

func (t *InstallationTracker) CompleteInstallation(installationID string) error

CompleteInstallation marks an installation as completed

func (*InstallationTracker) FailInstallation added in v0.2.7

func (t *InstallationTracker) FailInstallation(installationID string, reason string) error

FailInstallation marks an installation as failed

func (*InstallationTracker) GetInstallation added in v0.2.7

func (t *InstallationTracker) GetInstallation(id string) (*InstallationRecord, bool)

GetInstallation returns an installation record by ID

func (*InstallationTracker) ListInstallations added in v0.2.7

func (t *InstallationTracker) ListInstallations() []InstallationRecord

ListInstallations returns all installation records

func (*InstallationTracker) Rollback added in v0.2.7

func (t *InstallationTracker) Rollback(ctx context.Context, installationID string, manager types.Installer) error

Rollback rolls back an installation by uninstalling all installed packages

func (*InstallationTracker) StartInstallation added in v0.2.7

func (t *InstallationTracker) StartInstallation(env *types.EnvironmentData) (*InstallationRecord, error)

StartInstallation starts tracking a new installation

type Installer

type Installer = types.Installer

Installer is an alias for types.Installer for backward compatibility

func DetectPackageManager

func DetectPackageManager() (Installer, error)

DetectPackageManager detects the best available package manager for the current system

type PackageInfo added in v0.2.7

type PackageInfo struct {
	Name        string `json:"name"`
	Version     string `json:"version,omitempty"`
	ManagerType string `json:"manager_type"`
}

PackageInfo contains information about an installed package

type PackageMapping

type PackageMapping struct {
	Name        string
	Description string
	Packages    map[types.PackageManagerType]string
}

PackageMapping defines a mapping for a package across different package managers

func GetAllPackageMappings

func GetAllPackageMappings() []PackageMapping

GetAllPackageMappings returns all package mappings

type PackageVersionInfo added in v0.2.7

type PackageVersionInfo = types.PackageVersionInfo

PackageVersionInfo is an alias for types.PackageVersionInfo

type VersionConstraint added in v0.2.7

type VersionConstraint = types.VersionConstraint

VersionConstraint is an alias for types.VersionConstraint

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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