UNPKG

mecano

Version:

Common functions for system deployment.

32 lines (29 loc) 854 B
// Generated by CoffeeScript 1.9.1 var fs; module.exports = function(options, callback) { var destination, mode, ssh; ssh = options.ssh, destination = options.destination, mode = options.mode; if (!destination) { return callback(new Error("Missing destination: " + destination)); } if (typeof options.log === "function") { options.log("Check if exists: " + destination); } return fs.exists(ssh, destination, (function(_this) { return function(err, exists) { if (err) { return callback(err); } if (exists) { return callback(); } options.source = null; options.content = ''; if (typeof options.log === "function") { options.log("Create a new empty file"); } return _this.write(options).then(callback); }; })(this)); }; fs = require('ssh2-fs');