Skip to content

Commit

Permalink
add safe_global_upload flag
Browse files Browse the repository at this point in the history
  • Loading branch information
c301 committed Mar 24, 2017
1 parent ef27cac commit 7c80db4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,15 @@ Default value: `false`

Optional

### safe_global_upload
Allow global upload only with `--global` flag

Type: `Boolean`

Default value: `false`

Optional

### Extensions
It is object with arbitrary meaningful extensions names as a keys (see example above).

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "grunt-webstore-upload",
"version": "0.9.12",
"version": "0.9.14",
"description": "Automate uploading process of the new versions of Chrome Extension to Chrome Webstore",
"repository": "https://github.com/c301/grunt-webstore-upload.git",
"author": {
Expand Down
11 changes: 11 additions & 0 deletions tasks/webstore_upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,25 @@ module.exports = function (grunt) {
extensionsConfigPath = _task.name + '.extensions',
accountsConfigPath = _task.name + '.accounts',
skipUnpublishedPath = _task.name + '.skipUnpublished',
safeGlobalUploadPath = _task.name + '.safe_global_upload',
accounts,
extensions,
onComplete,
onError;

var safeGlobal = grunt.config.get(safeGlobalUploadPath);

var tasks = this.args;
//get all arguments after all grunt specific arguments
var args = process.argv.slice(3);

if( tasks.length === 0 && safeGlobal ){
if( !~args.indexOf("--global") ){
grunt.fail.warn("Global release not allowed, use --global flag.");
return false;
}
}

//search for message. Next element, after `-m`
var message = _.reduce(args, function(total, v){
if(!total.message){
Expand Down

0 comments on commit 7c80db4

Please sign in to comment.