Browse Source

command install add support for use tag, branch or commit for packages in github.com

pull/103/head
Unknown 12 years ago
parent
commit
113a4420e6
  1. 2
      doc/struct.go
  2. 30
      install.go

2
doc/struct.go

@ -14,7 +14,7 @@ import (
type Node struct {
ImportPath string `json:"import_path"`
Type, Value string
Deps []*Node `json:"-"` // Dependencies.
Deps []*Node // Dependencies.
}
// Bundle represents a bundle.

30
install.go

@ -148,26 +148,24 @@ func runInstall(cmd *Command, args []string) {
fmt.Println("Well done.")
}
// chekcDeps checks dependencies of nodes.
func chekcDeps(nodes []*doc.Node) (depnodes []*doc.Node) {
for _, n := range nodes {
// Make sure it will not download all dependencies automatically.
if len(n.Value) == 0 {
n.Value = "B"
}
depnodes = append(depnodes, n)
depnodes = append(depnodes, chekcDeps(n.Deps)...)
}
return depnodes
}
// checkLocalBundles checks if the bundle is in local file system.
func checkLocalBundles(bundle string) (nodes []*doc.Node) {
for _, b := range localBundles {
if bundle == b.Name {
for _, n := range b.Nodes {
// Make sure it will not download all dependencies automatically.
if len(n.Value) == 0 {
n.Value = "B"
}
nodes = append(nodes, n)
// Check dependencies.
for _, d := range n.Deps {
// Make sure it will not download all dependencies automatically.
if len(d.Value) == 0 {
d.Value = "B"
}
nodes = append(nodes, d)
}
}
nodes = append(nodes, chekcDeps(b.Nodes)...)
return nodes
}
}

Loading…
Cancel
Save