fn: improve UX and publish/deploy command (#359)

* fn: improve UX and publish/deploy command

* fn: remove wrong use cases for deploy

* fn: fix regression introduced by merge
This commit is contained in:
C Cirello
2016-12-01 18:11:13 +01:00
committed by GitHub
parent c5696b1bbc
commit 9ac2539aeb
39 changed files with 453 additions and 469 deletions

View File

@@ -24,12 +24,11 @@ var (
)
type funcfile struct {
App *string `yaml:"app,omitempty",json:"app,omitempty"`
Name string `yaml:"name,omitempty",json:"name,omitempty"`
Version string `yaml:"version,omitempty",json:"version,omitempty"`
Runtime *string `yaml:"runtime,omitempty",json:"runtime,omitempty"`
Entrypoint *string `yaml:"entrypoint,omitempty",json:"entrypoint,omitempty"`
Route *string `yaml:"route,omitempty",json:"route,omitempty"`
Path *string `yaml:"path,omitempty",json:"path,omitempty"`
Type *string `yaml:"type,omitempty",json:"type,omitempty"`
Memory *int64 `yaml:"memory,omitempty",json:"memory,omitempty"`
Format *string `yaml:"format,omitempty",json:"format,omitempty"`
@@ -62,13 +61,22 @@ func (ff *funcfile) RuntimeTag() (runtime, tag string) {
return rt[:tagpos], rt[tagpos+1:]
}
func findFuncfile() (*funcfile, error) {
func findFuncfile(path string) (string, error) {
for _, fn := range validfn {
if exists(fn) {
return parsefuncfile(fn)
fullfn := filepath.Join(path, fn)
if exists(fullfn) {
return fullfn, nil
}
}
return nil, newNotFoundError("could not find function file")
return "", newNotFoundError("could not find function file")
}
func loadFuncfile() (*funcfile, error) {
fn, err := findFuncfile(".")
if err != nil {
return nil, err
}
return parsefuncfile(fn)
}
func parsefuncfile(path string) (*funcfile, error) {