diff options
-rw-r--r-- | cli/actions.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/cli/actions.js b/cli/actions.js index 7767281..e5b0c6d 100644 --- a/cli/actions.js +++ b/cli/actions.js | |||
@@ -94,10 +94,15 @@ function put(filePath, otherFilePaths, options) { | |||
94 | 94 | ||
95 | async.eachSeries(files, function (file, callback) { | 95 | async.eachSeries(files, function (file, callback) { |
96 | var relativeFilePath = path.resolve(file).slice(process.cwd().length + 1); | 96 | var relativeFilePath = path.resolve(file).slice(process.cwd().length + 1); |
97 | var destinationPath = (options.destination ? '/' + options.destination : '') + '/' + relativeFilePath; | ||
98 | console.log('Uploading file %s -> %s', relativeFilePath.cyan, destinationPath.cyan); | ||
97 | 99 | ||
98 | console.log('Uploading file %s -> %s', relativeFilePath.cyan, ((options.destination ? options.destination : '') + '/' + relativeFilePath).cyan); | 100 | superagent.put(config.server() + API + relativeFilePath).query(gQuery).attach('file', file).end(function (error, result) { |
101 | if (error) return callback(error); | ||
102 | if (result.statusCode !== 201) return callback(new Error('Error uploading file: ' + result.statusCode)); | ||
99 | 103 | ||
100 | superagent.put(config.server() + API + relativeFilePath).query(gQuery).attach('file', file).end(callback); | 104 | console.log('Uploaded to ' + config.server() + destinationPath); |
105 | }); | ||
101 | }, function (error) { | 106 | }, function (error) { |
102 | if (error) { | 107 | if (error) { |
103 | console.log('Failed to put file.', error); | 108 | console.log('Failed to put file.', error); |