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:38:55 UTC

[43/50] incubator-mynewt-newt git commit: This closes #26.

This closes #26.

Merge branch 'develop' of https://github.com/davidgs/incubator-mynewt-newt into develop


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/a30bf2dc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/a30bf2dc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/a30bf2dc

Branch: refs/heads/master
Commit: a30bf2dcfd9f44174549ab48eb290cfc6b042b17
Parents: 56b708d ef4522e
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Wed Nov 9 10:41:32 2016 -0800
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Wed Nov 9 10:41:32 2016 -0800

----------------------------------------------------------------------
 newt/newtutil/newtutil.go | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/a30bf2dc/newt/newtutil/newtutil.go
----------------------------------------------------------------------
diff --cc newt/newtutil/newtutil.go
index af949f0,9b99010..ddb2e94
--- a/newt/newtutil/newtutil.go
+++ b/newt/newtutil/newtutil.go
@@@ -33,86 -29,9 +33,86 @@@ import 
  	"mynewt.apache.org/newt/viper"
  )
  
- var NewtVersionStr string = "Apache Newt (incubating) version: 0.9.0"
- var NewtBlinkyTag string = "mynewt_0_9_0_tag"
+ var NewtVersionStr string = "Apache Newt (incubating) version: 1.0.0-develop"
+ var NewtBlinkyTag string = "mynewt_1_0_0_develop_tag"
  
 +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)