portainer-devtool/go/repositories/ee.go

72 lines
1.5 KiB
Go
Raw Normal View History

2022-08-21 15:05:29 +10:00
package repositories
import (
"fmt"
"ocl/portainer-devtool/commands"
"ocl/portainer-devtool/utils"
)
const (
ACTION_EE_BUILD_ALL int = iota + 1
ACTION_EE_RUN_FRONTEND
ACTION_EE_RUN_BACKEND
ACTION_EE_VALIDATE_ALL
ACTION_EE_VALIDATE_FRONTEND
ACTION_EE_VALIDATE_BACKEND
ACTION_EE_RUN_UNIT_TEST_ALL
ACTION_EE_RUN_UNIT_TEST_FRONTEND
ACTION_EE_RUN_UNIT_TEST_BACKEND
)
2022-08-21 15:05:29 +10:00
type PortainerEE struct {
WorkDir string
FrontendDir string
BackendDir string
}
func NewPortainerEERepository() *PortainerEE {
repo := &PortainerEE{
WorkDir: "/home/oscarzhou/source/github.com/portainer/portainer-ee",
}
utils.HighlightPrint("Your portainer EE repository work directory is ")
fmt.Println(repo.WorkDir)
return repo
}
func (repo *PortainerEE) Execute() error {
err := commands.ListBranches(repo.WorkDir)
if err != nil {
return err
}
if !utils.PromptContinue() {
return nil
}
option := utils.PromptMenu(repo.listSubMenu)
switch option {
case ACTION_EE_BUILD_ALL:
case ACTION_EE_RUN_FRONTEND:
commands.RunPortainerClient(repo.WorkDir)
}
2022-08-21 15:05:29 +10:00
return nil
}
func (repo *PortainerEE) listSubMenu() {
utils.MenuPrint("Do you want?", `
1. Build both front-end and backend
2. Run front-end only
3. Run backend only
4. Validate both fornt-end and backend before commit
5. Validate front-end only before commit
6. Validate backend only before commit
7. Run unit tests for both front-end and backend
8. Run unit tests for front-end only
9. Run unit tests for backend only`)
}