You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/02/27 21:10:17 UTC

[GitHub] beemarie closed pull request #16: WIP: Basic code cleanup

beemarie closed pull request #16: WIP: Basic code cleanup
URL: https://github.com/apache/incubator-openwhisk-package-deploy/pull/16
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/packages/actions/deployWeb.js b/packages/actions/deployWeb.js
index 4865549..7d51ae8 100644
--- a/packages/actions/deployWeb.js
+++ b/packages/actions/deployWeb.js
@@ -1,17 +1,12 @@
 const fs = require('fs');
-const path = require('path');
-const exec = require('child_process').exec;
 const git = require('simple-git');
-const yaml = require('js-yaml');
 const common = require('./lib/common');
 
-let command = '';
-
 /**
  * Action to deploy openwhisk elements from a compliant repository
  *  @param {string} gitUrl - github url containing the manifest and elements to deploy
  *  @param {string} manifestPath - (optional) the path to the manifest file, e.g. "openwhisk/src"
- *  @param {object} envData - (optional) some specific details such as cloudant username or cloudant password
+ *  @param {object} envData - (optional) env details such as cloudant username or cloudant password
  *  @return {object} Promise
  */
 function main(params) {
@@ -55,10 +50,8 @@ function main(params) {
           wskApiHost,
           envData,
         });
-      }
-      else {
-        return git()
-        .clone(gitUrl, localDirName, ['--depth', '1'], (err, data) => {
+      } else {
+        return git().clone(gitUrl, localDirName, ['--depth', '1'], (err, data) => {
           if (err) {
             reject('There was a problem cloning from github.  Does that github repo exist?  Does it begin with http?');
           }
@@ -73,23 +66,16 @@ function main(params) {
         });
       }
     })
-    .then((result) => {
-      return common.main(result);
-    })
-    .then((success) => {
-      return new Promise((resolve, reject) => {
-        resolve({
-          statusCode: 200,
-          headers: {'Content-Type': 'application/json'},
-          body: new Buffer(JSON.stringify({status: success, activationId: activationId })).toString('base64')
-        });
-      });
-    })
-    .catch(
-      (err) => {
-        return (sendError(400, err));
-      }
-    );
+      .then(result => common.main(result))
+      .then(success =>
+        new Promise((resolve, reject) => {
+          resolve({
+            statusCode: 200,
+            headers: { 'Content-Type': 'application/json' },
+            body: Buffer.from(JSON.stringify({ status: success, activationId })).toString('base64')
+          });
+        }))
+      .catch(err => (sendError(400, err)));
   }
 }
 
@@ -125,9 +111,9 @@ function sendError(statusCode, error, message) {
     params.message = message;
   }
   return {
-    statusCode: statusCode,
+    statusCode,
     headers: { 'Content-Type': 'application/json' },
-    body: new Buffer(JSON.stringify(params)).toString('base64')
+    body: Buffer.from(JSON.stringify(params)).toString('base64')
   };
 }
 
diff --git a/packages/actions/deployWeb_package.json b/packages/actions/deployWeb_package.json
index cc1dc0f..45383a5 100644
--- a/packages/actions/deployWeb_package.json
+++ b/packages/actions/deployWeb_package.json
@@ -10,7 +10,6 @@
   "author": "",
   "license": "ISC",
   "dependencies": {
-    "js-yaml": "^3.9.1",
     "simple-git": "^1.74.1"
   }
 }
diff --git a/packages/actions/lib/common.js b/packages/actions/lib/common.js
index 48f1a74..2dc9545 100644
--- a/packages/actions/lib/common.js
+++ b/packages/actions/lib/common.js
@@ -1,8 +1,6 @@
 const fs = require('fs');
 const path = require('path');
 const exec = require('child_process').exec;
-const git = require('simple-git');
-const yaml = require('js-yaml');
 let command = '';
 
 /**


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services