本文整理汇总了Golang中github.com/globocom/tsuru/repository.GetPath函数的典型用法代码示例。如果您正苦于以下问题:Golang GetPath函数的具体用法?Golang GetPath怎么用?Golang GetPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetPath函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: TestCheckout
func (s *S) TestCheckout(c *gocheck.C) {
p := testing.NewFakeProvisioner()
p.PrepareOutput([]byte("updated"))
app := testing.NewFakeApp("moon", "python", 1)
out, err := checkout(p, app, "5734f0042844fdeb5bbc1b72b18f2dc1779cade7")
c.Assert(err, gocheck.IsNil)
c.Assert(out, gocheck.IsNil)
path, _ := repository.GetPath()
expectedCommand := fmt.Sprintf("cd %s && git checkout 5734f0042844fdeb5bbc1b72b18f2dc1779cade7", path)
c.Assert(p.GetCmds(expectedCommand, app), gocheck.HasLen, 1)
}
开发者ID:rpeterson,项目名称:tsuru,代码行数:11,代码来源:git_test.go
示例2: TestPullRepository
func (s *S) TestPullRepository(c *gocheck.C) {
p := testing.NewFakeProvisioner()
p.PrepareOutput([]byte("pulled"))
app := testing.NewFakeApp("your", "python", 1)
out, err := fetch(p, app)
c.Assert(err, gocheck.IsNil)
c.Assert(string(out), gocheck.Equals, "pulled")
path, _ := repository.GetPath()
expectedCommand := fmt.Sprintf("cd %s && git fetch origin", path)
c.Assert(p.GetCmds(expectedCommand, app), gocheck.HasLen, 1)
}
开发者ID:rpeterson,项目名称:tsuru,代码行数:11,代码来源:git_test.go
示例3: clone
// Clone runs a git clone to clone the app repository in an ap.
func clone(p provision.Provisioner, app provision.App) ([]byte, error) {
var buf bytes.Buffer
path, err := repository.GetPath()
if err != nil {
return nil, fmt.Errorf("Tsuru is misconfigured: %s", err)
}
cmd := fmt.Sprintf("git clone %s %s --depth 1", repository.ReadOnlyURL(app.GetName()), path)
err = p.ExecuteCommand(&buf, &buf, app, cmd)
b := buf.Bytes()
log.Printf(`"git clone" output: %s`, b)
return b, err
}
开发者ID:richardjoo,项目名称:tsuru,代码行数:13,代码来源:git.go
示例4: TestCloneRepository
func (s *S) TestCloneRepository(c *gocheck.C) {
p := testing.NewFakeProvisioner()
p.PrepareOutput([]byte("something"))
app := testing.NewFakeApp("your", "python", 1)
out, err := clone(p, app)
c.Assert(err, gocheck.IsNil)
c.Assert(string(out), gocheck.Equals, "something")
url := repository.ReadOnlyURL(app.GetName())
path, _ := repository.GetPath()
expectedCommand := fmt.Sprintf("git clone %s %s --depth 1", url, path)
c.Assert(p.GetCmds(expectedCommand, app), gocheck.HasLen, 1)
}
开发者ID:richardjoo,项目名称:tsuru,代码行数:12,代码来源:git_test.go
示例5: pull
// Pull runs a git pull to update the code in an app
//
// It works like Clone, pulling from the app bare repository.
func pull(p provision.Provisioner, app provision.App) ([]byte, error) {
var buf bytes.Buffer
path, err := repository.GetPath()
if err != nil {
return nil, fmt.Errorf("Tsuru is misconfigured: %s", err)
}
cmd := fmt.Sprintf("cd %s && git pull origin master", path)
err = p.ExecuteCommand(&buf, &buf, app, cmd)
b := buf.Bytes()
log.Printf(`"git pull" output: %s`, b)
return b, err
}
开发者ID:richardjoo,项目名称:tsuru,代码行数:15,代码来源:git.go
示例6: checkout
// checkout updates the Git repository of the app to the given version.
func checkout(p provision.Provisioner, app provision.App, version string) ([]byte, error) {
var buf bytes.Buffer
path, err := repository.GetPath()
if err != nil {
return nil, fmt.Errorf("Tsuru is misconfigured: %s", err)
}
cmd := fmt.Sprintf("cd %s && git checkout %s", path, version)
if err := p.ExecuteCommand(&buf, &buf, app, cmd); err != nil {
return buf.Bytes(), err
}
return nil, nil
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:13,代码来源:git.go
示例7: loadConfig
func (r *yamlHookRunner) loadConfig(app *App) error {
if r.config != nil {
return nil
}
repoPath, err := repository.GetPath()
if err != nil {
return err
}
err = r.loadConfigFromFile(app, path.Join(repoPath, "app.yaml"))
if err != nil {
err = r.loadConfigFromFile(app, path.Join(repoPath, "app.yml"))
}
return err
}
开发者ID:nkts,项目名称:golang-devops-stuff,代码行数:14,代码来源:hook.go
示例8: TestDeploy
func (s *S) TestDeploy(c *gocheck.C) {
provisioner := testing.NewFakeProvisioner()
provisioner.PrepareOutput([]byte("cloned"))
provisioner.PrepareOutput([]byte("updated"))
app := testing.NewFakeApp("cribcaged", "python", 1)
provisioner.Provision(app)
w := &bytes.Buffer{}
err := Git(provisioner, app, "5734f0042844fdeb5bbc1b72b18f2dc1779cade7", w)
c.Assert(err, gocheck.IsNil)
c.Assert(app.Commands, gocheck.DeepEquals, []string{"restart"})
c.Assert(provisioner.InstalledDeps(app), gocheck.Equals, 1)
cloneCommand := "git clone git://tsuruhost.com/cribcaged.git test/dir --depth 1"
c.Assert(provisioner.GetCmds(cloneCommand, app), gocheck.HasLen, 1)
path, _ := repository.GetPath()
checkoutCommand := fmt.Sprintf("cd %s && git checkout 5734f0042844fdeb5bbc1b72b18f2dc1779cade7", path)
c.Assert(provisioner.GetCmds(checkoutCommand, app), gocheck.HasLen, 1)
}
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:17,代码来源:git_test.go
示例9: loadConf
// loadConf loads app configuration from app.yaml.
func (app *App) loadConf() error {
if app.conf != nil {
return nil
}
app.conf = new(conf)
uRepo, err := repository.GetPath()
if err != nil {
app.Log(fmt.Sprintf("Got error while getting repository path: %s", err), "tsuru")
return err
}
cmd := "cat " + path.Join(uRepo, "app.yaml")
var outStream, errStream bytes.Buffer
if err := Provisioner.ExecuteCommand(&outStream, &errStream, app, cmd); err != nil {
return nil
}
err = goyaml.Unmarshal(outStream.Bytes(), app.conf)
if err != nil {
app.Log(fmt.Sprintf("Got error while parsing yaml: %s", err), "tsuru")
return err
}
return nil
}
开发者ID:paulopatto,项目名称:tsuru,代码行数:23,代码来源:app.go
示例10: loadHooks
// Loads restart hooks from app.conf.
func (a *App) loadHooks() error {
if a.hooks != nil {
return nil
}
a.hooks = new(conf)
uRepo, err := repository.GetPath()
if err != nil {
a.Log(fmt.Sprintf("Got error while getting repository path: %s", err), "tsuru")
return err
}
cmd := "cat " + path.Join(uRepo, "app.conf")
var buf bytes.Buffer
err = a.run(cmd, &buf)
if err != nil {
a.Log(fmt.Sprintf("Got error while executing command: %s... Skipping hooks execution", err), "tsuru")
return nil
}
err = goyaml.Unmarshal(buf.Bytes(), a.hooks)
if err != nil {
a.Log(fmt.Sprintf("Got error while parsing yaml: %s", err), "tsuru")
return err
}
return nil
}
开发者ID:JoeyFan,项目名称:tsuru,代码行数:25,代码来源:app.go
示例11: loadConf
// loadHooks loads app configuration from app.yaml.
func (app *App) loadConf() error {
if app.conf != nil {
return nil
}
app.conf = new(conf)
uRepo, err := repository.GetPath()
if err != nil {
app.Log(fmt.Sprintf("Got error while getting repository path: %s", err), "tsuru")
return err
}
cmd := "cat " + path.Join(uRepo, "app.yaml")
var buf bytes.Buffer
err = app.run(cmd, &buf)
if err != nil {
app.Log(fmt.Sprintf("Got error while reading app.yaml: %s...\nSkipping hooks execution", err), "tsuru")
return nil
}
err = goyaml.Unmarshal(buf.Bytes(), app.conf)
if err != nil {
app.Log(fmt.Sprintf("Got error while parsing yaml: %s", err), "tsuru")
return err
}
return nil
}
开发者ID:richardjoo,项目名称:tsuru,代码行数:25,代码来源:app.go
注:本文中的github.com/globocom/tsuru/repository.GetPath函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论