diff --git a/lib/cli.coffee b/lib/cli.coffee index 89dc520..128a957 100644 --- a/lib/cli.coffee +++ b/lib/cli.coffee @@ -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: '*' diff --git a/test/test.coffee b/test/test.coffee index 1029588..4031edc 100644 --- a/test/test.coffee +++ b/test/test.coffee @@ -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' + 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'