dust

package module
v0.0.0-...-5587f24 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultDustRoot

func DefaultDustRoot() string

DefaultDustRoot returns the default root directory path for dust

func InferProjectNameFromURL

func InferProjectNameFromURL(u *url.URL) string

InferProjectNameFromURL does just that...

func Install

func Install(root, name, srcURL string, entry *catalog.Entry) error

Install installs the project at url if a project with the given name does not already exist in root

func Unzip

func Unzip(src string, dest string, removeArchiveRoot bool) ([]string, error)

Unzip will decompress a zip archive, moving all files and folders within the zip file (parameter 1) to an output directory (parameter 2).

Types

type Layout

type Layout struct {
	RootDir string
}

Layout describes a dust directory structure

func NewLayout

func NewLayout(rootDir string) *Layout

NewLayout creates a new (directory) Layout

func (*Layout) AudioDir

func (l *Layout) AudioDir() string

AudioDir returns the path to the audio directory for the given root directory

func (*Layout) CreateProject

func (l *Layout) CreateProject(name string) (*Project, error)

CreateProject creates a new project directory with the given name if it does not already exist, returning a new Project on success

func (*Layout) DataDir

func (l *Layout) DataDir() string

DataDir returns the path to the data directory for the given root directory

func (*Layout) EnsureDirectories

func (l *Layout) EnsureDirectories() error

EnsureDirectories creates any of the standard directories if they do not exist

func (*Layout) GetProject

func (l *Layout) GetProject(name string) *Project

GetProject returns

func (*Layout) GetProjects

func (l *Layout) GetProjects() *[]Project

GetProjects returns an array of Project(s), one for each project directory in the layout

func (*Layout) ProjectsDir

func (l *Layout) ProjectsDir() string

ProjectsDir require the path to the directory containing projects

func (*Layout) TapeDir

func (l *Layout) TapeDir() string

TapeDir returns the path to the tape functions audio directory for the given root directory

type MetaData

type MetaData struct {
	Header    catalog.Header `json:"file_info"`
	Installed time.Time      `json:"installed_on"`
	Updated   time.Time      `json:"updated_on,omitempty"`
	SourceURL string         `json:"project_url"`
	Entry     *catalog.Entry `json:"catalog_entry,omitempty"`
}

MetaData encapsulates information about the project known during installation

type Project

type Project struct {
	Name string
	Root string
}

Project encapsulates a dust project

func GetProjects

func GetProjects(root string) ([]*Project, error)

GetProjects returns Project instances for all recognized projects in root

func NewProject

func NewProject(name string, root string) *Project

NewProject creates a Project for the given name and root directory

func SearchProjects

func SearchProjects(projects []*Project, name string) *Project

SearchProjects returns a pointer to the project matching name or nil

func (*Project) GetMetaData

func (p *Project) GetMetaData() (*MetaData, error)

GetMetaData reads and returns any meta data for the project

func (*Project) GetVersion

func (p *Project) GetVersion() (string, error)

GetVersion returns the name of the tag at the current HEAD or the commit hash

func (*Project) IsManaged

func (p *Project) IsManaged() bool

IsManaged returns true if the project appears to be managed as a git repo

func (*Project) Update

func (p *Project) Update(force bool, entry *catalog.Entry) (bool, error)

Update pulls down any changes for the project if it is managed via git, returns true if the project was updated

func (*Project) UpdateMetaData

func (p *Project) UpdateMetaData(md *MetaData)

UpdateMetaData updates the 'update_time' key in the project metadata

Jump to

Keyboard shortcuts

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