refactor: first pass at rewriting apps plugin in go

This commit is contained in:
Jose Diaz-Gonzalez
2020-03-10 14:14:37 -04:00
parent 48dc5d8cc1
commit b968ced6e9
67 changed files with 3829 additions and 471 deletions

32
plugins/apps/apps.go Normal file
View File

@@ -0,0 +1,32 @@
package apps
import (
"github.com/dokku/dokku/plugins/common"
)
// ReportSingleApp is an internal function that displays the app report for one or more apps
func ReportSingleApp(appName, infoFlag string) error {
if err := common.VerifyAppName(appName); err != nil {
return err
}
deploySource := ""
if b, err := common.PlugnTriggerSetup("deploy-source", []string{appName}...).SetInput("").Output(); err != nil {
deploySource = string(b[:])
}
locked := "false"
if appIsLocked(appName) {
locked = "true"
}
infoFlags := map[string]string{
"--app-dir": common.AppRoot(appName),
"--app-deploy-source": deploySource,
"--app-locked": locked,
}
trimPrefix := false
uppercaseFirstCharacter := true
return common.ReportSingleApp("app", appName, infoFlag, infoFlags, trimPrefix, uppercaseFirstCharacter)
}