// Self upgrades this version of depman to the latest on the master branch func Self() { deps := dep.New() d := new(dep.Dependency) d.Repo = "github.com/vube/depman" d.Version = "master" d.Type = "git" d.SetupVCS("depman") deps.Map["depman"] = d install.Recurse = false install.Install(deps) install.Recurse = true util.RunCommand("go install github.com/vube/depman") }
// Add interactively prompts the user for details of a dependency, adds it to deps.json, and writes out the file func Add(deps dep.DependencyMap, name string) { var cont = true _, exists := deps.Map[name] if exists { util.Fatal(colors.Red("Dependency '" + name + "'' is already defined, pick another name.")) } util.Print(colors.Blue("Adding: ") + name) for cont { d := new(dep.Dependency) d.Type = promptType("Type", "git, git-clone, hg, bzr") if d.Type == dep.TypeGitClone { d.Repo = promptString("Repo", "git url") } else { d.Repo = promptString("Repo", "go import") } d.Version = promptString("Version", "hash, branch, or tag") if d.Type == dep.TypeGitClone { d.Alias = promptString("Alias", "where to install the repo") } deps.Map[name] = d cont = promptBool("Add another", "y/N") } for name, d := range deps.Map { err := d.SetupVCS(name) if err != nil { delete(deps.Map, name) } } err := deps.Write() if err != nil { util.Fatal(colors.Red("Error Writing " + deps.Path + ": " + err.Error())) } install.Install(deps) return }