You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by mr...@apache.org on 2017/08/29 18:19:28 UTC

[incubator-openwhisk-client-go] branch master updated: Replace the path of wskprops' parent dir with the path of wskprops (#34)

This is an automated email from the ASF dual-hosted git repository.

mrutkowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-client-go.git


The following commit(s) were added to refs/heads/master by this push:
     new 5b0dd27  Replace the path of wskprops' parent dir with the path of wskprops (#34)
5b0dd27 is described below

commit 5b0dd2748693f8bcb7e21c12c546ffd3211c2566
Author: Vincent <sh...@us.ibm.com>
AuthorDate: Tue Aug 29 14:19:26 2017 -0400

    Replace the path of wskprops' parent dir with the path of wskprops (#34)
    
    We need to search for .wskprops under HOME dir instead of GOPATH. In
    addition, we support the input of the full path of the wskprops file
    instead of the path of the parent dir.
---
 whisk/wskprops.go      | 14 +++++++-------
 whisk/wskprops_test.go |  6 +++---
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/whisk/wskprops.go b/whisk/wskprops.go
index 1a5202f..64f621c 100644
--- a/whisk/wskprops.go
+++ b/whisk/wskprops.go
@@ -30,7 +30,7 @@ import (
 
 const (
     OPENWHISK_HOME = "OPENWHISK_HOME"
-    GOPATH = "GOPATH"
+    HOMEPATH = "HOME"
     DEFAULT_LOCAL_CONFIG = ".wskprops"
     OPENWHISK_PROPERTIES = "whisk.properties"
     TEST_AUTH_FILE = "testing.auth"
@@ -48,8 +48,8 @@ const (
     CERT = "CERT"
     APIHOST = "APIHOST"
 
-    DEFAULT_SOURCE = ".wskprops"
-    WSKPROP = ".wskprops"
+    DEFAULT_SOURCE = "wsk props"
+    WSKPROP = "wsk props"
     WHISK_PROPERTY = "whisk.properties"
 )
 
@@ -162,13 +162,13 @@ type PropertiesImp struct {
 func (pi PropertiesImp) GetPropsFromWskprops(path string) *Wskprops {
     dep := GetDefaultWskprops(WSKPROP)
 
-    var configPath string
+    var wskpropsPath string
     if path != "" {
-        configPath = path
+        wskpropsPath = path
     } else {
-        configPath = pi.OsPackage.Getenv(GOPATH, "")
+        wskpropsPath = pi.OsPackage.Getenv(HOMEPATH, "") + "/" + DEFAULT_LOCAL_CONFIG
     }
-    results, err := ReadProps(configPath + "/" + DEFAULT_LOCAL_CONFIG)
+    results, err := ReadProps(wskpropsPath)
 
     if err == nil {
 
diff --git a/whisk/wskprops_test.go b/whisk/wskprops_test.go
index 6717e06..ce2b890 100644
--- a/whisk/wskprops_test.go
+++ b/whisk/wskprops_test.go
@@ -1,4 +1,4 @@
-// +build unit
+//// +build unit
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -239,7 +239,7 @@ func TestGetPropsFromWskprops(t *testing.T) {
 
     fakeOSPackage := FakeOSPackage{
         StoredValues: map[string]string {
-            GOPATH: getCurrentDir(),
+            HOMEPATH: getCurrentDir(),
         },
     }
     pi := PropertiesImp{
@@ -257,7 +257,7 @@ func TestGetPropsFromWskprops(t *testing.T) {
     assert.Equal(t, EXPECTED_CERT, dep.Cert)
     assert.Equal(t, WSKPROP, dep.Source)
 
-    path := getCurrentDir()
+    path := getCurrentDir() + "/" + DEFAULT_LOCAL_CONFIG
     dep = pi.GetPropsFromWskprops(path)
     assert.Equal(t, DEFAULT_NAMESPACE, dep.Namespace)
     assert.Equal(t, EXPECTED_TEST_AUTH_KEY, dep.AuthKey)

-- 
To stop receiving notification emails like this one, please contact
['"commits@openwhisk.apache.org" <co...@openwhisk.apache.org>'].