depman

command module
v0.0.0-...-f8895a0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2013 License: MIT Imports: 13 Imported by: 0

README

Depman

Dependency management helper for Golang packages. Supports versioned dependencies, using standard Golang imports.

Copyright 2013 Vubeology, Inc.

Released under the MIT License (see LICENSE).

Installation

git clone git@github.com:vube/depman.git $GOPATH/src/vube/depman
go install github.com/vube/depman

Usage

Run depman in the directory with your deps.json, or use the --path argument to specify the directory where deps.json is located.

Commands
init

Create an empty deps.json

add

Add a dependency (interactive)

install

Install all the dependencies listed in deps.json (default)

update [nickname] [branch]

Update [nickname] to use the latest commit in [branch]

show-frozen

Show dependencies as resolved to commit IDs.

Options
  • --recursive: Descend into dependencies depth-first.
help

Display help message

Options
  • --clean=false: Remove changes to code in dependencies
  • --debug=false: Display debug messages. Implies --verbose
  • --help=false: Display help
  • --no-colors=false: Disable colors
  • --path="./": Directory or full path to .deps.json
  • --silent=false: Don't display normal output. Overrides --debug and --verbose
  • --verbose=false: Display commands as they are run, and other informative messages
  • --version=false: Display version number

Requirements

  • Shall not require any external dependencies for normal operation
  • Testing dependencies shall be installed through depman
  • go vet shall not indicate any problems

Testing

# Setup
cd $GOPATH/github.com/vube/depman
git pull
go install
depman install

# Test
go test -i ./...
go test ./...

# Coverage
gocov test ./... | gocov report

# Vet
go vet ./...

Basic Algorithm

  1. For each dependency:
    1. Use go get to download the dependency
    2. Checkout the specified version
    3. Look in the dependency's directory for a deps.json
      1. Recursively install those dependencies as well
    4. If the dependency type is git-clone then manually run git clone, git fetch, etc as needed
Duplicates

Duplicated dependencies (anywhere in the tree) with identical versions will be skipped (this just saves some time and prevents infinite recursion). Duplicated dependencies with different versions cause a fatal error and must be fixed by the developer.

Non Go-Getable Repos

Some repositories (private bitbucket repos for example), are not supported by go get. To include those repositories in depman:

  1. Change the type to git-clone (hg and bzr are not yet supported)
  2. Change the repo to a full git url (include everything necessary for git clone)
  3. Add an alias section to specify a directory in which to clone, the path is rooted at $GOPATH/src/ See the example below or the included deps.json file.

JSON Structure

[The file must be named deps.json]

{
	"shortname":{
		"repo":"url/to/package, just like in import",
		"version":"commit, tag, or branch",
		"type": "one of 'git', 'bzr', 'hg'"
	},
	"not go getable":{
		"repo":"full git repo url, just like git clone"
		"version":"commit, tag, or branch",
		"type": "git-clone",
		"alias": "target directory to clone into, (optional for every type other than 'git-clone')"
	}
}
Example
{
	"gocheck": {
		"repo": "launchpad.net/gocheck",
		"version": "85",
		"type": "bzr"
	},
	"gocov": {
		"repo": "github.com/axw/gocov/gocov",
		"version": "90c9390",
		"type": "git"
	},
	"gocov-html": {
		"repo": "https://github.com/matm/gocov-html.git",
		"version": "f83448b",
		"type": "git-clone",
		"alias": "github.com/matm/gocov-html"
	},
	"golint": {
		"repo": "github.com/golang/lint",
		"version": "22f4d5e",
		"type": "git"
	}
}

TODO

  • Support manually cloning hg or bzr repositories (add types hg-clone, and bzr-clone)

Documentation

Overview

Dependency Manager for Golang Projects Author: Nicholas Capo <nicholas@vubeology.com>

For help run 'depman help'

Directories

Path Synopsis
Package add implements functions for adding a dependency
Package add implements functions for adding a dependency
Package colors provides functions to optionally wrap strings with ASCII colors codes.
Package colors provides functions to optionally wrap strings with ASCII colors codes.
Package create provides functions to initialize a new deps.json
Package create provides functions to initialize a new deps.json
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
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
Package install provides functions to recursively install dependencies Cleaning of existing changes in dependency repositories is controlled by the --clean flag
Package install provides functions to recursively install dependencies Cleaning of existing changes in dependency repositories is controlled by the --clean flag
Package update provides functions to update a dependency to the latest version
Package update provides functions to update a dependency to the latest version
Package util provides various utility functions.
Package util provides various utility functions.
vcs
Package vcs provides functions to various Version Control Systems
Package vcs provides functions to various Version Control Systems
bzr
git
hg

Jump to

Keyboard shortcuts

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