You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/11/10 22:39:02 UTC
[50/50] incubator-mynewt-newt git commit: newt - Remove duplicate
code introduced in merge.
newt - Remove duplicate code introduced in merge.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/00ec2a34
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/00ec2a34
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/00ec2a34
Branch: refs/heads/master
Commit: 00ec2a3494d2dc0d64e0f347bae6ba5f184f16ed
Parents: 48599c1
Author: Christopher Collins <cc...@apache.org>
Authored: Thu Nov 10 11:54:29 2016 -0800
Committer: Christopher Collins <cc...@apache.org>
Committed: Thu Nov 10 11:54:29 2016 -0800
----------------------------------------------------------------------
newt/newtutil/newtutil.go | 77 ------------------------------------------
1 file changed, 77 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/00ec2a34/newt/newtutil/newtutil.go
----------------------------------------------------------------------
diff --git a/newt/newtutil/newtutil.go b/newt/newtutil/newtutil.go
index 79b3cef..d7369d9 100644
--- a/newt/newtutil/newtutil.go
+++ b/newt/newtutil/newtutil.go
@@ -113,83 +113,6 @@ func GetStringMapFeatures(v *viper.Viper, features map[string]bool,
return result
}
-const NEWTRC_DIR string = ".newt"
-const REPOS_FILENAME string = "repos.yml"
-
-// Contains general newt settings read from $HOME/.newt
-var newtrc *viper.Viper
-
-func readNewtrc() *viper.Viper {
- usr, err := user.Current()
- if err != nil {
- log.Warn("Failed to obtain user name")
- return viper.New()
- }
-
- dir := usr.HomeDir + "/" + NEWTRC_DIR
- v, err := util.ReadConfig(dir, strings.TrimSuffix(REPOS_FILENAME, ".yml"))
- if err != nil {
- log.Debugf("Failed to read %s/%s file", dir, REPOS_FILENAME)
- return viper.New()
- }
-
- return v
-}
-
-func Newtrc() *viper.Viper {
- if newtrc != nil {
- return newtrc
- }
-
- newtrc = readNewtrc()
- return newtrc
-}
-
-func GetSliceFeatures(v *viper.Viper, features map[string]bool,
- key string) []interface{} {
-
- val := v.Get(key)
- vals := []interface{}{val}
-
- // Process the features in alphabetical order to ensure consistent
- // results across repeated runs.
- var featureKeys []string
- for feature, _ := range features {
- featureKeys = append(featureKeys, feature)
- }
- sort.Strings(featureKeys)
-
- for _, feature := range featureKeys {
- overwriteVal := v.Get(key + "." + feature + ".OVERWRITE")
- if overwriteVal != nil {
- return []interface{}{overwriteVal}
- }
-
- appendVal := v.Get(key + "." + feature)
- if appendVal != nil {
- vals = append(vals, appendVal)
- }
- }
-
- return vals
-}
-
-func GetStringMapFeatures(v *viper.Viper, features map[string]bool,
- key string) map[string]interface{} {
-
- result := map[string]interface{}{}
-
- slice := GetSliceFeatures(v, features, key)
- for _, itf := range slice {
- sub := cast.ToStringMap(itf)
- for k, v := range sub {
- result[k] = v
- }
- }
-
- return result
-}
-
func GetStringFeatures(v *viper.Viper, features map[string]bool,
key string) string {
val := v.GetString(key)