本文整理匯總了Golang中github.com/vube/depman/util.RunCommand函數的典型用法代碼示例。如果您正苦於以下問題:Golang RunCommand函數的具體用法?Golang RunCommand怎麽用?Golang RunCommand使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了RunCommand函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Clone
// Clone clones d.Repo into d.Path() if d.Path does not exist, otherwise it will cd to d.Path() and run git fetch
func (g *Git) Clone(d *Dependency) (err error) {
if !util.Exists(d.Path()) {
if d.Type == TypeGitClone {
err = util.RunCommand("git clone " + d.Repo + " " + d.Path())
} else {
err = util.RunCommand("go get -u " + d.Repo)
}
}
return
}
示例2: Checkout
// Checkout uses the appropriate VCS to checkout the specified version of the code
func (g *Git) Checkout(d *Dependency) (err error) {
err = util.RunCommand("git checkout " + d.Version)
if err != nil {
err = g.Fetch(d)
if err == nil {
err = util.RunCommand("git checkout " + d.Version)
}
}
return
}
示例3: Self
// 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")
}
示例4: Self
// Self upgrades this version of depman to the latest on the master branch
func Self(version string) {
selfCalled = true
util.Print(colors.Blue("Upgrading depman..."))
util.RunCommand("go get -u github.com/vube/depman")
cmd := exec.Command("depman", "--version")
out, err := cmd.CombinedOutput()
if err != nil {
result.RegisterError()
util.Print(colors.Red(string(out)))
return
}
newVersion := strings.TrimSuffix(strings.TrimPrefix(string(out), "Depman Version "), "\n")
if newVersion != version {
util.Print("Upgraded to Version " + newVersion)
} else {
util.Print("No upgrade found")
}
}
示例5: Clean
// Clean cleans a git repo: `git reset --hard HEAD ; git clean -fd`
func (g *Git) Clean(d *Dependency) {
util.PrintIndent(colors.Red("Cleaning:") + colors.Blue(" git reset --hard HEAD"))
util.RunCommand("git reset --hard HEAD")
util.RunCommand("git clean -fd")
return
}
示例6: Fetch
// Fetch fetches a git repo
func (g *Git) Fetch(d *Dependency) (err error) {
err = util.RunCommand("git fetch origin")
return
}
示例7: Update
// Update updates a git repo
func (g *Git) Update(d *Dependency) (err error) {
if g.isBranch(d.Version) {
err = util.RunCommand("git pull")
}
return
}
示例8: Checkout
// Checkout updates a bzr repo
func (b *Bzr) Checkout(d *Dependency) (err error) {
err = util.RunCommand("bzr up --revision " + d.Version)
return
}
示例9: Fetch
// Fetch pulls in a bzr repo
func (b *Bzr) Fetch(d *Dependency) (err error) {
err = util.RunCommand("bzr pull")
return
}
示例10: Clone
// Clone clones a bzr repo
func (b *Bzr) Clone(d *Dependency) (err error) {
if !util.Exists(d.Path()) {
err = util.RunCommand("go get -u " + d.Repo)
}
return
}
示例11: Clean
func (h *Hg) Clean(d *Dependency) {
util.PrintIndent(colors.Red("Cleaning:") + colors.Blue(" hg up --clean "+d.Version))
util.RunCommand("hg up --clean " + d.Version)
return
}
示例12: Checkout
func (h *Hg) Checkout(d *Dependency) (err error) {
err = util.RunCommand("hg up " + d.Version)
return
}
示例13: Fetch
func (h *Hg) Fetch(d *Dependency) (err error) {
err = util.RunCommand("hg pull")
return
}