Skip to content
Browse files

Close GH-522: Replaced coffescript task with grunt-coffee. Fixes #407,…

… Fixes #387
  • Loading branch information...
1 parent 663d8ff commit 00d39a2dc82bf0be6d9f59e9c1d52fcf6f813160 @blakeblackshear blakeblackshear committed with sindresorhus Sep 24, 2012
Showing with 4 additions and 33 deletions.
  1. +2 −1 cli/package.json
  2. +0 −30 cli/tasks/coffee.js
  3. +1 −0 cli/tasks/yeoman.js
  4. +1 −2 cli/test/test-build.js
View
3 cli/package.json
@@ -56,7 +56,8 @@
"prompt": "~0.1.12",
"colors": "~0.6.0",
"grunt-mocha": "~0.1.3",
- "es6-collections": ">=0.2.0"
+ "es6-collections": ">=0.2.0",
+ "grunt-contrib-coffee": "~0.3.0"
},
"devDependencies": {
"mocha": "~1.4.0",
View
30 cli/tasks/coffee.js
@@ -1,30 +0,0 @@
-module.exports = function(grunt) {
- var path = require('path');
-
- grunt.registerMultiTask('coffee', 'Compile CoffeeScript files', function() {
- var dest = this.file.dest;
-
- grunt.file.expandFiles(this.file.src).forEach(function(filepath) {
- grunt.helper('coffee', filepath, dest);
- });
-
- if (grunt.task.current.errorCount) {
- return false;
- }
- });
-
- grunt.registerHelper('coffee', function(src, destPath) {
- var coffee = require('coffee-script'),
- js = '',
- dest = path.join(destPath,
- path.basename(src, '.coffee') + '.js');
-
- try {
- js = coffee.compile(grunt.file.read(src), { bare: true });
- grunt.file.write(dest, js);
- } catch (e) {
- grunt.log.error("Unable to compile your coffee", e);
- }
- });
-
-};
View
1 cli/tasks/yeoman.js
@@ -21,6 +21,7 @@ module.exports = function(grunt) {
//
grunt.loadTasks(join(__dirname, '../node_modules/grunt-jasmine-task/tasks'));
grunt.loadTasks(join(__dirname, '../node_modules/grunt-mocha/tasks'));
+ grunt.loadTasks(join(__dirname, '../node_modules/grunt-contrib-coffee/tasks'));
// build targets: these are equivalent to grunt alias except that we defined
// a single task and use arguments to trigger the appropriate target
View
3 cli/test/test-build.js
@@ -104,8 +104,7 @@ describe('yeoman init && yeoman build', function() {
it('should go through coffee:dist', function() {
// handled version file, get back filename via grunt globbing
var foo = grunt.file.expandFiles('temp/scripts/*.foo.js')[0];
- assert.equal(grunt.file.read(foo), 'var foo;\n\nfoo = "yeo";\n');
- assert.equal(grunt.file.read(foo), 'var foo;\n\nfoo = "yeo";\n');
+ assert.equal(grunt.file.read(foo), '(function() {\n var foo;\n\n foo = "yeo";\n\n}).call(this);\n');
});
});

0 comments on commit 00d39a2

Please sign in to comment.
Something went wrong with that request. Please try again.