module

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2021 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllModulePaths

func GetAllModulePaths(workspaceRoot string) map[string]string

GetAllModulePaths returns all the names and paths of all modules in the workspace.

func SetupModule

func SetupModule(mod Module)

SetupModule runs the SETUP.go file in the root directory of `mod` (it if exists).

func WriteModuleFile

func WriteModuleFile(modulePath string, deps []Dependency)

WriteModuleFile serializes and writes a Module's Dependencies to a MODULE file.

Types

type Dependency

type Dependency struct {
	URL     string
	Version string
}

Dependency represents a dependency one module has on another module.

func ReadModuleFile

func ReadModuleFile(modulePath string) []Dependency

ReadModuleFile reads and parses module Dependencies from a MODULE file.

func (Dependency) ModuleName

func (d Dependency) ModuleName() string

ModuleName parses the module name from the Dependency's URL.

type GitModule

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

GitModule is a module backed by a git repository.

func (GitModule) CheckedOutVersions

func (m GitModule) CheckedOutVersions() []string

CheckedOutVersions returns all currently checked out versions. This includes the HEAD commit hash and all annotated tags that point to HEAD.

func (GitModule) CheckoutVersion

func (m GitModule) CheckoutVersion(version string)

CheckoutVersion changes the current module's version to `version`.

func (GitModule) Fetch

func (m GitModule) Fetch() bool

Fetch fetches changes from the 'origin' remote and reports whether any updates have bee fetched.

func (GitModule) HasOrigin

func (m GitModule) HasOrigin(url string) bool

HasOrigin returns whether the underlying repository has a remote called origin that matches `url`.

func (GitModule) HasVersionCheckedOut

func (m GitModule) HasVersionCheckedOut(version string) bool

HasVersionCheckedOut returns whether the current module's version matches `version`.

func (GitModule) IsDirty

func (m GitModule) IsDirty() bool

IsDirty returns whether the underlying repository has any uncommited changes.

func (GitModule) Name

func (m GitModule) Name() string

Name returns the name of the module.

func (GitModule) Path

func (m GitModule) Path() string

Path returns the on-disk path of the module.

type Module

type Module interface {
	Path() string
	Name() string
	IsDirty() bool
	HasOrigin(string) bool
	HasVersionCheckedOut(version string) bool
	CheckoutVersion(version string)
	Fetch() bool
	CheckedOutVersions() []string
}

Module represents a checked-out module.

func CreateGitModule

func CreateGitModule(modulePath, url string) Module

CreateGitModule creates a new GitModule in the given `modulePath` by cloning the repository from `url`.

func CreateTarModule

func CreateTarModule(modulePath, url string) Module

CreateTarModule creates a new TarModule in the given `modulePath` by downloading and extracting the TAR archive reference by `url`. The origin of the module (i.e., the download url) is stored in a ".metadata" file inside the module directory.

func OpenModule

func OpenModule(modulePath string) Module

OpenModule opens a module checked out on disk.

func OpenOrCreateModule

func OpenOrCreateModule(modulePath string, url string) Module

OpenOrCreateModule tries to open the module in `modulePath`. If the `modulePath` directory does not yet exists, it tries to create a new module by cloning / downloading the module from `url`.

type TarModule

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

TarModule is a module backed by a tar.gz archive. TarModules only have a single "master" version.

func (TarModule) CheckedOutVersions

func (m TarModule) CheckedOutVersions() []string

CheckedOutVersions returns all currently checked ot versions. For TarModules this is always the default version.

func (TarModule) CheckoutVersion

func (m TarModule) CheckoutVersion(version string)

CheckoutVersion changes the module's current version to `version` if possible. However, TarModules only have a single "master" version. Attempting to check out any other version results in an error.

func (TarModule) Fetch

func (m TarModule) Fetch() bool

Fetch does nothing on TarModules and reports that no changes have been fetched.

func (TarModule) HasOrigin

func (m TarModule) HasOrigin(url string) bool

HasOrigin returns whether the origin of the module matches `url` by checking the ".metadata" file inside the module directory.

func (TarModule) HasVersionCheckedOut

func (m TarModule) HasVersionCheckedOut(version string) bool

HasVersionCheckedOut returns whether the module's current version matched `version`. However, TarModules only have a single "master" version.

func (TarModule) IsDirty

func (m TarModule) IsDirty() bool

IsDirty returns whether the module has any uncommited changes. TarModules never have any uncommited changes by definition.

func (TarModule) Name

func (m TarModule) Name() string

Name returns the name of the module.

func (TarModule) Path

func (m TarModule) Path() string

Path returns the on-disk path of the module.

Jump to

Keyboard shortcuts

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