sh

package
v0.0.0-...-b1c5812 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: Apache-2.0 Imports: 18 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Archive

func Archive(ctx *task.Context, src, dest string) error

Archive will create an archive from the src file or directory and use the destination's extension to determine which format to use.

func ArchiveTGZ

func ArchiveTGZ(ctx *task.Context, src, dest string) error

ArchiveTGZ will archive using tar and gzip to the destination.

func ArchiveZip

func ArchiveZip(ctx *task.Context, src, dest string) error

ArchiveZip will zip the src into a a zipped file at the destination.

func Copy

func Copy(ctx *task.Context, fromPath, toPath string) error

Copy copies either a file or a directory recursively.

func CreateDirectory

func CreateDirectory(ctx *task.Context, path string) error

CreateDirectory creates a directory.

func CreateDirectoryR

func CreateDirectoryR(ctx *task.Context, path string) error

CreateDirectoryR creates a directory recursively.

func CreateFile

func CreateFile(ctx *task.Context, path string) (*os.File, error)

CreateFile creates a file.

func CreateFileR

func CreateFileR(ctx *task.Context, path string) (*os.File, error)

CreateFileR creates a file ensuring all the directories are created recursively.

func DirectoryExists

func DirectoryExists(path string) (bool, error)

DirectoryExists indicates if the directory exists.

func DownloadHTTP

func DownloadHTTP(ctx *task.Context, url string, toPath string) error

DownloadHTTP issues a GET request against the provided url and downloads the contents to the toPath.

This method will retry HTTP requests that fail.

func DownloadS3

func DownloadS3(ctx *task.Context, from S3Object, toPath string, profile string) error

DownloadS3 downloads an object from S3.

func Env

func Env(key, fallback string) string

Env looks up an environment variable and if not found, returns the fallback.

func ExitCode

func ExitCode(err error) int

ExitCode retrieves the exit code from an error.

func FileExists

func FileExists(path string) (bool, error)

FileExists indicates if the file exists.

func HeadS3

func HeadS3(ctx *task.Context, from S3Object, profile string) error

HeadS3 checks if an object exists on S3.

func IsDirectoryEmpty

func IsDirectoryEmpty(path string) (bool, error)

IsDirectoryEmpty indicates if the directory is empty.

func IsFileEmpty

func IsFileEmpty(path string) (bool, error)

IsFileEmpty indicates if the file is empty.

func IsNotRan

func IsNotRan(err error) bool

IsNotRan indicates if command that generated the error actually ran.

func LogCmd

func LogCmd(ctx *task.Context, cmd *exec.Cmd)

LogCmd logs the command line version of the command to the context.

func Move

func Move(ctx *task.Context, fromPath, toPath string) error

Move moves a file or directory.

func Remove

func Remove(ctx *task.Context, path string) error

Remove either removes a file or a directory recursively.

func Run

func Run(ctx *task.Context, name string, args ...string) error

Run the specified command piping its output to goke's output.

func RunBuffered

func RunBuffered(ctx *task.Context, name string, args ...string) (string, string, string, error)

RunBuffered runs the specified command and returns the actual command exectued, stdout, and stderr.

func RunCmd

func RunCmd(ctx *task.Context, cmd *exec.Cmd) error

RunCmd runs the provided command.

func RunOutput

func RunOutput(ctx *task.Context, name string, args ...string) (string, error)

RunOutput runs the specified command and get the command output.

func Unarchive

func Unarchive(ctx *task.Context, src, dest string) error

Unarchive decompresses the archive according to the source's extension.

func UnarchiveTGZ

func UnarchiveTGZ(ctx *task.Context, src, dest string) error

UnarchiveTGZ decompresses the src tgz file into the destination.

func UnarchiveZip

func UnarchiveZip(ctx *task.Context, src, dest string) error

UnarchiveZip decompresses the src zip file into the destination.

func UploadReaderToS3

func UploadReaderToS3(ctx *task.Context, reader io.Reader, to S3Object, profile string) error

UploadReaderToS3 uploads the contents of the provided reader to S3.

func UploadS3

func UploadS3(ctx *task.Context, fromPath string, to S3Object, profile string) error

UploadS3 reads the file at the provided path and uploads the contents to S3.

Types

type S3Object

type S3Object struct {
	Region string
	Bucket string
	Key    string
}

S3Object defines an S3 object.

Jump to

Keyboard shortcuts

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