Documentation ¶
Overview ¶
Package dep provides a Dependency struct, a DependencyMap from nicknames (strings) to Dependencies, and functions to read and write a DependencyMap to a deps.json file
Index ¶
- Constants
- Variables
- func GetPath(p string) (result string)
- type Bzr
- func (b *Bzr) Checkout(d *Dependency) (err error)
- func (b *Bzr) Clean(d *Dependency)
- func (b *Bzr) Clone(d *Dependency) (err error)
- func (b *Bzr) Fetch(d *Dependency) (err error)
- func (b *Bzr) GetHead(d *Dependency) (hash string, err error)
- func (b *Bzr) LastCommit(d *Dependency, branch string) (hash string, err error)
- func (b *Bzr) Update(d *Dependency) (err error)
- type Dependency
- type DependencyMap
- type Git
- func (g *Git) Checkout(d *Dependency) (err error)
- func (g *Git) Clean(d *Dependency)
- func (g *Git) Clone(d *Dependency) (err error)
- func (g *Git) Fetch(d *Dependency) (err error)
- func (g *Git) GetHead(d *Dependency) (hash string, err error)
- func (g *Git) LastCommit(d *Dependency, branch string) (hash string, err error)
- func (g *Git) Update(d *Dependency) (err error)
- type Hg
- func (h *Hg) Checkout(d *Dependency) (err error)
- func (h *Hg) Clean(d *Dependency)
- func (h *Hg) Clone(d *Dependency) (err error)
- func (h *Hg) Fetch(d *Dependency) (err error)
- func (h *Hg) GetHead(d *Dependency) (hash string, err error)
- func (h *Hg) LastCommit(d *Dependency, branch string) (hash string, err error)
- func (h *Hg) Update(d *Dependency) (err error)
- type VersionControl
Constants ¶
const ( TypeGit = "git" TypeHg = "hg" TypeBzr = "bzr" TypeGitClone = "git-clone" )
Dependency Types
const DepsFile string = "deps.json"
DepsFile is the name of the dependency file
Variables ¶
var ( // ErrUnknownType indicates that an unknown dependency type was found ErrUnknownType = errors.New("unknown dependency type") // ErrMissingAlias indicates that a git-clone dependency requires an alias field ErrMissingAlias = errors.New("dependency type git-clone requires alias field") )
Functions ¶
Types ¶
type Bzr ¶
type Bzr struct{}
Bzr implements the VersionControl interface by using Bazaar
func (*Bzr) Checkout ¶
func (b *Bzr) Checkout(d *Dependency) (err error)
Checkout updates a bzr repo
func (*Bzr) GetHead ¶
func (b *Bzr) GetHead(d *Dependency) (hash string, err error)
GetHead - Render a revspec to a commit ID
func (*Bzr) LastCommit ¶
func (b *Bzr) LastCommit(d *Dependency, branch string) (hash string, err error)
LastCommit retrieves the version number of the last commit on branch Assumes that the current working directory is in the bzr repo
type Dependency ¶
type Dependency struct { Repo string `json:"repo"` Version string `json:"version"` Type string `json:"type"` Alias string `json:"alias,omitempty"` SkipCache bool `json:"skip-cache,omitempty"` VCS VersionControl `json:"-"` }
Dependency defines a single dependency
func (*Dependency) Path ¶
func (d *Dependency) Path() (p string)
Path returns the path for this dependency searches for the appropriate directory in each part of the GOPATH (delimited by ':') if not found return the path using the first port of GOPATH
func (*Dependency) SetupVCS ¶
func (d *Dependency) SetupVCS(name string) (err error)
SetupVCS configures the VCS depending on the type
type DependencyMap ¶
type DependencyMap struct { Map map[string]*Dependency Path string }
DependencyMap defines a set of dependencies
func Read ¶
func Read(filename string) (deps DependencyMap, err error)
Read reads filename and parses the content into a DependencyMap
func (*DependencyMap) Write ¶
func (d *DependencyMap) Write() (err error)
Write the dependencyMap back into to the file it was read from
type Git ¶
type Git struct{}
Git implements the VersionControl interface by using Git
func (*Git) Checkout ¶
func (g *Git) Checkout(d *Dependency) (err error)
Checkout uses the appropriate VCS to checkout the specified version of the code
func (*Git) Clean ¶
func (g *Git) Clean(d *Dependency)
Clean cleans a git repo: `git reset --hard HEAD ; git clean -fd`
func (*Git) Clone ¶
func (g *Git) Clone(d *Dependency) (err error)
Clone clones d.Repo into d.Path() if d.Path does not exist, otherwise it will cd to d.Path() and run git fetch
func (*Git) GetHead ¶
func (g *Git) GetHead(d *Dependency) (hash string, err error)
GetHead - Render a revspec to a commit ID
func (*Git) LastCommit ¶
func (g *Git) LastCommit(d *Dependency, branch string) (hash string, err error)
LastCommit retrieves the version number of the last commit on branch Assumes that the current working directory is in the git repo
type Hg ¶
type Hg struct{}
Hg implements the VersionControl interface by using Mercurial
func (*Hg) Checkout ¶
func (h *Hg) Checkout(d *Dependency) (err error)
Checkout updates a mercurial repo
func (*Hg) Clone ¶
func (h *Hg) Clone(d *Dependency) (err error)
Clone uses go get to clone a mercurial repo
func (*Hg) GetHead ¶
func (h *Hg) GetHead(d *Dependency) (hash string, err error)
GetHead - Render a revspec to a commit ID
func (*Hg) LastCommit ¶
func (h *Hg) LastCommit(d *Dependency, branch string) (hash string, err error)
LastCommit retrieves the version number of the last commit on branch Assumes that the current working directory is in the hg repo
type VersionControl ¶
type VersionControl interface { Clone(d *Dependency) (err error) // Get changes from the server Fetch(d *Dependency) (err error) // Pull/Merge/Update this branch Update(d *Dependency) (err error) Checkout(d *Dependency) (err error) LastCommit(d *Dependency, branch string) (hash string, err error) GetHead(d *Dependency) (to_return string, err error) Clean(d *Dependency) }
VersionControl is an interface that define a standard set of operations that can be completed by a version control system