You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ho...@apache.org on 2018/05/24 18:44:05 UTC

[incubator-openwhisk-wskdeploy] 01/03: replacing cat with a simple helloworld example

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

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

commit 137956c9011fa4ec6244883df70aa8f99b3ca4a8
Author: Priti Desai <pd...@us.ibm.com>
AuthorDate: Thu May 24 10:18:38 2018 -0700

    replacing cat with a simple helloworld example
---
 .../src/integration/zipaction/actions/cat/index.js |  8 ---
 .../zipaction/actions/cat/node_modules/.bin/cat    |  1 -
 .../actions/cat/node_modules/cat/README.md         | 43 -------------
 .../zipaction/actions/cat/node_modules/cat/bin.js  | 16 -----
 .../actions/cat/node_modules/cat/example.js        |  8 ---
 .../actions/cat/node_modules/cat/index.js          | 57 -----------------
 .../actions/cat/node_modules/cat/package.json      | 74 ----------------------
 .../integration/zipaction/actions/cat/package.json |  7 --
 tests/src/integration/zipaction/manifest.yml       |  2 +-
 9 files changed, 1 insertion(+), 215 deletions(-)

diff --git a/tests/src/integration/zipaction/actions/cat/index.js b/tests/src/integration/zipaction/actions/cat/index.js
deleted file mode 100644
index 89d0f48..0000000
--- a/tests/src/integration/zipaction/actions/cat/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one or more contributor
-// license agreements; and to You under the Apache License, Version 2.0.
-
-function myAction(args) {
-    var cat = require('cat');
-    cat('https://baidu.com', console.log);
-}
-exports.main = myAction;
diff --git a/tests/src/integration/zipaction/actions/cat/node_modules/.bin/cat b/tests/src/integration/zipaction/actions/cat/node_modules/.bin/cat
deleted file mode 120000
index a618fc3..0000000
--- a/tests/src/integration/zipaction/actions/cat/node_modules/.bin/cat
+++ /dev/null
@@ -1 +0,0 @@
-../cat/bin.js
\ No newline at end of file
diff --git a/tests/src/integration/zipaction/actions/cat/node_modules/cat/README.md b/tests/src/integration/zipaction/actions/cat/node_modules/cat/README.md
deleted file mode 100644
index 71e3a96..0000000
--- a/tests/src/integration/zipaction/actions/cat/node_modules/cat/README.md
+++ /dev/null
@@ -1,43 +0,0 @@
-<!--
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You 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.
-#
--->
-
-# cat
-
-cat will read the contents of an url. it's available through npm
-
-    npm install cat
-
-it will read your files
-
-```js
-var cat = require('cat');
-
-cat('myfile.txt', console.log);             // reads the file as utf-8 and returns it output
-cat('file://myfile.txt', console.log);      // same as above
-```
-
-and your `http` / `https` urls
-
-```js
-cat('http://google.com', console.log);      // cat also follows any redirects
-cat('https://github.com', console.log);     // and cat read https
-cat('http://fail.google.com', console.log); // if a status code != 2xx is received it will
-                                            // call the callback with an error.
-
-```
diff --git a/tests/src/integration/zipaction/actions/cat/node_modules/cat/bin.js b/tests/src/integration/zipaction/actions/cat/node_modules/cat/bin.js
deleted file mode 100755
index 697d1f6..0000000
--- a/tests/src/integration/zipaction/actions/cat/node_modules/cat/bin.js
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env node
-// Licensed to the Apache Software Foundation (ASF) under one or more contributor
-// license agreements; and to You under the Apache License, Version 2.0.
-
-var fs = require('fs')
-
-var input = process.argv.slice(2)
-
-var loop = function() {
-  if (!input.length) return
-  var next = input.shift()
-  var s = next === '-' ? process.stdin : fs.createReadStream(next)
-  s.on('end', loop).pipe(process.stdout)
-}
-
-loop()
diff --git a/tests/src/integration/zipaction/actions/cat/node_modules/cat/example.js b/tests/src/integration/zipaction/actions/cat/node_modules/cat/example.js
deleted file mode 100644
index 4a6e857..0000000
--- a/tests/src/integration/zipaction/actions/cat/node_modules/cat/example.js
+++ /dev/null
@@ -1,8 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one or more contributor
-// license agreements; and to You under the Apache License, Version 2.0.
-
-var cat = require('./index');
-
-cat(__filename, console.log);
-
-cat('https://raw.github.com/mafintosh/cat/master/example.js', console.log);
diff --git a/tests/src/integration/zipaction/actions/cat/node_modules/cat/index.js b/tests/src/integration/zipaction/actions/cat/node_modules/cat/index.js
deleted file mode 100644
index 49f2e48..0000000
--- a/tests/src/integration/zipaction/actions/cat/node_modules/cat/index.js
+++ /dev/null
@@ -1,57 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one or more contributor
-// license agreements; and to You under the Apache License, Version 2.0.
-
-var fs = require('fs');
-var parse = require('url').parse;
-
-var catter = function(lib) {
-    var cat = function(url, callback) {
-        if (typeof url === 'string') {
-            url = parse(url);
-        }
-        lib.get({host:url.hostname, port:url.port, path:url.pathname}, function(response) {
-            if (/3\d\d/.test(response.statusCode) && response.headers.location) {
-                cat(parse(response.headers.location), callback);
-                return;
-            }
-            if (!(/2\d\d/).test(response.statusCode)) {
-                callback(new Error('non 2xx status code: ' + response.statusCode));
-                return;
-            }
-            var buffer = '';
-
-            response.setEncoding('utf-8');
-            response.on('data', function(data) {
-                buffer += data;
-            });
-            response.on('close', function() {
-                callback(new Error('unexpected close of response'));
-            });
-            response.on('end', function() {
-                callback(null, buffer);
-            });
-        }).on('error', callback);
-    };
-    return cat;
-};
-
-var http = catter(require('http'));
-var https = catter(require('https'));
-
-module.exports = function(location, callback) {
-    var protocol = (location.match(/^(\w+):\/\//) || [])[1] || 'file';
-
-    if (protocol === 'file') {
-        fs.readFile(location.replace(/^(file:\/\/localhost|file:\/\/)/, ''), 'utf-8', callback);
-        return;
-    }
-    if (protocol === 'http') {
-        http(location, callback);
-        return;
-    }
-    if (protocol === 'https') {
-        https(location, callback);
-        return;
-    }
-    throw new Error('protocol '+protocol+' currently not supported :(');
-};
diff --git a/tests/src/integration/zipaction/actions/cat/node_modules/cat/package.json b/tests/src/integration/zipaction/actions/cat/node_modules/cat/package.json
deleted file mode 100644
index 355bc25..0000000
--- a/tests/src/integration/zipaction/actions/cat/node_modules/cat/package.json
+++ /dev/null
@@ -1,74 +0,0 @@
-{
-  "_args": [
-    [
-      {
-        "raw": "cat@0.2.0",
-        "scope": null,
-        "escapedName": "cat",
-        "name": "cat",
-        "rawSpec": "0.2.0",
-        "spec": "0.2.0",
-        "type": "version"
-      },
-      "/Users/dliu/go_work/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/zipaction/actions/cat"
-    ]
-  ],
-  "_from": "cat@0.2.0",
-  "_id": "cat@0.2.0",
-  "_inCache": true,
-  "_location": "/cat",
-  "_npmUser": {
-    "name": "mafintosh",
-    "email": "mathiasbuus@gmail.com"
-  },
-  "_npmVersion": "1.4.9",
-  "_phantomChildren": {},
-  "_requested": {
-    "raw": "cat@0.2.0",
-    "scope": null,
-    "escapedName": "cat",
-    "name": "cat",
-    "rawSpec": "0.2.0",
-    "spec": "0.2.0",
-    "type": "version"
-  },
-  "_requiredBy": [
-    "/"
-  ],
-  "_resolved": "https://registry.npmjs.org/cat/-/cat-0.2.0.tgz",
-  "_shasum": "fd850cda7d4162e6904f33b7fcf743b1243fd434",
-  "_shrinkwrap": null,
-  "_spec": "cat@0.2.0",
-  "_where": "/Users/dliu/go_work/src/github.com/apache/incubator-openwhisk-wskdeploy/tests/src/integration/zipaction/actions/cat",
-  "author": {
-    "name": "Mathias Buus Madsen",
-    "email": "mathiasbuus@gmail.com"
-  },
-  "bin": {
-    "cat": "bin.js"
-  },
-  "dependencies": {},
-  "description": "cat will read the contents of an url",
-  "devDependencies": {},
-  "directories": {},
-  "dist": {
-    "shasum": "fd850cda7d4162e6904f33b7fcf743b1243fd434",
-    "tarball": "https://registry.npmjs.org/cat/-/cat-0.2.0.tgz"
-  },
-  "homepage": "https://github.com/mafintosh/cat",
-  "keywords": [
-    "cat",
-    "util",
-    "request"
-  ],
-  "maintainers": [
-    {
-      "name": "mafintosh",
-      "email": "m@ge.tt"
-    }
-  ],
-  "name": "cat",
-  "optionalDependencies": {},
-  "readme": "ERROR: No README data found!",
-  "version": "0.2.0"
-}
diff --git a/tests/src/integration/zipaction/actions/cat/package.json b/tests/src/integration/zipaction/actions/cat/package.json
deleted file mode 100644
index 6328214..0000000
--- a/tests/src/integration/zipaction/actions/cat/package.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-  "name": "my-action",
-  "main": "index.js",
-  "dependencies" : {
-    "cat" : "0.2.0"
-  }
-}
diff --git a/tests/src/integration/zipaction/manifest.yml b/tests/src/integration/zipaction/manifest.yml
index 59104f8..ae687b5 100644
--- a/tests/src/integration/zipaction/manifest.yml
+++ b/tests/src/integration/zipaction/manifest.yml
@@ -8,7 +8,7 @@ packages:
       actions:
         cat:
           version: 1.0
-          function: actions/cat
+          function: actions/greeting
           runtime: nodejs:6
           inputs:
             name: string

-- 
To stop receiving notification emails like this one, please contact
houshengbo@apache.org.