Using RingoJS EventEmitter... or how to use coffeescript compiler with RingoJS

367 views Asked by At

I am trying to get the coffeescript compiler working with RingoJS (we're a Java shop...)

I have had some success - https://github.com/jashkenas/coffee-script/wiki/Using-CS-with-Java-Rhino

Now I am trying to get the coffee-script/command stuff ( https://github.com/jashkenas/coffee-script/blob/master/lib/coffee-script/command.js ) to work rather than re-doing it, but its failing on these lines:

CoffeeScript = require('./coffee-script');

_ref = require('child_process'), spawn = _ref.spawn, exec = _ref.exec;

EventEmitter = require('events').EventEmitter;

helpers.extend(CoffeeScript, new EventEmitter);

// fails here - EventEmitter is undefined and so the extend fails.

I have tried writing an adapter "events.js" to turn the ringojs/events into what its expecting, but my JS skills or lack of them are failing me.

This is what I have:

(function() {
    require("ringo/events");
    var events = { };
    events['EventEmitter'] = EventEmitter;
    return events;
}).call(this);

But EventEmitter is still undefined here - I'd expect it to be available due to the exports.EventEmitter line in ringojs/events, but obviously not...

Any thoughts/tips on where I am going wrong.

Thanks in advance, Chris

0

There are 0 answers