+ superagent.post(gServer + '/api/logout').query({ access_token: config.accessToken() }).end(function (error, result) {
+ if (result && result.statusCode !== 200) console.log('Failed to logout: ' + result.statusCode);
+ if (error) console.log(error);
+
+ // TODO remove at some point, this is just to clear the previous old version values
+ config.set('username', '');
+ config.set('password', '');
+ config.set('server', '');
+ config.set('accessToken', '');
+
+ console.log('Done'.green);
+ });
+}
+
+function putOne(filePath, destination, options, callback) {
+ const absoluteFilePath = path.resolve(filePath);
+ const stat = safe.fs.statSync(absoluteFilePath);
+ if (!stat) return callback(`Could not stat ${filePath}: ${safe.error.message}`);
+
+ let files, base;
+
+ if (stat.isFile()) {
+ base = destination + path.basename(filePath);
+ files = [ absoluteFilePath ];
+ } else if (stat.isDirectory()) {
+ base = destination + (filePath.endsWith('.') ? '' : path.basename(filePath) + '/');
+ files = collectFiles([ absoluteFilePath ], options);
+ } else {
+ return callback(); // ignore
+ }