Merge pull request #14 from Narsul/master
added `delete_removed` config param to deploy
This commit is contained in:
@@ -23,6 +23,8 @@ deploy:
|
|||||||
concurrency: <number of connections> // Optional
|
concurrency: <number of connections> // Optional
|
||||||
region: <region> // Optional, see https://github.com/LearnBoost/knox#region
|
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
|
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
|
||||||
```
|
```
|
||||||
|
|
||||||
If you installed the AWS command-line tool and provided your credentials via `aws configure`,
|
If you installed the AWS command-line tool and provided your credentials via `aws configure`,
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ module.exports = function(args) {
|
|||||||
var log = this.log;
|
var log = this.log;
|
||||||
|
|
||||||
var customHeaders = args.headers || {};
|
var customHeaders = args.headers || {};
|
||||||
|
var deleteRemoved = args.hasOwnProperty('delete_removed')
|
||||||
|
? Boolean(args.delete_removed)
|
||||||
|
: true;
|
||||||
|
|
||||||
if (!args.bucket || !config.s3Options.accessKeyId || !config.s3Options.secretAccessKey) {
|
if (!args.bucket || !config.s3Options.accessKeyId || !config.s3Options.secretAccessKey) {
|
||||||
var help = '';
|
var help = '';
|
||||||
@@ -47,7 +50,8 @@ module.exports = function(args) {
|
|||||||
help += ' [concurrency]: <concurrency>\n';
|
help += ' [concurrency]: <concurrency>\n';
|
||||||
help += ' [region]: <region> # See https://github.com/LearnBoost/knox#region\n',
|
help += ' [region]: <region> # See https://github.com/LearnBoost/knox#region\n',
|
||||||
help += ' [headers]: <JSON headers> # Optional, see README.md file\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');
|
help += 'For more help, you can check the docs: ' + chalk.underline('https://github.com/nt3rp/hexo-deployer-s3');
|
||||||
|
|
||||||
console.log(help);
|
console.log(help);
|
||||||
@@ -56,7 +60,7 @@ module.exports = function(args) {
|
|||||||
|
|
||||||
var params = {
|
var params = {
|
||||||
localDir: publicDir,
|
localDir: publicDir,
|
||||||
deleteRemoved: true,
|
deleteRemoved: deleteRemoved,
|
||||||
s3Params: xtend({
|
s3Params: xtend({
|
||||||
Bucket: args.bucket,
|
Bucket: args.bucket,
|
||||||
Prefix: args.prefix
|
Prefix: args.prefix
|
||||||
|
|||||||
Reference in New Issue
Block a user