Commit eb40260f authored by Erik Schwartz's avatar Erik Schwartz 🉐
Browse files

Bump to Node.js LTS v12

Also bumped NPM package versions and made minor documentation
and package.json improvements.
parent 7df6ffcb
......@@ -4,18 +4,18 @@ Download files from IQ SFTP server to local filesystem.
* Used for BO report delivery to Rec Fusion customers.
* BO -> SFTP [project documentation](https://iqops.dsc.umich.edu/wiki/index.php/Transfer_files_from_BO_to_IQ_SFTP_server).
* Tested with [Node.js v8 LTS](https://nodejs.org/en/).
* Tested with [Node.js v12 LTS](https://nodejs.org/en/).
## Install and unit test
First, install Node.js runtime ([Linux download](https://nodejs.org/dist/latest-v8.x/node-v8.14.0-linux-x64.tar.xz), [Windows download](https://nodejs.org/dist/latest-v8.x/node-v8.14.0-x64.msi), [SHAsums](https://nodejs.org/dist/latest-v8.x/SHASUMS256.txt)).
First, install the [Node.js runtime](https://nodejs.org/en/download/).
Next, clone this repository, enter its top-level directory, and install the required NPM modules:
```bash
cd recfu-mover
npm install
npm test
npm audit
```
Next, copy the example configuration:
......@@ -32,11 +32,11 @@ cp ./site-config/client.json.EXAMPLE ./site-config/client.json
From this application's top-level directory, run the app using:
```bash
node app.js
npm run download
```
For scheduled runs of this application (through cron or Windows' Scheduled Tasks) it may be useful to redirect program output to a log file for later review, e.g.:
```bash
node app.js >> /path/to/recfu-mover.log 2>&1
npm run download >> /path/to/recfu-mover.log 2>&1
```
......@@ -44,6 +44,8 @@ function downloadFile(sshOpt, remoteFile, localFile, callback) {
}
sftp.unlink(remoteFile, (err) => {
if (err) {
// Don't blow up if we cannot delete the file on the remote
// system, but give a warning about it.
console.error('Problem removing remote file');
}
return callback(null, 'Downloaded to ' + localFile);
......
{
"name": "recfu-mover",
"version": "1.0.0",
"version": "1.0.1",
"main": "app.js",
"dependencies": {
"eslint": "^5.7.0",
"eslint": "^6.8.0",
"eslint-config-strongloop": "^2.1.0",
"mocha": "^5.2.0",
"mocha": "^7.0.1",
"rewire": "^4.0.1",
"ssh2": "^0.6.1"
"ssh2": "^0.8.7"
},
"devDependencies": {},
"scripts": {
"pretest": "eslint --ignore-path .eslintignore .",
"test": "mocha"
"test": "mocha",
"download": "npm test && node app.js"
},
"author": "whatitis",
"license": "MIT",
"description": "Move files from IQ SFTP server to Rec Sports Windows share",
"repository": {
"type": "git",
"url": "https://gitlab.aws.vdc.it.umich.edu/ITS/InformationQuest/recfu-mover.git"
"url": "https://gitlab.umich.edu/ITS/InformationQuest/recfu-mover.git"
}
}
......@@ -32,12 +32,14 @@ describe('Filesystem & JSON parsing integration', function() {
it('should return an object', function() {
o = readSftpOptions(configs[i]);
});
});
describe('Check names', function() {
it('should contain known properties', function() {
it('should contain an SSH setting property', function() {
assert.equal(o.hasOwnProperty('sshSettings'), true);
});
it('should contain host/username properties', function() {
assert.equal(o.sshSettings.hasOwnProperty('host'), true);
assert.equal(o.sshSettings.hasOwnProperty('username'), true);
});
it('should contain local/remote file properties', function() {
assert.equal(o.hasOwnProperty('localFile'), true);
assert.equal(o.hasOwnProperty('remoteFile'), true);
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment