Permalink
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/task_init.md
  3. +1 −2 docs/toc.md
View
@@ -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 '
-### PROJECT CREATION TRANSCRIPT
+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\](https://github.com/cowboy/$project/tree/HEAD~1).
-
+grunt, view \[the previous commit\]\[prev\].' > README.md\r"
+expect "$ "
+send "echo -e '
Want to learn more? Check \[grunt\]\[grunt\] out.
\[grunt\]: https://github.com/cowboy/grunt
+\[issues\]: https://github.com/cowboy/grunt/issues
+\[init\]: https://github.com/cowboy/grunt/blob/master/docs/task_init.md
+\[expect\]: https://github.com/cowboy/grunt/blob/master/dev/init.exp
+\[prev\]: https://github.com/cowboy/$project/tree/HEAD~1
Note that this entire build process is automated by a rather complex \[expect
-script\](https://github.com/cowboy/grunt/blob/master/dev/init.exp), 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.
```' >> README.md\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\$_' >> README.md\r"
expect "$ "
-send "echo '```' >> README.md\r"
+send "echo -e '```
+
+## License
+Copyright (c) 2012 \"Cowboy\" Ben Alman
+Licensed under the MIT license.' >> README.md\r"
# Commit again.
expect "$ "
View
@@ -1,28 +1,32 @@
[Grunt homepage](https://github.com/cowboy/grunt) | [Documentation table of contents](toc.md)
# init (built-in task)
-Initialize a new project. Looks at the enviroment, asks you a few questions, then generates a [grunt.js configuration](configuraring.md)
-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 README.md 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](configuring.md) 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](https://github.com/cowboy/grunt-commonjs-example/tree/HEAD~1) and [sample creation transcript](https://github.com/cowboy/grunt-commonjs-example)
+* `jquery` - [sample repo](https://github.com/cowboy/grunt-jquery-example/tree/HEAD~1) and [sample creation transcript](https://github.com/cowboy/grunt-jquery-example)
+* `node` - [sample repo](https://github.com/cowboy/grunt-node-example/tree/HEAD~1) and [sample creation transcript](https://github.com/cowboy/grunt-node-example)
+
+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](https://github.com/cowboy/grunt/blob/master/tasks/init.js) for more information.
View
@@ -10,12 +10,11 @@
## Built-in tasks
* [concat](task_concat.md) - Concatenate files.
+* [init](task_init.md) - Generate project scaffolding from a predefined template.
* [lint](task_lint.md) - Validate files with [JSHint][jshint].
* _(more documentation coming soon)_
<!--
-* [init](task_init.md) - Generate project scaffolding from a predefined template.
-* LINT
* [min](task_min.md) - Minify files with [UglifyJS][uglify].
* [qunit](task_qunit.md) - Run [QUnit][qunit] unit tests in a headless [PhantomJS][phantom] instance.
* [server](task_server.md) - Start a static web server.

0 comments on commit 2a6a44a

Please sign in to comment.