Skip to content

Commit

Permalink
fix path run RunModel, add unit tests, make a console.warn for using …
Browse files Browse the repository at this point in the history
…msbuildArgs, fix docs slightly
  • Loading branch information
TerribleDev committed Oct 27, 2017
1 parent 75dd4be commit 47aa9e1
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 16 deletions.
8 changes: 1 addition & 7 deletions docs/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,12 @@ The [run model](/lib/models/RunModel.js) contains the actual model we validate a

> sets the console verbosity
#### version

* type: `string`

> Sets the $(Version) property in msbuild

#### msbuildArgs

* type: `Array<string>`

> Depricated - if you are using this to pass arguments to the program, use additionalArgs instead. Any extra options that should be passed to MSBuild. See dotnet msbuild -h for available options
> Depricated - if you are using this to pass arguments to the program, use additionalArgs instead.
#### additionalArgs

Expand Down
8 changes: 3 additions & 5 deletions lib/builders/runArgBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ let run = (value) => {
if(!value){
return args;
}
if (value.additionalArgs) {
args = args.concat(value.additionalArgs);
}
if (value.configuration) {
args = args.concat(['--configuration', value.configuration]);
}
Expand Down Expand Up @@ -42,10 +39,11 @@ let run = (value) => {
args = args.concat(['--verbosity', value.verbosity]);
}
if (value.msbuildArgs) {
console.warn("msbuildArgs are deprecated, please use additionalArgs. Arguments are not passed to msbuild");
args = args.concat(value.msbuildArgs);
}
if (value.version) {
args = args.concat(`/p:Version=${value.version}`);
if (value.additionalArgs) {
args = args.concat(value.additionalArgs);
}
return args;
};
Expand Down
2 changes: 1 addition & 1 deletion lib/run.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const Joi = require('joi');
const shelly = require('./shelly');
const argBuilder = require('./builders/runArgBuilder');
const runModel = require('./models/runModel');
const runModel = require('./models/RunModel');
const validation = Joi.object().keys(new runModel());

module.exports = (options) => {
Expand Down
2 changes: 1 addition & 1 deletion test/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ gulp.task('pack', ['build'], () => {
.pipe(pack({ output: path.join(process.cwd(), 'nupkgs'), echo: true }));
});

gulp.task('run:args', ['build'], () => {
gulp.task('run:args', [], () => {
return gulp.src('args/*.csproj', { read: false })
.pipe(run({
additionalArgs: ['Steve']
Expand Down
4 changes: 2 additions & 2 deletions test/js/runArgBuilder-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe('Run Argument Builder', () => {
it('should have msbuild args if msbuildargs are passed and are always last', () => {
assert.deepEqual(builder({msbuildArgs: ['/p:awesome=1.0.0', '/t:Build'], configuration: 'Release'}), ['--configuration','Release','/p:awesome=1.0.0', '/t:Build']);
});
it('should have msbuild args if msbuildargs are passed and are always last, version even...laster', () => {
assert.deepEqual(builder({msbuildArgs: ['/p:awesome=1.0.0', '/t:Build'], configuration: 'Release', version: '1.2.0'}), ['--configuration','Release','/p:awesome=1.0.0', '/t:Build', '/p:Version=1.2.0']);
it('should have additionalArgs if additionalArgs are passed and are always last', () => {
assert.deepEqual(builder({additionalArgs: ['/p:awesome=1.0.0', '/t:Build'], configuration: 'Release'}), ['--configuration','Release','/p:awesome=1.0.0', '/t:Build']);
});
});

0 comments on commit 47aa9e1

Please sign in to comment.