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-devtools.git
The following commit(s) were added to refs/heads/master by this push: new 883dd9e Add support for scancode in Travis; update README with license & build badges (#41) 883dd9e is described below commit 883dd9e4fea725e9da001c51901f2d95a2454da8 Author: Matt Rutkowski <mrutk...@us.ibm.com> AuthorDate: Thu Jul 13 18:49:31 2017 -0500 Add support for scancode in Travis; update README with license & build badges (#41) REVIEW: Add support for scancode in Travis; update README with license & build badges --- .travis.yml | 2 ++ README.md | 8 +++++--- docker-compose/README.md | 18 +++++++++--------- node-local/test.js | 15 +++++++++------ tools/travis/scancode.sh | 11 +++++++++++ tools/travis/setupscan.sh | 8 ++++++++ 6 files changed, 44 insertions(+), 18 deletions(-) diff --git a/.travis.yml b/.travis.yml index 7be0f7a..cc06797 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,9 @@ services: - docker before_install: + - ./tools/travis/setupscan.sh - ${TOOL}/.travis/setup.sh script: + - ./tools/travis/scancode.sh - ${TOOL}/.travis/build.sh diff --git a/README.md b/README.md index 16d6bc4..449c722 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,9 @@ -Developer tools for OpenWhisk -============================= +# Developer tools for OpenWhisk -This repository is part of [Apache OpenWhisk](http://openwhisk.org) and provides developer tools that help with local development, testing and operation of OpenWhisk. +[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0) +[![Build Status](https://travis-ci.org/apache/incubator-openwhisk-devtools.svg?branch=master)](https://travis-ci.org/apache/incubator-openwhisk-devtools) + +This repository is part of [Apache OpenWhisk](http://openwhisk.incubator.apache.org/) and provides developer tools that help with local development, testing and operation of OpenWhisk. ## Subprojects diff --git a/docker-compose/README.md b/docker-compose/README.md index 86b2a89..8f98fe0 100644 --- a/docker-compose/README.md +++ b/docker-compose/README.md @@ -8,7 +8,7 @@ An easy way to try OpenWhisk locally is to use Docker Compose. The following are required to build and deploy OpenWhisk with Docker Compose: -- [Docker 1.12+](https://www.docker.com/products/docker) +- [Docker 1.12+](https://www.docker.com/products/docker) - [Docker Compose 1.6+](https://docs.docker.com/compose/install/) - [Java 8](http://www.oracle.com/technetwork/java/javase/downloads/index.html) @@ -36,9 +36,9 @@ At the end of the execution it prints the output of the function: } ``` -If `PROJECT_HOME` variable is set ( i.e. `PROJECT_HOME=/path/to/openwhisk make quick-start`) -then the command skips downloading the `master` branch and uses instead the source code found in the `PROJECT_HOME` folder. -This is useful for working with a local clone, making changes to the code, and run it with `docker-compose`. +If `PROJECT_HOME` variable is set ( i.e. `PROJECT_HOME=/path/to/openwhisk make quick-start`) +then the command skips downloading the `master` branch and uses instead the source code found in the `PROJECT_HOME` folder. +This is useful for working with a local clone, making changes to the code, and run it with `docker-compose`. # Build @@ -67,7 +67,7 @@ make stop ``` To remove the stopped containers, clean the database files and the temporary files use: - + ```bash make destroy ``` @@ -80,19 +80,19 @@ Once OpenWhisk is up and running you can execute a `hello-world` function: make hello-world ``` -This command creates a new JS action, it invokes it, and then it deletes it. +This command creates a new JS action, it invokes it, and then it deletes it. The javascript action is: ```javascript function main(params) { var name = params.name || "World"; return {payload: "Hello, " + name + "!"}; } -``` +``` The result of the invokation should be printed on the terminal: ``` { "payload": "Hello, World!" -} +} ``` ## Logs @@ -109,4 +109,4 @@ To start `docker-compose` with custom images used for running actions use the fo - `DOCKER_REGISTRY` - specify a custom docker registry. I.e ```DOCKER_REGISTRY=registry.example.com make quick-start``` - `DOCKER_IMAGE_PREFIX` - specify a custom image prefix. I.e. ```DOCKER_IMAGE_PREFIX=my-prefix make quick-start``` -These 2 variable allow you to execute a JS action using the container `registry.example.com/my-prefix/nodejs6action` . \ No newline at end of file +These 2 variable allow you to execute a JS action using the container `registry.example.com/my-prefix/nodejs6action`. diff --git a/node-local/test.js b/node-local/test.js index 416f368..0490b14 100644 --- a/node-local/test.js +++ b/node-local/test.js @@ -1,3 +1,6 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more contributor +// license agreements; and to You under the Apache License, Version 2.0. + process.stdin.setEncoding('utf8'); var args = process.argv; @@ -32,17 +35,17 @@ if (process.stdin.isTTY) { } else { //if stdin, read input and parse as JSON var input = ""; - + process.stdin.on('readable', () => { var chunk = process.stdin.read(); if (chunk !== null) { input += chunk; } }); - + process.stdin.on('end', () => { const params = JSON.parse(input); - + run(action, params, json); }); } @@ -75,12 +78,12 @@ function run(action, params, outputJSON) { help(); process.exit(1); } - + const imports = require(action); //support a non-exported main function as a fallback const mainfunct = imports.main ? imports.main : fallback(action); - + let result = mainfunct(params); if (result.then) { Promise.resolve(result) @@ -95,4 +98,4 @@ function run(action, params, outputJSON) { process.on('SIGINT', function() { console.log("exiting..."); process.exit(); -}); \ No newline at end of file +}); 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>'].