import correction (#6)
* import correction
* travis correction
* jason review
* correct open install location
* Make setup.sh executable
* enable jshint and remove encryption check
* add jshintrc file
* make travis happy
* get creds from root dir instead of open relative
* remove failing cat"
* keep cat but from correct dir
* consistency
diff --git a/.jshintrc b/.jshintrc
new file mode 100644
index 0000000..e3b3c74
--- /dev/null
+++ b/.jshintrc
@@ -0,0 +1,9 @@
+{
+ "curly" : true,
+ "eqeqeq" : true,
+ "forin" : false,
+ "esversion" : 6,
+ "loopfunc" : true,
+ "module" : true,
+ "node" : true
+}
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
index 1c54cc6..536aab7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,8 +19,6 @@
install: true
before_install:
- - git clone https://github.com/openwhisk/openwhisk.git
- - cd openwhisk
- ./tools/travis/setup.sh
script:
diff --git a/packages/actions/deploy.js b/packages/actions/deploy.js
index 8794c04..e5e7fa5 100644
--- a/packages/actions/deploy.js
+++ b/packages/actions/deploy.js
@@ -81,7 +81,7 @@
command = `printf 'y' | ${__dirname}/wskdeploy -v -m ${manifestFileName} --auth ${wskAuth} --apihost ${wskApiHost}`;
return new Promise((resolve, reject) => {
- const manifestFilePath = `${repoDir}/${manifestPath}/${manifestFileName}`
+ const manifestFilePath = `${repoDir}/${manifestPath}/${manifestFileName}`;
if (!fs.existsSync(manifestFilePath)) {
reject(`Error loading ${manifestFilePath}. Does a manifest file exist?`);
} else {
@@ -119,7 +119,7 @@
});
});
}
- })
+ });
});
}
@@ -165,6 +165,6 @@
});
fs.rmdirSync(pathToDelete);
}
-};
+}
exports.main = main;
diff --git a/tests/src/test/scala/packages/DeployTests.scala b/tests/src/test/scala/packages/DeployTests.scala
index e4da762..9dafefa 100644
--- a/tests/src/test/scala/packages/DeployTests.scala
+++ b/tests/src/test/scala/packages/DeployTests.scala
@@ -21,9 +21,9 @@
import org.junit.runner.RunWith
import org.scalatest.BeforeAndAfterAll
import org.scalatest.junit.JUnitRunner
-import common.{TestHelpers, Wsk, WskProps, WskTestHelpers, _}
+import common.{TestHelpers, Wsk, WskProps, WskTestHelpers}
import spray.json.DefaultJsonProtocol.StringJsonFormat
-import spray.json.pimpAny
+import spray.json._
@RunWith(classOf[JUnitRunner])
class DeployTests extends TestHelpers
diff --git a/tools/travis/build.sh b/tools/travis/build.sh
index 866669d..42f3c37 100755
--- a/tools/travis/build.sh
+++ b/tools/travis/build.sh
@@ -1,17 +1,22 @@
#!/bin/bash
+set -e
+
# Build script for Travis-CI.
SCRIPTDIR=$(cd $(dirname "$0") && pwd)
ROOTDIR="$SCRIPTDIR/../.."
-WHISKDIR="$ROOTDIR/openwhisk"
+WHISKDIR="$ROOTDIR/../openwhisk"
+UTILDIR="$ROOTDIR/../incubator-openwhisk-utilities"
-cd $WHISKDIR
+# run scancode
+cd $UTILDIR
+scancode/scanCode.py $ROOTDIR
-tools/build/scanCode.py $ROOTDIR
+# run jshint
+cd $ROOTDIR/packages
+jshint .
-# No point to continue with PRs, since encryption is on
-if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then exit 0; fi
-
+# Install OpenWhisk
cd $WHISKDIR/ansible
ANSIBLE_CMD="ansible-playbook -i environments/local"
@@ -23,16 +28,19 @@
cd $WHISKDIR
-./gradlew distDocker
+TERM=dumb ./gradlew distDocker
cd $WHISKDIR/ansible
$ANSIBLE_CMD wipe.yml
$ANSIBLE_CMD openwhisk.yml
+# Set Environment
+export OPENWHISK_HOME=$WHISKDIR
+
cd $WHISKDIR
-VCAP_SERVICES_FILE="$(readlink -f $WHISKDIR/../tests/credentials.json)"
+VCAP_SERVICES_FILE="$(readlink -f $ROOTDIR/tests/credentials.json)"
#update whisk.properties to add tests/credentials.json file to vcap.services.file, which is needed in tests
WHISKPROPS_FILE="$WHISKDIR/whisk.properties"
@@ -43,12 +51,11 @@
AUTH_KEY=$(cat $WHISKDIR/ansible/files/auth.whisk.system)
EDGE_HOST=$(grep '^edge.host=' $WHISKPROPS_FILE | cut -d'=' -f2)
-# Set Environment
-export OPENWHISK_HOME=$WHISKDIR
+# Install Package
-# Install the package
-source $ROOTDIR/packages/installCatalog.sh $AUTH_KEY $EDGE_HOST $WSK_CLI
+cd $ROOTDIR/packages
+./installCatalog.sh $AUTH_KEY $EDGE_HOST $WSK_CLI
# Test
cd $ROOTDIR
-./gradlew :tests:test
+TERM=dumb ./gradlew :tests:test
diff --git a/tools/travis/setup.sh b/tools/travis/setup.sh
new file mode 100755
index 0000000..09adb10
--- /dev/null
+++ b/tools/travis/setup.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+SCRIPTDIR=$(cd $(dirname "$0") && pwd)
+HOMEDIR="$SCRIPTDIR/../../../"
+
+# jshint support
+sudo apt-get -y install nodejs npm
+sudo npm install -g jshint
+
+# clone utilties repo. in order to run scanCode.py
+cd $HOMEDIR
+git clone https://github.com/apache/incubator-openwhisk-utilities.git
+
+# shallow clone OpenWhisk repo.
+git clone --depth 1 https://github.com/apache/incubator-openwhisk.git openwhisk
+
+cd openwhisk
+./tools/travis/setup.sh
\ No newline at end of file