Example #1
0
func main() {
	flag.Parse()

	if config.BuildTargets == "" {
		fmt.Println("Target required")
		flag.Usage()
		return
	}

	if err := config.Load(); err != nil {
		log.Fatal(err)
	}

	if config.Build {
		for _, t := range config.TargetList() {
			config.SelectTarget(t)

			if err := build(); err != nil {
				err.(*app.AppError).Log()
				break
			}
		}
	} else {
		if len(config.TargetList()) != 1 {
			log.Fatal("Cannot serve more than one target at the same time")
		}
		config.SelectTarget(config.TargetList()[0])

		serve()
	}
}
Example #2
0
// Called before each compilation task. It load the caches
// and reload the confs if needed.
func PreCompile() error {
	if err := config.Load(); err != nil {
		return err
	}

	conf := config.Current()
	if err := os.MkdirAll(conf.Build, 0755); err != nil {
		return app.Error(err)
	}

	var err error
	loadCacheOnce.Do(func() {
		err = cache.Load()
	})

	return err
}
Example #3
0
func (s *ServeSuite) SetUpSuite(c *C) {
	var err error
	curDir, err = os.Getwd()
	if err != nil {
		c.Error(err)
		return
	}

	if err := os.Chdir("/home/ernesto/projects/geohistoria"); err != nil {
		c.Error(err)
		return
	}

	if err := config.Load(); err != nil {
		c.Error(err)
		return
	}
}
Example #4
0
func (s *DepsSuite) SetUpSuite(c *C) {
	var err error
	curDir, err = os.Getwd()
	if err != nil {
		c.Error(err)
		return
	}

	if err := os.Chdir("/home/ernesto/projects/geohistoria"); err != nil {
		c.Error(err)
		return
	}

	config.ConfPath = "client/config.xml"
	config.BuildTargets = "production"

	if err := config.Load(); err != nil {
		c.Error(err)
		return
	}
}