Addition of install.sh and updates to the other push files to format … (#3)
* Addition of install.sh and updates to the other push files to format code and headers correctly.
* Updating install.sh
Addition of install.sh and updates to the other push files to format code and headers correctly.
Updated readme and install.sh to use the CLI
diff --git a/README.md b/README.md
index 54750d3..9950001 100644
--- a/README.md
+++ b/README.md
@@ -159,6 +159,13 @@
```wsk rule create --enable yourRule triggerName actionName ```
7. Check the results in the `wsk activation poll`.
-
8. Register a device in your Bluemix application , you can see the `rule`,`trigger` and `action` geting executed in the openWhisk [dashboard] (https://new-console.ng.bluemix.net/openwhisk/dashboard).
9. The action will send a push notification.
+
+
+## Deploying Push Package using `install.sh`
+
+1. git clone https://github.com/openwhisk/wsk-pkg-pushnotifications
+2. cd wsk-pkg-pushnotifications
+3. APIHOST="$EDGE_HOST" AUTH="$AUTH_KEY" WSK_CLI="$OPENWHISK_HOME/bin/wsk" ./install.sh
+ APIHOST is the OpenWhisk hostname. AUTH is your auth key. WSK_CLI is location of the Openwhisk CLI binary.
diff --git a/install.sh b/install.sh
index eb502c2..a8065f6 100644
--- a/install.sh
+++ b/install.sh
@@ -1,42 +1,26 @@
-#/
-# Copyright 2015-2016 IBM Corporation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#/
#!/bin/bash
#
-# use the command line interface to install pushnotifications package.
-# this script is in blue because it need blue whisk.properties.
+# use the command line interface to install standard actions deployed
+# automatically
#
+# To run this command
+# APIHOST="$EDGE_HOST" AUTH="$AUTH_KEY" WSK_CLI="$OPENWHISK_HOME/bin/wsk" ./install.sh
+# API_HOST and AUTH_KEY are found in $HOME/.wskprops
-#: ${WHISK_SYSTEM_AUTH:?"WHISK_SYSTEM_AUTH must be set and non-empty"}
-AUTH_KEY=`cat ../../../credentials/auth.whisk.system`
+set -e
+set -x
-SCRIPTDIR="$(dirname "$0")"
-CATALOG_HOME='../'
-source "$CATALOG_HOME/util.sh"
# pushnotifications actions
echo Installing pushnotifications package.
-createPackage pushnotifications \
+$WSK_CLI package update --apihost "$APIHOST" --auth "$AUTH" pushnotifications \
+
-a description "pushnotifications service" \
-a parameters '[ {"name":"appId", "required":true}, {"name":"appSecret", "required":true}]'
-waitForAll
-
-install "$CATALOG_HOME/pushnotifications/webhook.js" \
+$WSK_CLI action update --apihost "$APIHOST" --auth "$AUTH" "webhook.js" \
pushnotifications/webhook \
-a feed true \
-a description 'pushnotifications feed' \
@@ -44,15 +28,9 @@
-a sampleInput '{"appId":"xxx-xxx-xx", "appSecret":"yyy-yyy-yyy", "events":"onDeviceRegister"}' \
-a sampleOutput '{"Result={"tagName": "tagName","eventType": "onDeviceRegister","applicationId": "xxx-xxx-xx"}"}'
-install "$CATALOG_HOME/pushnotifications/sendMessage.js" \
+$WSK_CLI action update --apihost "$APIHOST" --auth "$AUTH" "$CATALOG_HOME/pushnotifications/sendMessage.js" \
pushnotifications/sendMessage \
-a description 'Send Push notification to device' \
-a parameters '[ {"name":"appId", "required":true}, {"name":"appSecret", "required":true}, {"name":"text", "required":true}, {"name":"url", "required":false}, {"name":"deviceIds", "required":false}, {"name":"platforms", "required":false},{"name":"tagNames", "required":false},{"name":"gcmPayload", "required":false},{"name":"gcmSound", "required":false},{"name":"gcmCollapseKey", "required":false},{"name":"gcmDelayWhileIdle", "required":true}, {"name":"gcmPriority", "required":true}, {"name":"gcmTimeToLive", "required":true}, {"name":"apnsBadge", "required":false}, {"name":"apnsCategory", "required":false}, {"name":"apnsIosActionKey", "required":false},{"name":"apnsPayload", "required":false},{"name":"apnsType", "required":false},{"name":"apnsSound", "required":false}]' \
-a sampleInput '{"appId":"xxx-xxx-xx", "appSecret":"yyy-yyy-yyy", "text":"hi there"}' \
--a sampleOutput '{"Result={"pushResponse": {"messageId":"11111s","message":{"message":{"alert":"register for tag"}}}}"}'
-
-
-waitForAll
-
-echo pushnotifications package ERRORS = $ERRORS
-exit $ERRORS
\ No newline at end of file
+-a sampleOutput '{"Result={"pushResponse": {"messageId":"11111s","message":{"message":{"alert":"register for tag"}}}}"}'
\ No newline at end of file