diff options
Diffstat (limited to 'init.go')
| -rw-r--r-- | init.go | 32 |
1 files changed, 31 insertions, 1 deletions
@@ -67,6 +67,29 @@ func InitByAppname(argname string) *Forge { return f } +func InitByFullpath(filename string) *Forge { + cfg := NewForgeConfigs() + err := config.LoadFile(cfg, filename) + if err != nil { + log.Info("forge load config err", err) + os.Exit(-1) + } + return InitByConfig(cfg) +} + +func InitByConfig(cfg *ForgeConfigs) *Forge { + if cfg == nil { + log.Info("forge config was == nil") + os.Exit(-1) + } + f := new(Forge) + f.Config = cfg + f.initFromConfig() + + log.Printf("forge.InitByConfig() %s Repos.len()=%d\n", f.Config.Filename, f.Repos.Len()) + return f +} + func (f *Forge) initFromConfig() { if f.configENV() { log.Info("ENV changed config. todo: save config here") @@ -81,8 +104,15 @@ func (f *Forge) initFromConfig() { f.Repos = gitpb.NewRepos() f.Repos.ConfigLoad(f.Config.ReposPB) - // init the Patchsets f.Patchsets = NewSets() + if f.Config.PatchPB == "" { + // init default Patchsets? + // save patchsets here? + } else { + if err := config.LoadFile(f.Patchsets, f.Config.PatchPB); err != nil { + log.Info("forge.Init() load patches failed", err) + } + } // todo: play with these / determine good values based on user's machine if f.Config.RillX == 0 { |
