workdir

package
v0.14.0-beta.12 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2019 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Overview

Package workdir provides functions to manage docker compose working directories inside the $HOME/.sourced/workdirs directory

Index

Constants

This section is empty.

Variables

View Source
var (
	// RequiredFiles list of required files in a directory to treat it as a working directory
	RequiredFiles = []string{".env", "docker-compose.yml"}

	// ErrMalformed is the returned error when the workdir is wrong
	ErrMalformed = goerrors.NewKind("workdir %s is not valid: %s")
)

Functions

func Active

func Active() (string, error)

Active returns active working directory name

func ActivePath

func ActivePath() (string, error)

ActivePath returns absolute path to active working directory

func InitWithOrgs

func InitWithOrgs(orgs []string, token string) (string, error)

InitWithOrgs initialize workdir with remote list of organizations

func InitWithPath

func InitWithPath(reposdir string) (string, error)

Init creates a working directory in ~/.sourced for the given repositories directory. The working directory will contain a docker-compose.yml and a .env file. If the directory is already initialized the function returns with no error. The returned value is the absolute path to $HOME/.sourced/workdirs/reposdir

func List

func List() ([]string, error)

List returns array of working directories names

func ListPaths

func ListPaths() ([]string, error)

ListPaths returns array of absolute paths to working directories

func RemovePath

func RemovePath(path string) error

RemovePath removes working directory by removing required files and recursively removes directories up to the workdirs root as long as they are empty

func SetActive

func SetActive(workdir string) error

SetActive creates a symlink from the fixed active workdir path to the workdir for the given repos dir.

func SetActivePath

func SetActivePath(path string) error

SetActivePath similar to SetActive but accepts absolute path to a directory instead of a relative one

func UnsetActive

func UnsetActive() error

UnsetActive removes symlink for active workdir

func ValidatePath

func ValidatePath(dir string) error

ValidatePath validates that the passed dir is valid Must be a directory (or a symlink) containing docker-compose.yml and .env files

Types

This section is empty.

Jump to

Keyboard shortcuts

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