Skip to content

Commit

Permalink
🥚 Allow to deploy unknown project
Browse files Browse the repository at this point in the history
  • Loading branch information
jysperm committed Jul 13, 2018
1 parent 9b61952 commit 1389ed3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion commands/deploy_action.go
Expand Up @@ -34,7 +34,9 @@ func uploadProject(appID string, repoPath string, ignoreFilePath string) (*uploa
archiveFile := filepath.Join(fileDir, "leanengine.zip")

runtime, err := runtimes.DetectRuntime(repoPath)
if err != nil {
if err == runtimes.ErrRuntimeNotFound {
logp.Error("无法识别项目目录结构,若部署失败请检查当前项目目录是否正确")
} else if err != nil {
return nil, err
}

Expand Down
10 changes: 7 additions & 3 deletions runtimes/runtime.go
Expand Up @@ -16,8 +16,7 @@ import (
"github.com/leancloud/lean-cli/utils"
)

// ErrInvalidRuntime means the project's structure is not a valid LeanEngine project
var ErrInvalidRuntime = errors.New("错误的项目目录结构,请确保当前运行目录是正确的云引擎项目")
var ErrRuntimeNotFound = errors.New("不支持的项目目录结构,请确保当前运行目录是正确的云引擎项目")

type filesPattern struct {
Includes []string
Expand Down Expand Up @@ -157,7 +156,12 @@ func DetectRuntime(projectPath string) (*Runtime, error) {
logp.Info("检测到 DotNet 运行时")
return newDotnetRuntime(projectPath)
}
return nil, ErrInvalidRuntime

return &Runtime{
ProjectPath: projectPath,
Name: "Unknown",
Errors: make(chan error),
}, ErrRuntimeNotFound
}

func lookupBin(fallbacks []string) (string, error) {
Expand Down

0 comments on commit 1389ed3

Please sign in to comment.