From 674762bd969ee6a1aa5fe815664b45bc1b1329e8 Mon Sep 17 00:00:00 2001 From: Shannon Lal Date: Mon, 25 Sep 2017 20:26:55 -0400 Subject: [PATCH 1/6] Check in latset list selection --- examples/password-gulpfile.js | 38 +++++++++++++++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 examples/password-gulpfile.js diff --git a/examples/password-gulpfile.js b/examples/password-gulpfile.js new file mode 100644 index 0000000..4dd60e8 --- /dev/null +++ b/examples/password-gulpfile.js @@ -0,0 +1,38 @@ +'use strict'; + +var gulp = require( 'gulp' ); +var prompt = require('../index'); + +/** + * The following is a sample gulp file for getting the password from the command prompt + * Note: Gulp Prompt is a wrapper around inquirer.js so if it is available in inquirer.js + * it should be available within gulp-prompt. The prompt function is essentially a straight + * passthrough to the inquirer.js library. Here are the specs on how to configure the password: + * + * https://github.com/SBoudrias/Inquirer.js#questions + */ +gulp.task( 'getSelection', () => { + return gulp.src( './package.json' ) + .pipe( prompt.prompt({ + type:'list', + name:'env', + message:'Please enter selection?', + choices: ['a','b','c'.'d','e','f', 'g', 'h'], + pageSize:'3' + }, (res) => { + console.log('Result', res); + }) ); +}); + +gulp.task( 'getPasswordAndValidate', () => { + return gulp.src( './package.json' ) + .pipe( prompt.prompt({ + type:'password', + name:'env', + message:'Please enter password?', + validate: + }, (res) => { + console.log('Result', res); + }) ); +}); + diff --git a/package.json b/package.json index 47936b5..0e0b5e7 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,8 @@ "proxyquire":"^1.8.0", "vinyl-source-stream":"^1.1.0", "eslint": "^4.7.2", - "eslint-watch": "^3.1.2" + "eslint-watch": "^3.1.2", + "gulp":"3.9.1" }, "directories": { "test": "test" From 81e745a85d50f3cda54acb919c88791c639e5e97 Mon Sep 17 00:00:00 2001 From: Shannon Lal Date: Mon, 25 Sep 2017 20:28:36 -0400 Subject: [PATCH 2/6] Increment version number --- examples/password-gulpfile.js | 19 ++++--------------- package.json | 2 +- 2 files changed, 5 insertions(+), 16 deletions(-) diff --git a/examples/password-gulpfile.js b/examples/password-gulpfile.js index 4dd60e8..b5766a0 100644 --- a/examples/password-gulpfile.js +++ b/examples/password-gulpfile.js @@ -4,10 +4,11 @@ var gulp = require( 'gulp' ); var prompt = require('../index'); /** - * The following is a sample gulp file for getting the password from the command prompt + * The following is a sample gulp file for getting the list selection size from the command prompt * Note: Gulp Prompt is a wrapper around inquirer.js so if it is available in inquirer.js * it should be available within gulp-prompt. The prompt function is essentially a straight - * passthrough to the inquirer.js library. Here are the specs on how to configure the password: + * passthrough to the inquirer.js library. The page size variable is what sets the length of display + * items in list * * https://github.com/SBoudrias/Inquirer.js#questions */ @@ -17,22 +18,10 @@ gulp.task( 'getSelection', () => { type:'list', name:'env', message:'Please enter selection?', - choices: ['a','b','c'.'d','e','f', 'g', 'h'], + choices: ['a','b','c','d','e','f', 'g', 'h'], pageSize:'3' }, (res) => { console.log('Result', res); }) ); }); -gulp.task( 'getPasswordAndValidate', () => { - return gulp.src( './package.json' ) - .pipe( prompt.prompt({ - type:'password', - name:'env', - message:'Please enter password?', - validate: - }, (res) => { - console.log('Result', res); - }) ); -}); - diff --git a/package.json b/package.json index 0e0b5e7..e980cb4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gulp-prompt", - "version": "0.3.1", + "version": "0.4.0", "description": "Add interactive console prompts to gulp", "main": "index.js", "scripts": { From c598b284205870348bf6cf8c9d7902a29e321763 Mon Sep 17 00:00:00 2001 From: Shannon Lal Date: Mon, 25 Sep 2017 20:30:31 -0400 Subject: [PATCH 3/6] Check in latest ReadMe file --- README.md | 18 ++++++++++++++++++ ...-gulpfile.js => list-selection-gulpfile.js} | 0 2 files changed, 18 insertions(+) rename examples/{password-gulpfile.js => list-selection-gulpfile.js} (100%) diff --git a/README.md b/README.md index 81f367b..80fb59f 100644 --- a/README.md +++ b/README.md @@ -135,3 +135,21 @@ gulp.src('test.js') })); ``` + +Example List Selection: + +```javascript + + gulp.src( './package.json' ) + .pipe( prompt.prompt({ + type:'list', + name:'env', + message:'Please enter selection?', + choices: ['a','b','c','d','e','f', 'g', 'h'], + pageSize:'3' + }, (res) => { + console.log('Result', res); + }) ); + +``` + diff --git a/examples/password-gulpfile.js b/examples/list-selection-gulpfile.js similarity index 100% rename from examples/password-gulpfile.js rename to examples/list-selection-gulpfile.js From ad7f77076e1651ea0c619cfcfae629d4d7d5fc06 Mon Sep 17 00:00:00 2001 From: Shannon Lal Date: Mon, 25 Sep 2017 20:33:17 -0400 Subject: [PATCH 4/6] Fix readme and unit tests --- README.md | 2 +- test/confirm-spec.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 80fb59f..3537ed7 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ gulp.src('test.js') ``` Example List Selection: - +[Note: see sample file]( examples/list-selection-gulpfile.js) ```javascript gulp.src( './package.json' ) diff --git a/test/confirm-spec.js b/test/confirm-spec.js index 0975c92..8cf61ac 100644 --- a/test/confirm-spec.js +++ b/test/confirm-spec.js @@ -22,7 +22,7 @@ describe('gulp confirm function unit tests', function () { }; //Mock inquirer to capture response - gulpPrompt = proxyrequire('../index.js', {'inquirer':{ prompt: prompt}}); + var gulpPrompt = proxyrequire('../index.js', {'inquirer':{ prompt: prompt}}); let srcStream = source('../README.md'); let resp = srcStream.pipe( gulpPrompt.confirm( 'options string' ) ); resp.write('../test.txt'); @@ -43,7 +43,7 @@ describe('gulp confirm function unit tests', function () { }; //Mock inquirer to capture response - gulpPrompt = proxyrequire('../index.js', {'inquirer':{ prompt: prompt}}); + var gulpPrompt = proxyrequire('../index.js', {'inquirer':{ prompt: prompt}}); let srcStream = source('../README.md'); let options = { type: 'confirm', @@ -71,7 +71,7 @@ describe('gulp confirm function unit tests', function () { }; //Mock inquirer to capture response - gulpPrompt = proxyrequire('../index.js', {'inquirer':{ prompt: prompt}}); + var gulpPrompt = proxyrequire('../index.js', {'inquirer':{ prompt: prompt}}); let srcStream = source('../README.md'); let options = { type: 'confirm', @@ -99,7 +99,7 @@ describe('gulp confirm function unit tests', function () { }; //Mock inquirer to capture response - gulpPrompt = proxyrequire('../index.js', {'inquirer':{ prompt: prompt}}); + var gulpPrompt = proxyrequire('../index.js', {'inquirer':{ prompt: prompt}}); let srcStream = source('../README.md'); let options;//Intentionally set to not defined let resp = srcStream.pipe( gulpPrompt.confirm( options ) ); From 8fe6384dc1959eb87174a95d788253f61a1a8812 Mon Sep 17 00:00:00 2001 From: Shannon Lal Date: Tue, 26 Sep 2017 06:12:55 -0400 Subject: [PATCH 5/6] Incrementing version to correct version parttern --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e980cb4..568ee6b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gulp-prompt", - "version": "0.4.0", + "version": "0.3.2", "description": "Add interactive console prompts to gulp", "main": "index.js", "scripts": { From 555ed1cc5239d11ff9493d092c28c0d8368fda17 Mon Sep 17 00:00:00 2001 From: Shannon Lal Date: Tue, 26 Sep 2017 06:14:14 -0400 Subject: [PATCH 6/6] Removing gulp dependency --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index 568ee6b..dfb2b7e 100644 --- a/package.json +++ b/package.json @@ -26,8 +26,7 @@ "proxyquire":"^1.8.0", "vinyl-source-stream":"^1.1.0", "eslint": "^4.7.2", - "eslint-watch": "^3.1.2", - "gulp":"3.9.1" + "eslint-watch": "^3.1.2" }, "directories": { "test": "test"