maxtaco / coffee-script

IcedCoffeeScript
http://maxtaco.github.com/coffee-script
MIT License
728 stars 58 forks source link

New rubygems release #95

Open CyborgMaster opened 10 years ago

CyborgMaster commented 10 years ago

I love IcedCoffeeScript! Thanks so much for putting it together. Brilliant stuff.

I'm using it in my rails project, using the iced-rails gem, which depends on the iced-coffee-script gem (the ruby-coffee-script repo), which depends on the iced-coffee-script-source gem (which I am pretty sure is this repo).

The current version of the iced-coffee-script-source gem on rubygems is 1.2.0o and it looks like you've made some great progress since them (the latest version appears to be 1.6.3-g). Would it be possible to get another release pushed out to ruby gems?

Disclaimer: I'm not sure I'm asking in the right place because this repo doesn't appear to have a .gemspec file in it, so I'm not sure that this is the actual source of the rubygem, but I believe the owner of this repo is the owner of the gem, and the homepage on rubygems points here. I apologize if my assumptions are wrong.

maxtaco commented 10 years ago

Thanks! You know I recently tried to do this and failed a little while ago. I will try again. The build process in the jashkenas trunk changed a bunch and that thwarted me. I'll try to get around to fixing it. Thanks.

CyborgMaster commented 9 years ago

Just thought I would bump this again. I would love to be able to start using iced-coffee-script in my rails project again, but I need some of the features of the new version. Any luck with the build process? Anything I can do to help? Or maybe a suggestion for a workaround?

CyborgMaster commented 9 years ago

I just ran into another great place I could used iced coffee script. I might start poking into this myself if you don't have time.

maxtaco commented 9 years ago

Sorry @CyborgMaster! I've been slammed on other stuff. Urg. Can I hand this project off to you or to someone else? It's been so long since I made the gem, I've forgotten what's involved. I'm not much of a ruby user. I'm happy to adjust perms on rubyforge. Thanks

CyborgMaster commented 9 years ago

As long as the "this" in "hand off this project," means only the gem release and not all of IcedCoffeeScript, I'd be happy to help. :wink: Give me until Wednesday (I'm swamped until then myself), then I'll look into what has to happen to allow me to publish the gem.

maxtaco commented 9 years ago

Exactly, just the gem. Thanks!

CyborgMaster commented 9 years ago

I'm going to try and figure this out now, let me know if you have any tips.

CyborgMaster commented 9 years ago

How did you use to do it? I'm not finding anything that looks like it...

CyborgMaster commented 9 years ago

I opened up an issue over at jashkenas/coffeescript#3732 to ask how they do it. We'll see what they say.

maxtaco commented 9 years ago

Awesome, thanks for your help. I think they've been moving away from Rake and toward self-coffee-hosting. That might have something to do with it.

CyborgMaster commented 9 years ago

Right. I see the commits where they do that. It's a great idea, but they still must be doing something to package the gem, as it is still getting update in the coffee-script-source gem.

CyborgMaster commented 9 years ago

So I think I might have got the gem building, but now I'm getting an error when I try to compile with it:

Cannot set property 'CoffeeScript' of undefined

I'm still digging, any ideas?

CyborgMaster commented 9 years ago

It might have to do with the fact that its running inside ExecJS (V8) inside of a Rails project. Are there different build versions?

CyborgMaster commented 9 years ago

I'm going to have to give up for now. I do think I've got the gem packaging correctly, but I can't get it to run in my environment. It appears to have to do with the way CoffeeScript is trying to define it's global.

I think its crashing right at the top of iced-coffee-script-1.8.0-a.js, here:

f.CoffeeScript=e()

Which appears to be something to do with AMD or requireJS.

Vanilla CoffeeScript does this differently. It's global registration seems to be at the bottom of the file and looks like this:

root.CoffeeScript=CoffeeScript

Any ideas?

CyborgMaster commented 9 years ago

As a last thought, it may be worth noting. If I use the coffee-script.js file from the extras folder instead of iced-coffee-script-1.8.0-a.js, things work just fine (as long as I don't use any iced features of course).

This makes me think that it is not my gem packaging that is causing the problem. I'll have to lean on your expertise here for next steps.

CyborgMaster commented 9 years ago

A little more info (I couldn't help myself from digging more).

Turns out if I use version 1.6.3-j, it works like a charm. So something big changed since then.

maxtaco commented 9 years ago

Thanks for working on this. At some point, the runtime was factored out into a separate package for security reasons. That might be causing the problem. How do I reproduce the issue myself?

CyborgMaster commented 9 years ago

That might be it, although I have a feeling it has something to do with browserify.

Hmm... reproduce. That's a little tough, maybe you can help. I've got a rails project that I'm using now. I'm using iced-rails to compile iced-coffee-script. When I replace the source file with the latest version (using a new version of iced-coffee-script-source), it crashes when I try to compile any .iced files.

This would probably happen in any project that uses the iced-coffee-script gem to compile iced files in ruby, or maybe anything that ran the iced compiler using V8.

Is that enough to go on? If not, I can try and help you set up a rails project that mimics mine.

NocturnalScream commented 9 years ago

Hi CyborgMaster, I'm really sorry for everyone here, I'm new to github and have absolutely no clue how to contact someone directly. So i just gonna leave a comment here for Cyborg. I'm really intereset in your FTB Monster Gregtech config, and got a few questions, is there a way to get in direct contact with you?

regards

CyborgMaster commented 9 years ago

@maxtaco any ideas? (I know it can get crazy around the holidays, so no pressure)

avonwyss commented 9 years ago

I'm experiencing the same problem, but in a completely different environment. It used to work fine with an older Iced CoffeeScript version (1.7.1-b I believe) but now I get the exact same errors as CyborgMaster.

As mentioned the environment is very different; I run this on Windows in a bare instance of MS Chakra JS engine (as COM object, not within a browser, so there is no "window" object etc.).

I think that the assertion is no longer valid: "The core compiler however [...] can be run in any JavaScript environment" - it seems to rely on either a browser with a window object (where events are attached) or a node.js-style module system. When run in a bare JS environment as in the case of CyborgMaster and me it fails and due to the minimized/obfuscated wrapper around the compiler source I find it very difficult to pinpoint the exact issue.

Edit: I've played around some more and have come to the following code which works in my environment, adding CoffeeScript as global object. As starting point I took the non-minified file from the extras and replaced the beginning and end as follows, effectively removing the original code which does the detection of the available environment (everything in between the one overlap line remains identical):

CoffeeScript = (function(repository) {
        var modules = {};
        function process(id) {
            if (!modules[id]) {
                var module = modules[id] = { exports: {} };
                repository[id][0].call(module.exports, function(depName) {
                    return process(repository[id][1][depName]);
                }, module, module.exports);
            }
            return modules[id].exports;
        }
        return process(2); // ID of main compiler in repository
    })(
//----MODULES START----
{1:[function(_dereq_,module,exports){

and

},{"./const":17,"FWaASH":14}]}
//----MODULES END----
);

While this is certainly not a universal fix it may get @CyborgMaster on track as well.

CyborgMaster commented 8 years ago

I just ran into another sad encounter where I wished I had iced coffee script. Anyone have any updates here?