From 47aa9e10fc05309aa7f3fc86bf4d3266cb376cbd Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Thu, 26 Oct 2017 23:22:45 -0400 Subject: [PATCH] fix path run RunModel, add unit tests, make a console.warn for using msbuildArgs, fix docs slightly --- docs/run.md | 8 +------- lib/builders/runArgBuilder.js | 8 +++----- lib/run.js | 2 +- test/gulpfile.js | 2 +- test/js/runArgBuilder-test.js | 4 ++-- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/docs/run.md b/docs/run.md index 8e9b7b5..6667294 100644 --- a/docs/run.md +++ b/docs/run.md @@ -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` -> 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 diff --git a/lib/builders/runArgBuilder.js b/lib/builders/runArgBuilder.js index f821e0d..6028405 100644 --- a/lib/builders/runArgBuilder.js +++ b/lib/builders/runArgBuilder.js @@ -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]); } @@ -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; }; diff --git a/lib/run.js b/lib/run.js index 37c68fc..9bc0d26 100644 --- a/lib/run.js +++ b/lib/run.js @@ -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) => { diff --git a/test/gulpfile.js b/test/gulpfile.js index ef29bf2..efa4c38 100644 --- a/test/gulpfile.js +++ b/test/gulpfile.js @@ -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'] diff --git a/test/js/runArgBuilder-test.js b/test/js/runArgBuilder-test.js index 95bcdca..7ea0bc6 100644 --- a/test/js/runArgBuilder-test.js +++ b/test/js/runArgBuilder-test.js @@ -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']); }); });