Skip to content

Commit

Permalink
CB-13303 : added noprod/production as an option, no prod turns off pr…
Browse files Browse the repository at this point in the history
…oduction
  • Loading branch information
audreyso committed Oct 3, 2017
1 parent 92cce97 commit 145c1e6
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
14 changes: 14 additions & 0 deletions spec/cli.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,20 @@ describe('cordova cli', function () {
done();
});
});

it('(add) will pass noprod:true and production:false', function (done) {
cli(['node', 'cordova', 'plugin', 'add', 'device', '--noprod'], function () {
expect(cordova.plugin).toHaveBeenCalledWith(
'add',
['device'],
jasmine.any(Object)
);
var opts = cordova.plugin.calls.argsFor(0)[2];
expect(opts.noprod).toBe(true);
expect(opts.production).toBe(false);
done();
});
});
});

describe('telemetry', function () {
Expand Down
23 changes: 21 additions & 2 deletions src/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ var knownOpts = {
'nobuild': Boolean,
'list': Boolean,
'buildConfig': String,
'template': String
'template': String,
'production': Boolean,
'noprod': Boolean
};

var shortHands = {
Expand Down Expand Up @@ -449,6 +451,12 @@ function cli (inputArgs) {
args.save = true;
}

if (args.noprod) {
args.production = false;
} else {
args.production = true;
}

if (args.save === undefined) {
// User explicitly did not pass in save
args.save = conf.get('autosave');
Expand All @@ -465,6 +473,14 @@ function cli (inputArgs) {
// User explicitly did not pass in searchpath
args.searchpath = conf.get('searchpath');
}
if (args.production === undefined) {
// User explicitly did not pass in noprod
args.production = conf.get('production');
}
if (args.noprod === undefined) {
// User explicitly did not pass in noprod
args.noprod = conf.get('noprod');
}

var download_opts = { searchpath: args.searchpath,
noregistry: args.noregistry,
Expand All @@ -475,8 +491,11 @@ function cli (inputArgs) {
link: args.link || false,
save: args.save,
shrinkwrap: args.shrinkwrap || false,
force: args.force || false
force: args.force || false,
production: args.production,
noprod: args.noprod || false
};

return cordova[cmd](subcommand, targets, download_opts);
}
}
Expand Down

0 comments on commit 145c1e6

Please sign in to comment.