Files
dokku/plugins/repo/subcommands.go
Jose Diaz-Gonzalez 6a7d2e5252 refactor: decrease compile time for golang plugins
This change refactors the compiled golang plugins into 3 distinct binaries:

- commands: already existing
- subcommands/subcommands: entrypoint into all subcommands
- triggers: entrypoint into all triggers

It then further symlinks triggers and subcommands to the built binaries. This results in both a much faster build process as well as smaller package size.
2019-09-15 19:15:08 -04:00

38 lines
862 B
Go

package repo
import (
"errors"
"strings"
"github.com/dokku/dokku/plugins/common"
)
// CommandGc runs 'git gc --aggressive' against the application's repo
func CommandGc(appName string) error {
if appName == "" {
return errors.New("Please specify an app to run the command on")
}
err := common.VerifyAppName(appName)
if err != nil {
return err
}
appRoot := strings.Join([]string{common.MustGetEnv("DOKKU_ROOT"), appName}, "/")
cmdEnv := map[string]string{
"GIT_DIR": appRoot,
}
gitGcCmd := common.NewShellCmd("git gc --aggressive")
gitGcCmd.Env = cmdEnv
gitGcCmd.Execute()
return nil
}
// CommandPurgeCache deletes the contents of the build cache stored in the repository
func CommandPurgeCache(appName string) error {
if appName == "" {
common.LogFail("Please specify an app to run the command on")
}
return PurgeCache(appName)
}