Example #1
0
func marshalContractPackage(contConf *viper.Viper) (*definitions.Contracts, error) {
	pkg := definitions.BlankPackage()
	err := contConf.Unmarshal(pkg)
	app := pkg.Contracts
	app.Name = pkg.Name

	if err != nil {
		// Viper's error messages are atrocious.
		return nil, fmt.Errorf("Sorry, the marmots could not figure that package.json out.\nPlease check your package.json is properly formatted.\n")
	}

	return app, nil
}
Example #2
0
// set's the defaults
func DefaultContractPackage() (*definitions.Contracts, error) {
	pkg := definitions.BlankPackage()
	app := pkg.Contracts
	// we don't catch the directory error here as it should be caught prior to
	//   calling this function.
	pwd, _ := os.Getwd()
	app.Name = filepath.Base(pwd)
	app.ChainName = ""
	app.TestType = "epm"
	app.DeployType = "epm"
	app.TestTask = "default"
	app.DeployTask = "default"
	return app, nil
}
Example #3
0
func marshalContractPackage(contConf *viper.Viper) (*definitions.Contracts, error) {
	pkg := definitions.BlankPackage()
	err := contConf.Marshal(pkg)
	dapp := pkg.Contracts
	dapp.Name = pkg.Name

	logger.Debugf("Package marshalled, testType =>\t%s\n", dapp.TestType)
	logger.Debugf("\tdeployType =>\t\t%s\n", dapp.DeployType)
	logger.Debugf("\ttestTask =>\t\t%s\n", dapp.TestTask)
	logger.Debugf("\tdeployTask =>\t\t%s\n", dapp.DeployTask)

	if err != nil {
		// Viper's error messages are atrocious.
		return nil, fmt.Errorf("Sorry, the marmots could not figure that package.json out.\nPlease check your package.json is properly formatted.\n")
	}

	return dapp, nil
}