grunt-prompt
Advanced tools
Comparing version 1.0.0 to 1.1.0
@@ -35,2 +35,8 @@ /* | ||
specialVariable: 'a special thing', | ||
specialFunction: function () { | ||
return 'a dynamic value [' + new Date() + ']'; | ||
}, | ||
// Configuration to be run (and then tested). | ||
@@ -220,2 +226,18 @@ prompt: { | ||
} | ||
}, | ||
dynamic: { | ||
options: { | ||
questions: [ | ||
{ | ||
config: 'echo.dynamic', | ||
type: 'input', | ||
message: function () { | ||
var specialVariable = grunt.config('specialVariable'), | ||
specialFunction = grunt.config('specialFunction'); | ||
return 'You can use ' + chalk.yellow(specialVariable) + ' and even ' + chalk.red(specialFunction()) + ' in your questions'; | ||
} | ||
}, | ||
] | ||
} | ||
} | ||
@@ -287,2 +309,8 @@ }, | ||
grunt.registerTask('dynamic', | ||
[ | ||
'prompt:dynamic', | ||
'results:dynamic' | ||
]); | ||
grunt.registerTask('default', | ||
@@ -299,2 +327,2 @@ [ | ||
}; | ||
}; |
{ | ||
"name": "grunt-prompt", | ||
"description": "Interactive prompt for your Grunt config using console checkboxes, text input with filtering, password fields.", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"homepage": "https://github.com/dylang/grunt-prompt", | ||
@@ -35,3 +35,3 @@ "author": { | ||
"semver": "~2.2.1", | ||
"grunt-mocha-cli": "~1.5.0", | ||
"grunt-mocha-cli": "^1.6.0", | ||
"grunt-notify": "~0.2.10", | ||
@@ -41,3 +41,3 @@ "chai": "~1.9.0", | ||
"grunt-templates-dylang": "~0.1.0", | ||
"load-grunt-tasks": "~0.3.0" | ||
"load-grunt-tasks": "^0.4.0" | ||
}, | ||
@@ -44,0 +44,0 @@ "peerDependencies": { |
@@ -0,1 +1,8 @@ | ||
<!--- | ||
This file was automatically generated. | ||
Use `grunt readme` to regenerate. | ||
---> | ||
## grunt-prompt [![NPM version](https://badge.fury.io/js/grunt-prompt.png)](http://badge.fury.io/js/grunt-prompt) [![Build Status](https://travis-ci.org/dylang/grunt-prompt.png)](https://travis-ci.org/dylang/grunt-prompt) [![Built with Grunt](https://cdn.gruntjs.com/builtwith.png)](http://gruntjs.com/) | ||
@@ -5,3 +12,11 @@ | ||
[![grunt-prompt](https://nodei.co/npm/grunt-prompt.png?downloads=true "grunt-prompt")](https://nodei.co/npm/grunt-prompt) | ||
| ![grunt-prompt in action](https://f.cloud.github.com/assets/51505/867636/e727abfc-f717-11e2-997e-6b97e24593c3.gif "grunt-prompt in action") | | ||
|:-------------:| | ||
| grunt-prompt in action | | ||
### Getting Started | ||
@@ -24,5 +39,8 @@ | ||
`Grunt-prompt`'s UI is powered by the amazing [Inquirer](https://github.com/SBoudrias/Inquirer.js), a project created by Simon Boudrias. | ||
![grunt-prompt-example](https://f.cloud.github.com/assets/51505/867636/e727abfc-f717-11e2-997e-6b97e24593c3.gif) | ||
| ![grunt-prompt in action](https://f.cloud.github.com/assets/51505/867636/e727abfc-f717-11e2-997e-6b97e24593c3.gif "grunt-prompt in action") | | ||
|:-------------:| | ||
| grunt-prompt in action | | ||
@@ -44,3 +62,3 @@ | ||
type: '<question type>', // list, checkbox, confirm, input, password | ||
message: 'Question to ask the user', | ||
message: 'String|function()', // Question to ask the user, function needs to return a string, | ||
default: 'value', // default value if nothing is entered | ||
@@ -60,2 +78,3 @@ choices: 'Array|function(answers)', | ||
#### Options | ||
@@ -87,11 +106,13 @@ | ||
![grunt-prompt-example](https://f.cloud.github.com/assets/51505/867636/e727abfc-f717-11e2-997e-6b97e24593c3.gif) | ||
| ![grunt-prompt example](https://f.cloud.github.com/assets/51505/867636/e727abfc-f717-11e2-997e-6b97e24593c3.gif "grunt-prompt example") | | ||
|:-------------:| | ||
| grunt-prompt example | | ||
The documentation for **Inquiry** has [more details about type](https://github.com/SBoudrias/Inquirer.js#prompts-type) as well as additional typess. | ||
The documentation for [Inquiry](https://github.com/SBoudrias/Inquirer.js) has [more details about type](https://github.com/SBoudrias/Inquirer.js#prompts-type) as well as additional typess. | ||
##### message | ||
Type: `String` _required_ | ||
Type: `String|function()` _required_ | ||
Question to ask the user. | ||
Question to ask the user. If it's a function, it needs to return a string. | ||
@@ -150,2 +171,3 @@ Hint: keep it short, users hate to read. | ||
### How to use the results in your Gruntfile | ||
@@ -196,5 +218,6 @@ | ||
![prompt-mocha](https://f.cloud.github.com/assets/51505/983227/aabe4b6e-084a-11e3-94cd-514371c24059.gif) | ||
| ![grunt-prompt setting up Mocha](https://f.cloud.github.com/assets/51505/983227/aabe4b6e-084a-11e3-94cd-514371c24059.gif "grunt-prompt setting up Mocha") | | ||
|:-------------:| | ||
| grunt-prompt setting up Mocha | | ||
### How can values be accessed from my own code? | ||
@@ -219,3 +242,5 @@ | ||
![grunt-prompt-example-bump](https://f.cloud.github.com/assets/51505/867601/b3200cb6-f710-11e2-89da-675c831c218a.gif) | ||
| ![grunt-prompt with grunt-bump](https://f.cloud.github.com/assets/51505/2119082/78171246-9142-11e3-970a-f64f2002ad4e.png "grunt-prompt with grunt-bump") | | ||
|:-------------:| | ||
| grunt-prompt with grunt-bump | | ||
@@ -310,2 +335,3 @@ This is an example of how `grunt-prompt` for something like [grunt-bump](https://github.com/vojtajina/grunt-bump) which makes it easy to | ||
### Release History | ||
* **1.1.0** - 4 Mar 2014 - Messages can be functions instead of strings for dynamic questions. | ||
* **1.0.0** - 4 Feb 2014 - Dropping support for Node 0.8. | ||
@@ -323,20 +349,26 @@ * **0.2.2** - 4 Feb 2014 - Updated readme to make it auto-generated. | ||
Dylan is a senior JavaScript developer and tech lead at [Opower](http://opower.com), co-creator of [Doodle or Die](http://doodleordie.com), and father of two awesome kids. | ||
Hello fellow developer! My name is [Dylan Greene](https://github.com/dylang). When | ||
not overwhelmed with my two kids I enjoy contributing to the open source community. | ||
I'm a tech lead at [Opower](http://opower.com). I lead a team using Grunt and Angular to build software that | ||
successfully helps people like us use less power. | ||
Not too long ago I co-created [Doodle or Die](http://doodleordie.com), a hilarious web game with millions of | ||
doodles that won us Node Knockout for the "most fun" category. | ||
I'm [dylang](https://twitter.com/dylang) on Twitter and other places. | ||
Here are some other Node modules Dylan has created: | ||
Some of my other Node projects: | ||
| Name | Description | Github Stars | Npm Installs | | ||
|---|---|--:|--:| | ||
| [grunt-notify](https://github.com/dylang/grunt-notify) | Automatic desktop notifications for Grunt errors and warnings using Growl for OS X or Windows, Mountain Lion and Mavericks Notification Center, and Notify-Send. | 619 | 52,208 | | ||
| [rss](https://github.com/dylang/node-rss) | RSS feed generator. A really simple API to add RSS feeds to any project. | 177 | 98,802 | | ||
| [shortid](https://github.com/dylang/shortid) | Amazingly short non-sequential url-friendly unique id generator. | 129 | 22,984 | | ||
| [xml](https://github.com/dylang/node-xml) | Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples. | 35 | 180,625 | | ||
| [anthology](https://github.com/dylang/anthology) | Module information and stats for any @npmjs user | _New!_ | _TBD_ | | ||
| [grunt-attention](https://github.com/dylang/grunt-attention) | Display attention-grabbing messages in the terminal | _New!_ | 336 | | ||
| [observatory](https://github.com/dylang/observatory) | Beautiful UI for showing tasks running on the command line. | _New!_ | 81 | | ||
| [changelog](https://github.com/dylang/changelog) | Command line tool (and Node module) that generates a changelog in color output, markdown, or json for modules in npmjs.org's registry as well as any public github.com repo. | 51 | 2,081 | | ||
| [logging](https://github.com/dylang/logging) | Super sexy color console logging with cluster support. | 21 | 8,793 | | ||
| [grunt-cat](https://github.com/dylang/grunt-cat) | Echo a file to the terminal. Works with text, figlets, ascii art, and full-color ansi. | _New!_ | 396 | | ||
| [`grunt-notify`](https://github.com/dylang/grunt-notify) | Automatic desktop notifications for Grunt errors and warnings using Growl for OS X or Windows, Mountain Lion and Mavericks Notification Center, and Notify-Send. | 619 | 52,208 | | ||
| [`rss`](https://github.com/dylang/node-rss) | RSS feed generator. A really simple API to add RSS feeds to any project. | 177 | 98,802 | | ||
| [`shortid`](https://github.com/dylang/shortid) | Amazingly short non-sequential url-friendly unique id generator. | 129 | 22,984 | | ||
| [`xml`](https://github.com/dylang/node-xml) | Fast and simple xml generator. Supports attributes, CDATA, etc. Includes tests and examples. | 35 | 180,625 | | ||
| [`anthology`](https://github.com/dylang/anthology) | Module information and stats for any @npmjs user | _New!_ | _TBD_ | | ||
| [`grunt-attention`](https://github.com/dylang/grunt-attention) | Display attention-grabbing messages in the terminal | _New!_ | 336 | | ||
| [`observatory`](https://github.com/dylang/observatory) | Beautiful UI for showing tasks running on the command line. | _New!_ | 81 | | ||
| [`changelog`](https://github.com/dylang/changelog) | Command line tool (and Node module) that generates a changelog in color output, markdown, or json for modules in npmjs.org's registry as well as any public github.com repo. | 51 | 2,081 | | ||
| [`logging`](https://github.com/dylang/logging) | Super sexy color console logging with cluster support. | 21 | 8,793 | | ||
| [`grunt-cat`](https://github.com/dylang/grunt-cat) | Echo a file to the terminal. Works with text, figlets, ascii art, and full-color ansi. | _New!_ | 396 | | ||
_Data collected on Saturday, February 8, 2014 using [anthology](https://github.com/dylang/anthology)._ | ||
_This list was generated using [anthology](https://github.com/dylang/anthology)._ | ||
@@ -346,12 +378,17 @@ | ||
Copyright (c) 2014 Dylan Greene, contributors. | ||
Released under the MIT license | ||
Released under the [MIT license](https://tldrlegal.com/license/mit-license). | ||
Screenshots are [CC BY-SA](http://creativecommons.org/licenses/by-sa/4.0/) (Attribution-ShareAlike). | ||
*** | ||
_Generated by [grunt-readme](https://github.com/assemble/grunt-readme) using [grunt-templates-dylang](https://github.com/dylang/grunt-templates-dylang) on Saturday, February 8, 2014._ | ||
_Generated using [grunt-readme](https://github.com/assemble/grunt-readme) with [grunt-templates-dylang](https://github.com/dylang/grunt-templates-dylang) on Tuesday, March 4, 2014._ [![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/dylang/grunt-prompt/trend.png)](https://bitdeli.com/free "Bitdeli Badge") [![Google Analytics](https://ga-beacon.appspot.com/UA-4820261-3/dylang/grunt-prompt)](https://github.com/igrigorik/ga-beacon) | ||
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/dylang/grunt-prompt/trend.png)](https://bitdeli.com/free "Bitdeli Badge") [![Google Analytics](https://ga-beacon.appspot.com/UA-4820261-3/dylang/grunt-prompt)](https://github.com/igrigorik/ga-beacon) | ||
<!--- | ||
[grunt]: http://gruntjs.com/ | ||
[Getting Started]: https://github.com/gruntjs/grunt/blob/devel/docs/getting_started.md | ||
[package.json]: https://npmjs.org/doc/json.html | ||
This file was automatically generated. | ||
Use `grunt readme` to regenerate. | ||
---> |
@@ -41,2 +41,5 @@ /* | ||
question.choices = addSeparator(question.choices); | ||
if (_.isFunction(question.message)) { | ||
question.message = question.message(); | ||
} | ||
return question; | ||
@@ -43,0 +46,0 @@ }); |
## Release History | ||
* **1.1.0** - 4 Mar 2014 - Messages can be functions instead of strings for dynamic questions. | ||
* **1.0.0** - 4 Feb 2014 - Dropping support for Node 0.8. | ||
@@ -3,0 +4,0 @@ * **0.2.2** - 4 Feb 2014 - Updated readme to make it auto-generated. |
## Usage Examples | ||
![grunt-prompt-example-bump](https://f.cloud.github.com/assets/51505/867601/b3200cb6-f710-11e2-89da-675c831c218a.gif) | ||
{%= screenshot('grunt-prompt with grunt-bump', 'https://f.cloud.github.com/assets/51505/2119082/78171246-9142-11e3-970a-f64f2002ad4e.png') %} | ||
@@ -5,0 +5,0 @@ This is an example of how `grunt-prompt` for something like [grunt-bump](https://github.com/vojtajina/grunt-bump) which makes it easy to |
@@ -27,11 +27,11 @@ ### Options | ||
![grunt-prompt-example](https://f.cloud.github.com/assets/51505/867636/e727abfc-f717-11e2-997e-6b97e24593c3.gif) | ||
{%= screenshot('grunt-prompt example', 'https://f.cloud.github.com/assets/51505/867636/e727abfc-f717-11e2-997e-6b97e24593c3.gif') %} | ||
The documentation for **Inquiry** has [more details about type](https://github.com/SBoudrias/Inquirer.js#prompts-type) as well as additional typess. | ||
The documentation for [Inquiry](https://github.com/SBoudrias/Inquirer.js) has [more details about type](https://github.com/SBoudrias/Inquirer.js#prompts-type) as well as additional typess. | ||
#### message | ||
Type: `String` _required_ | ||
Type: `String|function()` _required_ | ||
Question to ask the user. | ||
Question to ask the user. If it's a function, it needs to return a string. | ||
@@ -87,2 +87,2 @@ Hint: keep it short, users hate to read. | ||
Runs after all questions have been asked. | ||
Runs after all questions have been asked. |
@@ -15,3 +15,3 @@ ## Overview | ||
type: '<question type>', // list, checkbox, confirm, input, password | ||
message: 'Question to ask the user', | ||
message: 'String|function()', // Question to ask the user, function needs to return a string, | ||
default: 'value', // default value if nothing is entered | ||
@@ -28,2 +28,2 @@ choices: 'Array|function(answers)', | ||
}) | ||
``` | ||
``` |
@@ -46,5 +46,4 @@ ## How to use the results in your Gruntfile | ||
![prompt-mocha](https://f.cloud.github.com/assets/51505/983227/aabe4b6e-084a-11e3-94cd-514371c24059.gif) | ||
{%= screenshot('grunt-prompt setting up Mocha', 'https://f.cloud.github.com/assets/51505/983227/aabe4b6e-084a-11e3-94cd-514371c24059.gif') %} | ||
## How can values be accessed from my own code? | ||
@@ -51,0 +50,0 @@ |
@@ -1,1 +0,1 @@ | ||
![grunt-prompt-example](https://f.cloud.github.com/assets/51505/867636/e727abfc-f717-11e2-997e-6b97e24593c3.gif) | ||
{%= screenshot('grunt-prompt in action', 'https://f.cloud.github.com/assets/51505/867636/e727abfc-f717-11e2-997e-6b97e24593c3.gif') %} |
39570
355
383