Skip to content

Commit

Permalink
feat(init): install coffee-script automatically
Browse files Browse the repository at this point in the history
if the user initialize Karma passing a .coffee file we'll install
coffee-script and put it as a dev-dependency

Closes #1152
  • Loading branch information
cironunes committed Aug 20, 2014
1 parent f1c567a commit e876db6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,17 @@ exports.init = function(config) {
sm.process(questions, function(answers) {
var cwd = process.cwd();
var configFile = config.configFile || 'karma.conf.js';
var testMainFile = (/\.coffee$/).test(configFile) ? 'test-main.coffee' : 'test-main.js';
var isCoffee = path.extname(configFile) === '.coffee';
var testMainFile = isCoffee ? 'test-main.coffee' : 'test-main.js';
var formatter = formatters.createForPath(configFile);
var processedAnswers = processAnswers(answers, getBasePath(configFile, cwd), testMainFile);
var configFilePath = path.resolve(cwd, configFile);
var testMainFilePath = path.resolve(cwd, testMainFile);

if (isCoffee) {
installPackage('coffee-script');
}

if (processedAnswers.generateTestMain) {
formatter.writeRequirejsConfigFile(testMainFilePath);
console.log(colorScheme.success(
Expand Down

0 comments on commit e876db6

Please sign in to comment.