added delete_removed config param to deploy

This commit is contained in:
Antony Peklo
2017-11-06 20:00:50 +02:00
parent af5b101444
commit 83a6d5af1b
2 changed files with 8 additions and 2 deletions

View File

@@ -22,6 +22,8 @@ deploy:
concurrency: <number of connections> // Optional
region: <region> // Optional, see https://github.com/LearnBoost/knox#region
headers: <headers in JSON format> // pass any headers to S3, usefull for metadata cache setting of Hexo assets
prefix: <prefix> // Optional, prefix ending in /
delete_removed: <true|false> // if true will delete removed files from S3. Default: true
```
#### Example: header Cache-Control

View File

@@ -18,6 +18,9 @@ module.exports = function(args) {
var log = this.log;
var customHeaders = args.headers || {};
var deleteRemoved = args.hasOwnProperty('delete_removed')
? Boolean(args.delete_removed)
: true;
if (!args.bucket || !config.s3Options.accessKeyId || !config.s3Options.secretAccessKey) {
var help = '';
@@ -32,7 +35,8 @@ module.exports = function(args) {
help += ' [concurrency]: <concurrency>\n';
help += ' [region]: <region> # See https://github.com/LearnBoost/knox#region\n',
help += ' [headers]: <JSON headers> # Optional, see README.md file\n';
help += ' [prefix]: <prefix> # Optional, prefix ending in /\n\n';
help += ' [prefix]: <prefix> # Optional, prefix ending in /\n';
help += ' [delete_removed]: <delete> # Optional, if true will delete removed files from S3 /\n\n';
help += 'For more help, you can check the docs: ' + chalk.underline('https://github.com/nt3rp/hexo-deployer-s3');
console.log(help);
@@ -41,7 +45,7 @@ module.exports = function(args) {
var params = {
localDir: publicDir,
deleteRemoved: true,
deleteRemoved: deleteRemoved,
s3Params: xtend({
Bucket: args.bucket,
Prefix: args.prefix