예제 #1
0
파일: config.go 프로젝트: DataDog/kvexpress
// GetStringConfig grabs the string from the config object.
func GetStringConfig(c *simpleyaml.Yaml, configValue string) string {
	result, err := c.Get(configValue).String()
	if err != nil {
		Log(fmt.Sprintf("Could not get '%s' from config.", configValue), "info")
	}
	if result != "" {
		return result
	}
	return ""
}
예제 #2
0
파일: parse.go 프로젝트: pepol/forge
func MakeAppCTarget(t_name string, t_data *simpleyaml.Yaml, p_root, p_cur string) *AppCTarget {
	t_type, _ := t_data.Get("type").String()

	if t_type != "app_c" {
		log.Error("invalid type for AppCTarget", util.Exiter)
	}

	dependencies := MakeDependencies(t_data, p_root, p_cur)
	resources := GetStringArray("resources", t_data, p_root, p_cur)
	sources := GetStringArray("sources", t_data, p_root, p_cur)

	return &AppCTarget{
		Name:         t_name,
		Sources:      sources,
		Resources:    resources,
		Dependencies: dependencies,
	}
}
예제 #3
0
파일: parse.go 프로젝트: pepol/forge
func MakeDependencies(t_data *simpleyaml.Yaml, p_root, p_cur string) []Target {
	t_deps := t_data.Get("dependencies")

	var t_deps_count int

	if t_deps != nil {
		t_deps_arr, _ := t_deps.Array()
		t_deps_count = len(t_deps_arr)
	} else {
		t_deps_count = 0
	}

	dependencies := make([]Target, t_deps_count)

	for i := 0; i < t_deps_count; i++ {
		t_dep_str, _ := t_deps.GetIndex(i).String()
		dependencies[i] = MakeTarget(t_dep_str, p_root, p_cur)
	}

	return dependencies
}
예제 #4
0
파일: util.go 프로젝트: pepol/forge
func GetStringArray(key string, data *simpleyaml.Yaml,
	packageroot, curwd string) []string {
	value := data.Get(key)

	if value == nil {
		return make([]string, 0)
	}

	value_arr, _ := value.Array()

	string_array := make([]string, len(value_arr))

	for i := 0; i < len(value_arr); i++ {
		str_val, _ := value.GetIndex(i).String()
		if !filepath.IsAbs(str_val) {
			str_val = GetFQTN(str_val, packageroot, curwd)
			//str_val = filepath.Join(curwd, str_val)
		}
		string_array[i] = str_val
	}

	return string_array
}