示例#1
0
文件: boot.go 项目: DavidTPate/apex
// Initialize project files such as project.json and ./functions.
func (b *Bootstrapper) initProjectFiles(iamRole string) error {
	logf("creating ./project.json")

	project := fmt.Sprintf(projectConfig, b.name, b.description, iamRole)

	if err := ioutil.WriteFile("project.json", []byte(project), 0644); err != nil {
		return err
	}

	logf("creating ./functions")
	return boilerplate.RestoreAssets(".", "functions")
}
示例#2
0
文件: boot.go 项目: elizar/apex
// infra bootstraps terraform for infrastructure management.
func initInfra() error {
	if _, err := exec.LookPath("terraform"); err != nil {
		return fmt.Errorf("terraform is not installed")
	}

	logf("creating ./infrastructure")
	if err := boilerplate.RestoreAssets(".", infra.Dir); err != nil {
		return err
	}

	return setupModules()
}
示例#3
0
文件: boot.go 项目: elizar/apex
// Project bootstraps a project.
func initProject(name, description, iamRole string) error {
	logf("creating ./project.json")

	var project string
	if iamRole == "" {
		project = fmt.Sprintf(projectConfigWithoutRole, name, description)
	} else {
		project = fmt.Sprintf(projectConfig, name, description, iamRole)
	}

	if err := ioutil.WriteFile("project.json", []byte(project), 0644); err != nil {
		return err
	}

	logf("creating ./functions")
	return boilerplate.RestoreAssets(".", "functions")
}
示例#4
0
文件: boot.go 项目: Robh081956/apex
// infra bootstraps terraform for infrastructure management.
func initInfra(envs []string) error {
	if _, err := exec.LookPath("terraform"); err != nil {
		return fmt.Errorf("terraform is not installed")
	}

	logf("creating ./infrastructure")

	if err := boilerplate.RestoreAssets(".", filepath.Join(infra.Dir, "modules")); err != nil {
		return err
	}

	for _, env := range envs {
		if err := setupEnv(env); err != nil {
			return err
		}

		if err := setupModules(env); err != nil {
			return err
		}
	}

	return nil
}