コード例 #1
0
ファイル: upgrade.go プロジェクト: nicholascapo/depman
// Check checks for a newer version of depman on github, the result is written on a channel
// It is expected that this will be called in a goroutine
func Check(ver string) {
	var str string
	checkCalled = true
	channel = make(chan string, 0)

	self = new(dep.Dependency)
	self.Repo = "depman internal upgrade check"

	if timelock.IsStale(self) {
		str, checkError = check(ver)
	} else {
		str = none
	}

	channel <- str
}
コード例 #2
0
ファイル: install.go プロジェクト: pombredanne/depman
// recursively install a DependencyMap
func recursiveInstall(deps dep.DependencyMap, set map[string]string) (err error) {
	for name, d := range deps.Map {
		start := time.Now()

		if duplicate(*d, set) {
			continue
		}

		stale := timelock.IsStale(d.Repo)

		util.PrintDep(name, d.Version, d.Repo, stale)

		subPath := d.Path()
		err = d.VCS.Clone(d)
		if err != nil {
			continue
		}

		util.Cd(subPath)

		if clean {
			d.VCS.Clean(d)
		}

		if stale {
			util.VerboseIndent(" # repo is stale, fetching")
			err = d.VCS.Fetch(d)
			if err != nil {
				continue
			}
		}

		err = d.VCS.Checkout(d)
		if err != nil {
			continue
		}

		if stale {
			err = d.VCS.Update(d)
			if err != nil {
				continue
			}
		}

		util.VerboseIndent(fmt.Sprintf("# time to install: %.3fs", time.Since(start).Seconds()))

		// Recursive
		depsFile := util.UpwardFind(subPath, dep.DepsFile)
		if depsFile != "" && Recurse {
			subDeps, err := dep.Read(depsFile)
			if err != nil {
				util.Print(colors.Red("Error reading deps from '" + depsFile + "': " + err.Error()))
				result.RegisterError()
			} else {
				util.IncreaseIndent()
				recursiveInstall(subDeps, set)
				util.DecreaseIndent()
			}
		}
	}
	return
}