Skip to content

Commit

Permalink
fix incorrect default if no name given through cli
Browse files Browse the repository at this point in the history
  • Loading branch information
joshrowley committed Nov 18, 2014
1 parent 49e3b4d commit 19f14b5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/cli.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class CLI
help: 'Name of the template you want to use'
s.addArgument ['path'],
nargs: '?'
defaultValue: process.cwd()
defaultValue: null
help: 'Path where you want to create your project'
s.addArgument ['--overrides', '-o'],
nargs: '*'
Expand Down
14 changes: 14 additions & 0 deletions test/test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,20 @@ describe 'cli', ->
.then(cli.run.bind(cli, 'rm foobar'))
.should.be.fulfilled

it 'should default the path to the name of the template in cwd if no path is provided', ->
name = 'manatoge'

This comment has been minimized.

Copy link
@jescalan

jescalan Nov 19, 2014

Contributor

+1 for manatoge

test_path = path.join(process.cwd(), name)

cli.run("add #{name} #{test_template_url}")
.then(cli.run.bind(cli, "init #{name} -o foo bar"))
.then ->
fs.existsSync(path.join(test_path, 'index.html')).should.be.ok
contents = fs.readFileSync(path.join(test_path, 'index.html'), 'utf8')
contents.should.match /bar/
rimraf.sync(test_path)
.then(cli.run.bind(cli, "rm #{name}"))
.should.be.fulfilled

# these tests require a better way of responding to the command-line
# prompts. they will remain stubbed for ref until a new solution is found
it 'creates a project with multiple inquirer inputs'
Expand Down

0 comments on commit 19f14b5

Please sign in to comment.