func TestMain(m *testing.M) {
	flag.Parse()
	os.RemoveAll("tmp")
	// Load test ENV variables
	godotenv.Load("../../.env.test")
	db = config.NewDB()
	models.New(db)
	if err := gofer.LoadAndPerform("db:empty", "--env=../../.env.test"); err != nil {
		panic(fmt.Sprintf("Unable to empty database %v", err))
	}

	if err := gofer.LoadAndPerform("db:migrate", "--env=../../.env.test"); err != nil {
		panic(fmt.Sprintf("Unable to migrate database %v", err))
	}
	os.Exit(m.Run())
}
Esempio n. 2
0
func main() {
	var definition string

	if 1 >= len(os.Args) {
		definition = ""
	} else {
		definition = os.Args[1]
	}

	if "version" == definition {
		fmt.Fprintf(os.Stdout, "%s\n", VERSION)
		os.Exit(0)
	}

	var arguments []string

	if 1 < len(os.Args) {
		arguments = os.Args[2:]
	}

	gofer.LoadAndPerform(definition, arguments...)
}