moving manager over to the engine for now

This commit is contained in:
2020-07-01 20:23:22 -04:00
parent 07bbb442ef
commit 6379c73e38
11 changed files with 219 additions and 544 deletions

View File

@@ -11,7 +11,7 @@ import (
clientconfig "github.com/deranjer/gvc/client/clientconfig"
config "github.com/deranjer/gvc/client/clientconfig"
"github.com/deranjer/gvc/common"
"github.com/deranjer/gvc/common/manager"
"github.com/deranjer/gvc/common/engine"
"github.com/deranjer/store"
"github.com/rs/zerolog"
)
@@ -32,7 +32,7 @@ func main() {
}
// Setting up a blank config to read the .toml file in if one exists
var conf clientconfig.Gvcconfig
var m *manager.Manager
var m *engine.Manager
isRepo := validateRepo()
if isRepo { // If repo folder exists, treat it like a repo and setup logging and database. If not a repo will not need any of this
err := store.Load(configPath, &conf)
@@ -47,7 +47,7 @@ func main() {
}
fmt.Println("Attempting to start logger...")
// Checking the .gvc structure
dirPaths, err := manager.CheckPaths(rootPath)
dirPaths, err := engine.CheckPaths(rootPath)
if err != nil {
log.Fatalf("unable to create/verify .gvc folder structure: %s", err)
}
@@ -69,8 +69,8 @@ func main() {
//if err != nil {
// clientlog.Fatal().Msgf("Unable to open or create a database in the .gvc folder, fatal")
//}
informer := make(chan manager.OperatingMessage)
m, err = manager.NewManager(rootPath, version, ".gvc/gvc.db", informer, dirPaths, &clientlog)
informer := make(chan engine.OperatingMessage)
m, err = engine.NewManager(rootPath, version, ".gvc/gvc.db", informer, dirPaths, &clientlog)
if err != nil {
clientlog.Fatal().Msgf("unable to create new manager object... %s", err)
}
@@ -178,7 +178,7 @@ func initCommand(cli *clir.Cli, conf *clientconfig.Gvcconfig) {
})
}
func addCommands(cli *clir.Cli, conf *clientconfig.Gvcconfig, m *manager.Manager) {
func addCommands(cli *clir.Cli, conf *clientconfig.Gvcconfig, m *engine.Manager) {
//All the add commands and subcommands
//The add subcommand
addCmd := cli.NewSubCommand("add", "adds file(s)/folder(s) (recursively for folder) to repo")
@@ -689,7 +689,7 @@ func pullCommand(cli *clir.Cli, conf *config.Gvcconfig) {
})
}
func commitCommand(cli *clir.Cli, conf *config.Gvcconfig, m *manager.Manager) {
func commitCommand(cli *clir.Cli, conf *config.Gvcconfig, m *engine.Manager) {
commitCommand := cli.NewSubCommand("commit", "commits the changes to the repo")
var commitMessage string
commitMessageFlag := commitCommand.StringFlag("message", "adds a message to a commit", &commitMessage)

View File

@@ -7,11 +7,11 @@ import (
clientconfig "github.com/deranjer/gvc/client/clientconfig"
"github.com/deranjer/gvc/common"
"github.com/deranjer/gvc/common/manager"
"github.com/deranjer/gvc/common/engine"
)
//AddFiles adds files to the repo, inputType specifies file, folder, wildcard or all
func AddFiles(input string, inputType string, ignore common.FileTypes, m *manager.Manager) error {
func AddFiles(input string, inputType string, ignore common.FileTypes, m *engine.Manager) error {
err := validateFileType(input, inputType) // Making sure that if the file flag was used a folder was not supplied and vice versa
if err != nil {
return err

View File

@@ -2,12 +2,12 @@ package clientcmd
import (
clientconfig "github.com/deranjer/gvc/client/clientconfig"
"github.com/deranjer/gvc/common/manager"
"github.com/deranjer/gvc/common/engine"
)
// Commit commits the tracked files and changes to the repo
func Commit(conf *clientconfig.Gvcconfig, commitMessage string, m *manager.Manager) error {
m.BeginCommit(conf.CurrentBranch)
func Commit(conf *clientconfig.Gvcconfig, commitMessage string, m *engine.Manager) error {
m.BeginCommit(conf.CurrentBranch, commitMessage)
return nil
}