示例#1
0
文件: info.go 项目: buckhx/denv
func init() {
	bootstrap()
	path := Settings.InfoFile
	Info.Path = path
	repo, err := git.NewRepository(Settings.DenvHome)
	check(err)
	Info.Repository = repo
	if !pathutil.Exists(path) {
		Info.Flush()
	}
	Info.Load()
}
示例#2
0
文件: info.go 项目: buckhx/denv
func bootstrap() error {
	//TODO: maybe this should live somewhere else
	// Create DENVHOME
	if !pathutil.Exists(Settings.DenvHome) {
		err := os.MkdirAll(Settings.DenvHome, 0744)
		if err != nil {
			return err
		}
	}
	if !git.IsRepository(Settings.DenvHome) {
		repo, err := git.NewRepository(Settings.DenvHome)
		check(err)
		repo.Init()
		repo.Exclude("/.*") // exclude hidden root files
	}
	return nil
}