Example #1
0
func routes(reg *cookoo.Registry, cxt cookoo.Context) {
	reg.Route("@startup", "Parse args and send to the right subcommand.").
		// TODO: Add setup for debug in addition to quiet.
		Does(cmd.BeQuiet, "quiet").
		Using("quiet").From("cxt:q").
		Does(cmd.VersionGuard, "v")

	reg.Route("@ready", "Prepare for glide commands.").
		Does(cmd.ReadyToGlide, "ready").Using("filename").From("cxt:yaml").
		Does(cmd.ParseYaml, "cfg").Using("filename").From("cxt:yaml")

	reg.Route("get", "Install a pkg in vendor, and store the results in the glide.yaml").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.GetAll, "goget").
		Using("filename").From("cxt:yaml").
		Using("packages").From("cxt:packages").
		Using("conf").From("cxt:cfg").
		Does(cmd.MergeToYaml, "merged").Using("conf").From("cxt:cfg").
		Does(cmd.Recurse, "recurse").Using("conf").From("cxt:cfg").
		Using("enable").From("cxt:recursiveDependencies").
		Using("importGodeps").From("cxt:importGodeps").
		Using("importGPM").From("cxt:importGPM").
		Using("importGb").From("cxt:importGb").
		Using("force").From("cxt:forceUpdate").WithDefault(false).
		Using("packages").From("cxt:packages").
		Does(cmd.WriteYaml, "out").
		Using("yaml.Node").From("cxt:merged").
		Using("filename").WithDefault("glide.yaml").From("cxt:yaml")

	reg.Route("exec", "Execute command with GOPATH set.").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.ExecCmd, "cmd").
		Using("args").From("cxt:cliArgs").
		Using("filename").From("cxt:yaml")

	reg.Route("update", "Update dependencies.").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.CowardMode, "_").
		Does(cmd.Mkdir, "dir").Using("dir").WithDefault(VendorDir).
		Does(cmd.DeleteUnusedPackages, "deleted").
		Using("conf").From("cxt:cfg").
		Using("optIn").From("cxt:deleteOptIn").
		Does(cmd.VendoredSetup, "cfg").
		Using("conf").From("cxt:cfg").
		Using("update").From("cxt:updateVendoredDeps").
		Does(cmd.UpdateImports, "dependencies").
		Using("conf").From("cxt:cfg").
		Using("force").From("cxt:forceUpdate").
		Using("packages").From("cxt:packages").
		Does(cmd.SetReference, "version").Using("conf").From("cxt:cfg").
		Does(cmd.Recurse, "recurse").Using("conf").From("cxt:cfg").
		Using("deleteFlatten").From("cxt:deleteFlatten").
		Using("importGodeps").From("cxt:importGodeps").
		Using("importGPM").From("cxt:importGPM").
		Using("importGb").From("cxt:importGb").
		Using("enable").From("cxt:recursiveDependencies").
		Using("force").From("cxt:forceUpdate").
		Using("packages").From("cxt:packages").
		Does(cmd.VendoredCleanUp, "_").
		Using("conf").From("cxt:cfg").
		Using("update").From("cxt:updateVendoredDeps")

	//Does(cmd.Rebuild, "rebuild").Using("conf").From("cxt:cfg")

	reg.Route("rebuild", "Rebuild dependencies").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.CowardMode, "_").
		Does(cmd.Rebuild, "rebuild").Using("conf").From("cxt:cfg")

	reg.Route("pin", "Print a YAML file with all of the packages pinned to the current version.").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.UpdateReferences, "refs").Using("conf").From("cxt:cfg").
		Does(cmd.MergeToYaml, "merged").Using("conf").From("cxt:cfg").
		Does(cmd.WriteYaml, "out").
		Using("yaml.Node").From("cxt:merged").
		Using("filename").From("cxt:toPath")

	reg.Route("import gpm", "Read a Godeps file").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.GPMGodeps, "godeps").
		Does(cmd.AddDependencies, "addGodeps").
		Using("dependencies").From("cxt:godeps").
		Using("conf").From("cxt:cfg").
		Does(cmd.GPMGodepsGit, "godepsGit").
		Does(cmd.AddDependencies, "addGodepsGit").
		Using("dependencies").From("cxt:godepsGit").
		Using("conf").From("cxt:cfg").
		// Does(cmd.UpdateReferences, "refs").Using("conf").From("cxt:cfg").
		Does(cmd.MergeToYaml, "merged").Using("conf").From("cxt:cfg").
		Does(cmd.WriteYaml, "out").Using("yaml.Node").From("cxt:merged")

	reg.Route("import godep", "Read a Godeps.json file").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.ParseGodepGodeps, "godeps").
		Does(cmd.AddDependencies, "addGodeps").
		Using("dependencies").From("cxt:godeps").
		Using("conf").From("cxt:cfg").
		// Does(cmd.UpdateReferences, "refs").Using("conf").From("cxt:cfg").
		Does(cmd.MergeToYaml, "merged").Using("conf").From("cxt:cfg").
		Does(cmd.WriteYaml, "out").Using("yaml.Node").From("cxt:merged")

	reg.Route("import gb", "Read a vendor/manifest file").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.GbManifest, "manifest").
		Does(cmd.AddDependencies, "addGodeps").
		Using("dependencies").From("cxt:manifest").
		Using("conf").From("cxt:cfg").
		Does(cmd.MergeToYaml, "merged").Using("conf").From("cxt:cfg").
		Does(cmd.WriteYaml, "out").Using("yaml.Node").From("cxt:merged")

	reg.Route("guess", "Guess dependencies").
		Includes("@ready").
		Does(cmd.GuessDeps, "cfg").
		Does(cmd.MergeToYaml, "merged").Using("conf").From("cxt:cfg").
		Does(cmd.WriteYaml, "out").
		Using("yaml.Node").From("cxt:merged").
		Using("filename").From("cxt:toPath")

	reg.Route("create", "Initialize Glide").
		Includes("@startup").
		Does(cmd.InitGlide, "init").
		Using("filename").From("cxt:yaml").
		Using("project").From("cxt:project").WithDefault("main")

	reg.Route("name", "Print environment").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.PrintName, "status").
		Using("conf").From("cxt:cfg")

	reg.Route("tree", "Print a dependency graph.").
		Includes("@startup").
		Does(cmd.Tree, "tree")
	reg.Route("list", "Print a dependency graph.").
		Includes("@startup").
		Does(cmd.ListDeps, "list")

	reg.Route("nv", "No Vendor").
		Includes("@startup").
		Does(cmd.NoVendor, "paths").
		Does(cmd.PathString, "out").Using("paths").From("cxt:paths")

	reg.Route("about", "Status").
		Includes("@startup").
		Does(cmd.About, "about")

	reg.Route("@plugin", "Try to send to a plugin.").
		Includes("@ready").
		Does(cmd.DropToShell, "plugin").
		Using("command").From("cxt:command")
}
Example #2
0
File: glide.go Project: rudle/glide
func routes(reg *cookoo.Registry, cxt cookoo.Context) {
	reg.Route("@startup", "Parse args and send to the right subcommand.").
		// TODO: Add setup for debug in addition to quiet.
		Does(cmd.BeQuiet, "quiet").
		Using("quiet").From("cxt:q").
		Using("debug").From("cxt:debug").
		Does(cmd.CheckColor, "no-color").
		Using("no-color").From("cxt:no-color").
		Does(cmd.VersionGuard, "v")

	reg.Route("@ready", "Prepare for glide commands.").
		Does(cmd.ReadyToGlide, "ready").Using("filename").From("cxt:yaml").
		Does(cmd.ParseYaml, "cfg").Using("filename").From("cxt:yaml").
		Does(cmd.EnsureCacheDir, "_").Using("home").From("cxt:home")

	reg.Route("get", "Install a pkg in vendor, and store the results in the glide.yaml").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.CowardMode, "_").
		Does(cmd.GetAll, "goget").
		Using("packages").From("cxt:packages").
		Using("conf").From("cxt:cfg").
		Using("insecure").From("cxt:insecure").
		Does(cmd.VendoredSetup, "cfg").
		Using("conf").From("cxt:cfg").
		Using("update").From("cxt:updateVendoredDeps").
		Does(cmd.UpdateImports, "dependencies").
		Using("conf").From("cxt:cfg").
		Using("force").From("cxt:forceUpdate").
		//Using("packages").From("cxt:packages").
		Using("home").From("cxt:home").
		Using("cache").From("cxt:useCache").
		Using("cacheGopath").From("cxt:cacheGopath").
		Using("useGopath").From("cxt:useGopath").
		Does(cmd.SetReference, "version").Using("conf").From("cxt:cfg").
		Does(cmd.Flatten, "flattened").Using("conf").From("cxt:cfg").
		//Using("packages").From("cxt:packages").
		Using("force").From("cxt:forceUpdate").
		Using("home").From("cxt:home").
		Using("cache").From("cxt:useCache").
		Using("cacheGopath").From("cxt:cacheGopath").
		Using("useGopath").From("cxt:useGopath").
		Does(cmd.VendoredCleanUp, "_").
		Using("conf").From("cxt:flattened").
		Using("update").From("cxt:updateVendoredDeps").
		Does(cmd.WriteYaml, "out").
		Using("conf").From("cxt:cfg").
		Using("filename").WithDefault("glide.yaml").From("cxt:yaml").
		Does(cmd.WriteLock, "lock").
		Using("lockfile").From("cxt:Lockfile")

	reg.Route("install", "Install dependencies.").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.CowardMode, "_").
		Does(cmd.LockFileExists, "_").
		Does(cmd.LoadLockFile, "lock").
		Using("conf").From("cxt:cfg").
		Does(cmd.Mkdir, "dir").Using("dir").WithDefault(VendorDir).
		Does(cmd.DeleteUnusedPackages, "deleted").
		Using("conf").From("cxt:cfg").
		Using("optIn").From("cxt:deleteOptIn").
		Does(cmd.VendoredSetup, "cfg").
		Using("conf").From("cxt:cfg").
		Using("update").From("cxt:updateVendoredDeps").
		Does(cmd.Install, "icfg").
		Using("conf").From("cxt:cfg").
		Using("lock").From("cxt:lock").
		Using("home").From("cxt:home").
		Does(cmd.SetReference, "version").Using("conf").From("cxt:icfg").
		Does(cmd.VendoredCleanUp, "_").
		Using("conf").From("cxt:icfg").
		Using("update").From("cxt:updateVendoredDeps")

	reg.Route("update", "Update dependencies.").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.CowardMode, "_").
		Does(cmd.Mkdir, "dir").Using("dir").WithDefault(VendorDir).
		Does(cmd.DeleteUnusedPackages, "deleted").
		Using("conf").From("cxt:cfg").
		Using("optIn").From("cxt:deleteOptIn").
		Does(cmd.VendoredSetup, "cfg").
		Using("conf").From("cxt:cfg").
		Using("update").From("cxt:updateVendoredDeps").
		Does(cmd.UpdateImports, "dependencies").
		Using("conf").From("cxt:cfg").
		Using("force").From("cxt:forceUpdate").
		Using("packages").From("cxt:packages").
		Using("home").From("cxt:home").
		Using("cache").From("cxt:useCache").
		Using("cacheGopath").From("cxt:cacheGopath").
		Using("useGopath").From("cxt:useGopath").
		Does(cmd.SetReference, "version").Using("conf").From("cxt:cfg").
		Does(cmd.Flatten, "flattened").Using("conf").From("cxt:cfg").
		//Using("packages").From("cxt:packages").
		Using("force").From("cxt:forceUpdate").
		Using("skip").From("cxt:skipFlatten").
		Using("home").From("cxt:home").
		Using("cache").From("cxt:useCache").
		Using("cacheGopath").From("cxt:cacheGopath").
		Using("useGopath").From("cxt:useGopath").
		Does(cmd.VendoredCleanUp, "_").
		Using("conf").From("cxt:flattened").
		Using("update").From("cxt:updateVendoredDeps").
		Does(cmd.WriteYaml, "out").
		Using("conf").From("cxt:cfg").
		Using("filename").From("cxt:toPath").
		Using("toStdout").From("cxt:toStdout").
		Does(cmd.WriteLock, "lock").
		Using("lockfile").From("cxt:Lockfile").
		Using("skip").From("cxt:skipFlatten")

	//Does(cmd.Rebuild, "rebuild").Using("conf").From("cxt:cfg")

	reg.Route("rebuild", "Rebuild dependencies").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.CowardMode, "_").
		Does(cmd.Rebuild, "rebuild").Using("conf").From("cxt:cfg")

	reg.Route("pin", "Print a YAML file with all of the packages pinned to the current version.").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.Flatten, "flattened").Using("conf").From("cxt:cfg").
		Using("packages").From("cxt:packages").
		Using("force").From("cxt:forceUpdate").
		Using("skip").From("cxt:skipFlatten").
		Using("home").From("cxt:home").
		Using("cache").From("cxt:useCache").
		Using("cacheGopath").From("cxt:cacheGopath").
		Using("useGopath").From("cxt:useGopath").
		//Does(cmd.VendoredCleanUp, "_").
		//Using("conf").From("cxt:flattened").
		//Using("update").From("cxt:updateVendoredDeps").
		// Write the Lockfile
		Does(cmd.WriteYaml, "out").
		Using("conf").From("cxt:Lockfile").
		Using("filename").From("cxt:toPath").
		Using("toStdout").From("cxt:toStdout")

	reg.Route("import gpm", "Read a Godeps file").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.GPMGodeps, "godeps").
		Does(cmd.AddDependencies, "addGodeps").
		Using("dependencies").From("cxt:godeps").
		Using("conf").From("cxt:cfg").
		Does(cmd.GPMGodepsGit, "godepsGit").
		Does(cmd.AddDependencies, "addGodepsGit").
		Using("dependencies").From("cxt:godepsGit").
		Using("conf").From("cxt:cfg").
		// Does(cmd.UpdateReferences, "refs").Using("conf").From("cxt:cfg").
		Does(cmd.WriteYaml, "out").Using("conf").From("cxt:cfg").
		Using("filename").From("cxt:toPath")

	reg.Route("import godep", "Read a Godeps.json file").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.ParseGodepGodeps, "godeps").
		Does(cmd.AddDependencies, "addGodeps").
		Using("dependencies").From("cxt:godeps").
		Using("conf").From("cxt:cfg").
		// Does(cmd.UpdateReferences, "refs").Using("conf").From("cxt:cfg").
		Does(cmd.WriteYaml, "out").Using("conf").From("cxt:cfg").
		Using("filename").From("cxt:toPath")

	reg.Route("import gb", "Read a vendor/manifest file").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.GbManifest, "manifest").
		Does(cmd.AddDependencies, "addGodeps").
		Using("dependencies").From("cxt:manifest").
		Using("conf").From("cxt:cfg").
		Does(cmd.WriteYaml, "out").Using("conf").From("cxt:cfg").
		Using("filename").From("cxt:toPath")

	reg.Route("create", "Guess dependencies").
		Includes("@startup").
		Does(cmd.GuardYaml, "_").
		Using("filename").From("cxt:yaml").
		Does(cmd.GuessDeps, "cfg").
		Using("skipImport").From("cxt:skipImport").
		Does(cmd.WriteYaml, "out").
		Using("conf").From("cxt:cfg").
		Using("filename").From("cxt:yaml")

	reg.Route("name", "Print environment").
		Includes("@startup").
		Includes("@ready").
		Does(cmd.PrintName, "status").
		Using("conf").From("cxt:cfg")

	reg.Route("tree", "Print a dependency graph.").
		Includes("@startup").
		Does(cmd.Tree, "tree")
	reg.Route("list", "Print a dependency graph.").
		Includes("@startup").
		Does(cmd.ListDeps, "list")

	reg.Route("nv", "No Vendor").
		Includes("@startup").
		Does(cmd.NoVendor, "paths").
		Does(cmd.PathString, "out").Using("paths").From("cxt:paths")

	reg.Route("about", "Status").
		Includes("@startup").
		Does(cmd.About, "about")

	reg.Route("@plugin", "Try to send to a plugin.").
		Includes("@ready").
		Does(cmd.DropToShell, "plugin").
		Using("command").From("cxt:command")
}