本文整理汇总了Golang中github.com/apex/apex/project.Project类的典型用法代码示例。如果您正苦于以下问题:Golang Project类的具体用法?Golang Project怎么用?Golang Project使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Project类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: deploy
// deploy code and config changes.
func deploy(project *project.Project, names []string, env []string) {
for _, s := range env {
parts := strings.Split(s, "=")
project.SetEnv(parts[0], parts[1])
}
if len(names) == 0 {
names = project.FunctionNames()
}
if err := project.DeployAndClean(names); err != nil {
log.Fatalf("error: %s", err)
}
}
开发者ID:jordan-acosta,项目名称:apex,代码行数:15,代码来源:apex.go
示例2: delete
// delete the functions.
func delete(project *project.Project, names []string, force bool) {
if len(names) == 0 {
names = project.FunctionNames()
}
if !force && len(names) > 1 {
fmt.Printf("The following will be deleted:\n\n")
for _, name := range names {
fmt.Printf(" - %s\n", name)
}
fmt.Printf("\n")
}
if !force && !prompt.Confirm("Are you sure? (yes/no)") {
return
}
if err := project.Delete(names); err != nil {
log.Fatalf("error: %s", err)
}
}
开发者ID:jordan-acosta,项目名称:apex,代码行数:22,代码来源:apex.go
示例3: build
// build outputs the generated archive to stdout.
func build(project *project.Project, name []string) {
fn, err := project.FunctionByName(name[0])
if err != nil {
log.Fatalf("error: %s", err)
}
zip, err := fn.Zip()
if err != nil {
log.Fatalf("error: %s", err)
}
_, err = io.Copy(os.Stdout, zip)
if err != nil {
log.Fatalf("error: %s", err)
}
}
开发者ID:jordan-acosta,项目名称:apex,代码行数:17,代码来源:apex.go
示例4: rollback
// rollback the function with optional version.
func rollback(project *project.Project, name []string, version interface{}) {
fn, err := project.FunctionByName(name[0])
if err != nil {
log.Fatalf("error: %s", err)
}
if version == nil {
err = fn.Rollback()
} else {
err = fn.RollbackVersion(version.(string))
}
if err != nil {
log.Fatalf("error: %s", err)
}
}
开发者ID:jordan-acosta,项目名称:apex,代码行数:17,代码来源:apex.go
示例5: invoke
// invoke reads request json from stdin and outputs the responses.
func invoke(project *project.Project, name []string, verbose, async bool) {
dec := json.NewDecoder(os.Stdin)
kind := function.RequestResponse
if async {
kind = function.Event
}
fn, err := project.FunctionByName(name[0])
if err != nil {
log.Fatalf("error: %s", err)
}
for {
var v struct {
Event interface{}
Context interface{}
}
err := dec.Decode(&v)
if err == io.EOF {
break
}
if err != nil {
log.Fatalf("error: %s", err)
}
reply, logs, err := fn.Invoke(v.Event, v.Context, kind)
if err != nil {
log.Fatalf("error: %s", err)
}
// TODO(tj) rename flag to --with-logs or --logs
if verbose {
io.Copy(os.Stderr, logs)
}
io.Copy(os.Stdout, reply)
fmt.Fprintf(os.Stdout, "\n")
}
}
开发者ID:jordan-acosta,项目名称:apex,代码行数:44,代码来源:apex.go
注:本文中的github.com/apex/apex/project.Project类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论