unpack

package
v0.0.0-...-cc36674 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCreatingWorkingDirFolder represents an error creating working directory folder
	ErrCreatingWorkingDirFolder = errors.New("error creating working directory folder")
	// ErrCopyingFilesInWorkingDir represents an error copying files in working directory
	ErrCopyingFilesInWorkingDir = errors.New("error copying files in working directory")
	// ErrRemovingWorkingDirFolder represents an error removing working directory folder
	ErrRemovingWorkingDirFolder = errors.New("error removing working directory folder")
	// ErrProjectNotProvided represents an error when the project is not provided
	ErrProjectNotProvided = errors.New("project not provided")
	// ErrWorkingDirNotProvided represents an error when the working directory is not provided
	ErrWorkingDirNotProvided = errors.New("working directory not provided")
	// ErrWorkingDirIsNotDirectory represents an error when the working directory is not a directory
	ErrWorkingDirIsNotDirectory = errors.New("working directory is not a directory")
	// ErrDescribingWorkingDir represents an error when the working directory cannot be described
	ErrDescribingWorkingDir = errors.New("an error occurred describing working directory")
	// ErrFilesystemNotProvided represents an error when the filesystem is not provided
	ErrFilesystemNotProvided = errors.New("filesystem not provided")
	// ErrWorkingDirNotExists represents an error when the destination to fetch does not exists
	ErrWorkingDirNotExists = errors.New("working directory does not exists")
	// ErrTarExtractorNotProvided is returned when the tar extractor is not provided
	ErrTarExtractorNotProvided = errors.New("Tar extractor not provided")
	// ErrSourceCodeFileNotExist is returned when the source code file does not exist
	ErrSourceCodeFileNotExist = errors.New("source code file does not exist")
	// ErrOpeningSourceCodeFile is returned when the source code file cannot be opened
	ErrOpeningSourceCodeFile = errors.New("an error occurred opening source code file")
	// ErrCreatingGzipReader is returned when the gzip reader cannot be created
	ErrCreatingGzipReader = errors.New("an error occurred creating gzip reader")
	// ErrExtractingSourceCodeFile is returned when the source code file cannot be extracted
	ErrExtractingSourceCodeFile = errors.New("an error occurred extracting source code file")
	// ErrDescribingProjectReferenece is returned when the project reference cannot be described
	ErrDescribingProjectReferenece = errors.New("an error occurred describing project reference")
	// ErrProjectReferenceNotProvided is returned when the project reference is not provided
	ErrProjectReferenceNotProvided = errors.New("project reference not provided")
)

Functions

This section is empty.

Types

type Factory

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

Factory represents the factory for unpacking source code components

func NewFactory

func NewFactory() *Factory

NewFactory creates a new Factory for unpacking source code

func (*Factory) Get

Get gets an unpacker by name

func (*Factory) Register

func (f *Factory) Register(name string, unpacker repository.SourceCodeUnpacker)

Register registers a new unpacker

type MockTarExtractor

type MockTarExtractor struct {
	mock.Mock
}

MockTarExtractor interface used to extract tar files

func NewMockTarExtractor

func NewMockTarExtractor() *MockTarExtractor

NewMockTarExtractor method creates a new TarGzipFormat struct

func (*MockTarExtractor) Extract

func (m *MockTarExtractor) Extract(reader io.Reader, dest string) error

Extract method extracts a tar file

type PlainFormat

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

PlainFormat struct used to unpack local files

func NewPlainFormat

func NewPlainFormat(fs afero.Fs, logger repository.Logger) *PlainFormat

NewPlainFormat method creates a new PlainFormat struct

func (*PlainFormat) Unpack

func (p *PlainFormat) Unpack(project *entity.Project, workingDir string) error

Unpack method prepares the project into the working directory. Unpacking a plain format project does not require any action. The project is already fetched in the working directory. It just checks if the working directory exists.

type TarExtractorer

type TarExtractorer interface {
	Extract(reader io.Reader, dest string) error
}

TarExtractorer interface used to extract tar files

type TarGzipFormat

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

TarGzipFormat struct used to unpack tar.gz files

func NewTarGzipFormat

func NewTarGzipFormat(fs afero.Fs, extractor TarExtractorer, logger repository.Logger) *TarGzipFormat

NewTarGzipFormat method creates a new TarGzipFormat struct

func (*TarGzipFormat) Unpack

func (a *TarGzipFormat) Unpack(project *entity.Project, workingDir string) error

Unpack method prepares the project into dest folder

Jump to

Keyboard shortcuts

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