Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added the option to specify localPath and logging for each file that …

…is uploaded
  • Loading branch information...
commit 2c33ca287d184ec626f9e97b9c90898e78dc8094 1 parent c09fcfc
@Zequez authored
Showing with 14 additions and 1 deletion.
  1. +14 −1 index.js
View
15 index.js
@@ -13,7 +13,12 @@ module.exports = function (options) {
var fileCount = 0;
var remotePath = options.remotePath || '';
+ var localPath = options.localPath || '';
+ var logFiles = options.logFiles === false ? false : true;
+
delete options.remotePath;
+ delete options.localPath;
+ delete options.logFiles;
return through.obj(function (file, enc, cb) {
if (file.isNull()) {
@@ -29,7 +34,8 @@ module.exports = function (options) {
// have to create a new connection for each file otherwise they conflict
var ftp = new JSFtp(options);
var relativePath = file.path.replace(file.cwd + '/', '');
- var finalRemotePath = path.join('/', remotePath, relativePath);
+ var localRelativePath = file.path.replace(path.join(file.cwd, localPath), '');
+ var finalRemotePath = path.join('/', remotePath, localRelativePath);
ftp.mkdirp(path.dirname(finalRemotePath), function (err) {
if (err) {
@@ -43,6 +49,13 @@ module.exports = function (options) {
return cb();
}
+ if (logFiles) {
+ gutil.log('gulp-ftp:', gutil.colors.green('Uploaded: ') +
+ relativePath +
+ gutil.colors.green(' => ') +
+ finalRemotePath);
+ }
+
fileCount++;
ftp.raw.quit();
cb();
Please sign in to comment.
Something went wrong with that request. Please try again.