Browse files

Updating init task docs and expect script. This closes #37 and closes #…

  • Loading branch information...
1 parent 6549afd commit 2a6a44aa4fdea184597788a8790e1cd9d0ada8ce @cowboy cowboy committed Feb 27, 2012
Showing with 42 additions and 27 deletions.
  1. +25 −13 dev/init.exp
  2. +16 −12 docs/
  3. +1 −2 docs/
@@ -8,7 +8,7 @@ set template [lrange $argv 0 0]
set project "grunt-$template-example"
# Disable git pushing when debugging.
-set gitpush true
+set gitpush 1
# Save output for later use.
log_file -noappend /tmp/grunt-expect-out
@@ -71,41 +71,53 @@ expect "$ "
send "git add .\r"
expect "$ "
send "git commit -m 'Committing example \"grunt init:$template\" task output.'\r"
-if {$gitpush} {
- expect "$ "
- send "git push -u origin master\r"
# Session logging stops here.
expect "$ "
send "# EOF\n"
# Add meta-content to the README.
expect "$ "
-send "echo -e '
+send "echo -e '# Grunt \"init:$template\" example
+This is example output generated by the \"grunt init:$template\" task.
+_Note: this repository is generated dynamically. Instead of reporting issues
+here, please report any issues with this repository as \[grunt issues\]\[issues\].
+Instead of watching or forking this repository, watch \[grunt\]\[grunt\] and use
+the grunt \[init task\]\[init\]._
+## Project Creation Transcript
The following is a transcript of the session in which this project and
repository were created. This is not actually a part of the \[grunt\]\[grunt\]
\"init:$template\" template, this session transcript was added afterwards. The
text after the `$` are the commands that were executed, and everything else is
program output. If you want to see the repository exactly as it was created by
-grunt, browse \[the previous commit\]($project/tree/HEAD~1).
+grunt, view \[the previous commit\]\[prev\].' >\r"
+expect "$ "
+send "echo -e '
Want to learn more? Check \[grunt\]\[grunt\] out.
Note that this entire build process is automated by a rather complex \[expect
-script\](, which is
-used to automate grunt in order to facilitate the creation of this and other
-init task example repositories.
+script\]\[expect\], which is used to automate grunt in order to facilitate the
+creation of this and other \[init task\]\[init\] example repositories.
```' >>\r"
expect "$ "
# Strip out everything before the "mkdir" and after the "EOF". Also remove any "--no-color" bits.
send "cat /tmp/grunt-expect-out | perl -ne's/ --no-color//;if(/^\\\$ mkdir/){\$x=1}elsif(/^\\\$ # EOF/){\$x=0}\$x&&print\$_' >>\r"
expect "$ "
-send "echo '```' >>\r"
+send "echo -e '```
+## License
+Copyright (c) 2012 \"Cowboy\" Ben Alman
+Licensed under the MIT license.' >>\r"
# Commit again.
expect "$ "
@@ -1,28 +1,32 @@
[Grunt homepage]( | [Documentation table of contents](
# init (built-in task)
-Initialize a new project. Looks at the enviroment, asks you a few questions, then generates a [grunt.js configuration](
-and some other files, depending on the template you choose
+Generate project scaffolding from a predefined template.
## About
-Unlike other taks, init should be run only once for a project. For existing projects, make sure that everything is already commited, as
-it may override existing files, like a or package.json.
+The `init` task initializes a new project, based on the current environment and the answers to a few questions. Once complete, a [grunt.js configuration file]( will be generated along with a complete directory structure, including a basic readme, license, package.json, sample source files and unit tests (etc).
-init currently supports three templates:
+The exact files and contents created depend on the template chosen along with the answers to the questions asked.
-* commonjs
-* jquery
-* node
+Unlike other tasks, init should only ever be run once for a project. Typically, it is run at the very beginning before work has begun, but it can be run later. **Just keep in mind that new files are generated, so for existing projects, ensure that everything is already committed first.**
## Usage examples
-Create a new jQuery plugin project:
+Change to a new directory, and type in `grunt init:TEMPLATE` where TEMPLATE is one of the following templates. Answer the questions. Done.
-`grunt init:jquery`
+## Built-in templates
-Create a new node.js project:
+This task currently supports these templates:
-`grunt init:node`
+* `commonjs` - [sample repo]( and [sample creation transcript](
+* `jquery` - [sample repo]( and [sample creation transcript](
+* `node` - [sample repo]( and [sample creation transcript](
+For each, you can view a sample repository as well as a transcript of the commands used to generate that sample repository. Take a look!
+## Template structure
+_TODO: write this_
See the [init task source]( for more information.
@@ -10,12 +10,11 @@
## Built-in tasks
* [concat]( - Concatenate files.
+* [init]( - Generate project scaffolding from a predefined template.
* [lint]( - Validate files with [JSHint][jshint].
* _(more documentation coming soon)_
-* [init]( - Generate project scaffolding from a predefined template.
* [min]( - Minify files with [UglifyJS][uglify].
* [qunit]( - Run [QUnit][qunit] unit tests in a headless [PhantomJS][phantom] instance.
* [server]( - Start a static web server.

0 comments on commit 2a6a44a

Please sign in to comment.