Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

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

Reorg

parent 3e34510b
......@@ -4,9 +4,9 @@ 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 v12 LTS](https://nodejs.org/en/).
* Tested with [Node.js v14 LTS](https://nodejs.org/en/).
## Install and unit test
## Install
First, install the [Node.js runtime](https://nodejs.org/en/download/).
......@@ -14,8 +14,7 @@ Next, clone this repository, enter its top-level directory, and install the requ
```bash
cd recfu-mover
npm install
npm audit
npm install --production && npm audit fix
```
Next, copy the example configuration:
......
......@@ -4,17 +4,14 @@
// Variable definitions
// -------------------------------------------------------------------------
const f = require('./functions');
const {doIt} = require('./lib');
const options = './site-config/client.json';
// -------------------------------------------------------------------------
// Main logic
// -------------------------------------------------------------------------
f.doIt(options, (err, msg) => {
if (err) {
console.error(err);
} else {
console.log(msg);
}
doIt(options, (err, msg) => {
if (err) throw err;
console.log(msg);
});
......@@ -82,6 +82,13 @@ function downloadFile(sshOpt, remoteFile, localFile, callback) {
// Exported functions
// -------------------------------------------------------------------------
/**
* Read SFTP options, download file from SFTP server.
*
* @param {string} optionsConf - Name of SFTP options file.
* @param {Function} callback - Callback function.
* @returns {Function} Callback function.
*/
exports.doIt = function(optionsConf, callback) {
const o = readSftpOptions(optionsConf);
downloadFile(o.sshSettings, o.remoteFile, o.localFile, (err, msg) => {
......
......@@ -9,7 +9,7 @@
const assert = require('assert');
const fs = require('fs');
const rewire = require('rewire');
const pf = rewire('../functions');
const pf = rewire('../lib');
// Map rewired, private functions to friendlier names
const readSftpOptions = pf.__get__('readSftpOptions');
......
......@@ -13,8 +13,8 @@
"devDependencies": {},
"scripts": {
"pretest": "eslint --ignore-path .eslintignore .",
"test": "mocha",
"download": "npm test && node app.js"
"test": "mocha 'lib/*.spec.js'",
"download": "node app.js"
},
"author": "whatitis",
"license": "MIT",
......
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