openwhisk-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From berst...@apache.org
Subject [incubator-openwhisk-client-swift] branch master updated: Add support for Travis CI and scancode. (#43)
Date Mon, 10 Jul 2017 15:19:33 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 56a4f23  Add support for Travis CI and scancode. (#43)
56a4f23 is described below

commit 56a4f23f3e71804b3b8082805837fce174f8f32d
Author: Matt Rutkowski <mrutkows@us.ibm.com>
AuthorDate: Mon Jul 10 10:19:31 2017 -0500

    Add support for Travis CI and scancode. (#43)
---
 .travis.yml               |  8 ++++++++
 README.md                 | 36 ++++++++++++++++++++----------------
 tools/travis/scancode.sh  | 11 +++++++++++
 tools/travis/setupscan.sh |  8 ++++++++
 4 files changed, 47 insertions(+), 16 deletions(-)

diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..2370221
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,8 @@
+# https://docs.travis-ci.com/user/languages/python/
+language: python
+
+install:
+  - ./tools/travis/setupscan.sh
+
+script:
+  - ./tools/travis/scancode.sh
diff --git a/README.md b/README.md
index dc124c3..2437264 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,9 @@
 # Swift Client SDK for OpenWhisk
-This is a Swift-based client SDK for OpenWhisk. You can use it to connect to the [IBM Bluemix
OpenWhisk service](http://www.ibm.com/cloud-computing/bluemix/openwhisk/), or you own installation
of [OpenWhisk](https://github.com/openwhisk/openwhisk).  It partially implements the OpenWhisk
[REST API](https://github.com/openwhisk/openwhisk/blob/master/docs/reference.md#rest-api)
and allows you to invoke actions and fire triggers. The client SDK is compatible with Swift
3.x and runs on iOS 9  [...]
+
+[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)
+[![Build Status](https://api.travis-ci.org/apache/incubator-openwhisk-client-swift.svg?branch=master)](https://api.travis-ci.org/apache/incubator-openwhisk-client-swift)
+
+This is a Swift-based client SDK for OpenWhisk. You can use it to connect to the [IBM Bluemix
OpenWhisk service](http://www.ibm.com/cloud-computing/bluemix/openwhisk/), or you own installation
of [OpenWhisk](https://github.com/openwhisk/openwhisk).  It partially implements the OpenWhisk
[REST API](https://github.com/openwhisk/openwhisk/blob/master/docs/reference.md#rest-api)
and allows you to invoke actions and fire triggers. The client SDK is compatible with Swift
3.x and runs on iOS 9  [...]
 
 ## Installation
 You can install the SDK using the source code in this repo, as a Cocoapod for iOS and WatchOS
apps, Carthage, and as a package using the Swift Package Manager for Darwin CLI apps.
@@ -14,7 +18,7 @@ To build the source code:
 ### CocoaPods Installation
 The [official CocoaPods website](http://cocoapods.org) has detailed instructions on how to
install and use CocoaPods.
 
-The following lines in a Podfile will install the SDK for an iOS app with a watch OS extension:

+The following lines in a Podfile will install the SDK for an iOS app with a watch OS extension:
 
 ```
 install! 'cocoapods', :deterministic_uuids => false
@@ -24,7 +28,7 @@ target 'MyApp' do
      pod 'OpenWhisk', :git => 'https://github.com/openwhisk/openwhisk-client-swift.git',
:tag => '0.2.2'
 end
 
-target 'MyApp WatchKit Extension' do 
+target 'MyApp WatchKit Extension' do
      pod 'OpenWhisk', :git => 'https://github.com/openwhisk/openwhisk-client-swift.git',
:tag => '0.2.2'
 end
 ```
@@ -48,7 +52,7 @@ end
 
 Visit the [official Carthage site on Github](https://github.com/Carthage/Carthage) for detailed
instructions on installing and using Carthage.
 
-Here is an example Cartfile for iOS installation using Carthage:  
+Here is an example Cartfile for iOS installation using Carthage:
 
 ```
 github "openwhisk/openwhisk-client-swift.git" ~> 0.2.2 # Or latest version
@@ -102,21 +106,21 @@ var params = Dictionary<String, String>()
 params["payload"] = "Hi from mobile"
 
 do {
-    try whisk.invokeAction(name: "helloConsole", package: "mypackage", namespace: "mynamespace",
parameters: params, hasResult: false, callback: {(reply, error) -> Void in 
+    try whisk.invokeAction(name: "helloConsole", package: "mypackage", namespace: "mynamespace",
parameters: params, hasResult: false, callback: {(reply, error) -> Void in
         if let error = error {
             //do something
             print("Error invoking action \(error.localizedDescription)")
         } else {
             print("Action invoked!")
         }
-        
+
     })
 } catch {
     print("Error \(error)")
 }
 ```
 
-In the above example, we are invoking the "helloConsole" action using the default namespace.

+In the above example, we are invoking the "helloConsole" action using the default namespace.
 
 ### Fire an OpenWhisk Trigger
 To fire a remote OpenWhisk trigger, call the "fireTrigger" method.  Pass in parameters as
required using a dictionary.
@@ -129,7 +133,7 @@ locationParams["payload"] = "{\"lat\":41.27093, \"lon\":-73.77763}"
 
 do {
     try whisk.fireTrigger(name: "locationChanged", package: "mypackage", namespace: "mynamespace",
parameters: locationParams, callback: {(reply, error) -> Void in
-        
+
         if let error = error {
             print("Error firing trigger \(error.localizedDescription)")
         } else {
@@ -148,17 +152,17 @@ If the action returns a result, set hasResult to true in the invokeAction
call.
 ```swift
 do {
     try whisk.invokeAction(name: "actionWithResult", package: "mypackage", namespace: "mynamespace",
parameters: params, hasResult: true, callback: {(reply, error) -> Void in
-        
+
         if let error = error {
             //do something
             print("Error invoking action \(error.localizedDescription)")
-            
+
         } else {
             var result = reply["result"]
             print("Got result \(result)")
         }
-        
-        
+
+
     })
 } catch {
     print("Error \(error)")
@@ -188,7 +192,7 @@ You can pass in a custom URLSession in case you require special network
handling
 // create a network delegate that trusts everything
 class NetworkUtilsDelegate: NSObject, URLSessionDelegate {
     func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge,
completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void)
{
-        
+
         completionHandler(Foundation.URLSession.AuthChallengeDisposition.useCredential, URLCredential(trust:
challenge.protectionSpace.serverTrust!))
     }
 }
@@ -205,7 +209,7 @@ All actions and triggers have a fully qualified name which is made up
of a names
 1. qName = "foo" will result in namespace = default, package = default, action/trigger =
"foo"
 2. qName = "mypackage/foo" will result in namespace = default, package = mypackage, action/trigger
= "foo"
 3. qName = "/mynamespace/foo" will result in namespace = mynamespace, package = default,
action/trigger = "foo"
-4. qName = "/mynamespace/mypackage/foo will result in namespace = mynamespace, package =
mypackage, action/trigger = "foo" 
+4. qName = "/mynamespace/mypackage/foo will result in namespace = mynamespace, package =
mypackage, action/trigger = "foo"
 
 All other combinations will throw a WhiskError.QualifiedName error. When using qualified
names, you must wrap the call in a do/try/catch block.
 
@@ -219,7 +223,7 @@ whiskButton.setupWhiskAction("helloConsole", package: "mypackage", namespace:
"_
 
 let myParams = ["name":"value"]
 
-// Call this when you detect a press event, e.g. in an IBAction, to invoke the action 
+// Call this when you detect a press event, e.g. in an IBAction, to invoke the action
 whiskButton.invokeAction(parameters: myParams, callback: { reply, error in
     if let error = error {
         print("Oh no, error: \(error)")
@@ -232,7 +236,7 @@ whiskButton.invokeAction(parameters: myParams, callback: { reply, error
in
 
 var whiskButtonSelfContained = WhiskButton(frame: CGRectMake(0,0,20,20))
 whiskButtonSelfContained.listenForPressEvents = true
-do { 
+do {
 
    // use qualified name API which requires do/try/catch
    try whiskButtonSelfContained.setupWhiskAction("mypackage/helloConsole", credentials: credentialsConfiguration!,
hasResult: false, parameters: nil, urlSession: nil)
diff --git a/tools/travis/scancode.sh b/tools/travis/scancode.sh
new file mode 100755
index 0000000..2202c45
--- /dev/null
+++ b/tools/travis/scancode.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+set -e
+
+# Build script for Travis-CI.
+SCRIPTDIR=$(cd $(dirname "$0") && pwd)
+ROOTDIR="$SCRIPTDIR/../.."
+UTIL_DIR="$ROOTDIR/../incubator-openwhisk-utilities"
+
+# run scancode
+cd $UTIL_DIR
+scancode/scanCode.py $ROOTDIR
\ No newline at end of file
diff --git a/tools/travis/setupscan.sh b/tools/travis/setupscan.sh
new file mode 100755
index 0000000..35f070f
--- /dev/null
+++ b/tools/travis/setupscan.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+SCRIPTDIR=$(cd $(dirname "$0") && pwd)
+HOMEDIR="$SCRIPTDIR/../../../"
+
+# clone OpenWhisk utilities repo. in order to run scanCode.py
+cd $HOMEDIR
+git clone https://github.com/apache/incubator-openwhisk-utilities.git

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

Mime
View raw message