Skip to content
This repository
Browse code

Added a command line option to specify the compiler, which defaults t…

…o coffee. Removed hardcoded use of iced compiler and allow compilation from anything that supports the same command line arguments as coffee.
  • Loading branch information...
commit 61b67c29fc844e6b9c5f092bce795fd09e57efe5 1 parent 32cccc6
Gregory Waxman Akkuma authored
5 lib/node.io/interfaces/cli.js
@@ -30,6 +30,7 @@ var usage = ''
30 30 + ' -g, --debug Debug the operation\n'
31 31 + ' -v, --version Display the current version\n'
32 32 + ' -h, --help Display help information\n'
  33 + + ' -c, --compiler Set an alternate compiler to use\n'
33 34 ;
34 35
35 36 /**
@@ -118,6 +119,10 @@ exports.cli = function (args, exit) {
118 119 case '--unpack':
119 120 options.unpack = args.shift();
120 121 break;
  122 + case '-c':
  123 + case '--compiler':
  124 + options.compiler = args.shift();
  125 + break;
121 126 default:
122 127 job_path = arg;
123 128 if (args.length) {
2  lib/node.io/processor.js
@@ -335,7 +335,7 @@ Processor.prototype.loadJob = function (job, options, callback) {
335 335 //If we're the master, compile and load the .coffee file
336 336 this.status('Compiling ' + job + ' => ' + compiled_js, 'debug');
337 337
338   - utils.compileCoffee(job, compiled_js, function(err) {
  338 + utils.compile(options.compiler || 'coffee', job, compiled_js, function(err) {
339 339 if (err) {
340 340 callback(err);
341 341 } else {
17 lib/node.io/utils.js
@@ -78,21 +78,10 @@ exports.removeOnExit = function (file) {
78 78 * @param {Function} callback
79 79 * @api public
80 80 */
81   -exports.compileCoffee = function (coffee_file, compiled_file, callback) {
82   - exec('iced -p -c "' + coffee_file + '"', {cwd: cwd}, function (err, stdout, stderr) {
  81 +exports.compile = function (compiler, coffee_file, compiled_file, callback) {
  82 + exec(compiler + ' -p -c "' + coffee_file + '"', {cwd: cwd}, function (err, stdout, stderr) {
83 83 if (err || stderr) {
84   - if (!stderr || (stderr && stderr.indexOf("iced: not found") === -1)) {
85   - callback(err || stderr);
86   - } else {
87   - exec('coffee -p -c "' + coffee_file + '"', {cwd: cwd}, function (err, stdout, stderr) {
88   - if (err || stderr) {
89   - callback(err || stderr);
90   - } else {
91   - exports.removeOnExit(compiled_file);
92   - fs.writeFile(compiled_file, stdout, callback);
93   - }
94   - });
95   - }
  84 + callback(err || stderr);
96 85 } else {
97 86 exports.removeOnExit(compiled_file);
98 87 fs.writeFile(compiled_file, stdout, callback);

0 comments on commit 61b67c2

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