carrot/sprout — pull request #35 by joshrowley (2014-11-18 19:44:38+00:00)
Title: Fix incorrect default if no name given through cli

This fixes the default behavior when a user does not provide a `path` argument through the CLI. The documentation indicates sprout should use the template name joined with the current working directory path. On [this line in init.coffee](https://github.com/carrot/sprout/blob/2809aaed3282a04063d7d6386c03ccb60c5681e6/lib/api/init.coffee#L73), sprout sets `@target` to the path given, and if `@target` is not present it sets the correct value. The only problem is that `ArgParse` has already a default value for `path` [here](https://github.com/carrot/sprout/blob/6845fe9f0e40a4ad92ca1cf8ffae2e4886ea9121/lib/cli.coffee#L96) before the configuration happens. This causes `@target` to already be defined to `process.cwd()` instead of the correct value of `path.join(process.cwd(), @name)`, which causes issues such as #34. Added a test to prevent regression.

Closes #34.