LiveScript, Coffeescript and IcedCoffeescript support through a hook and some orientdb-studio change

74 views
Skip to first unread message

MrFT

unread,
Jun 11, 2014, 8:32:11 AM6/11/14
to orient-...@googlegroups.com
Hello,

If you are interested in these compile-to-javascript scripting langages, please let me know what you think about the following...


I implemented a OrientDB hook that supports LiveScript and CoffeeScript here:

And I also added some basic support to the orient-db studio here.

I added the jar file and the studio.zip to this message, so you can give it a try. Just rename your studio.zip under /plugins to studio.zip.bak, and save this one to the same folder.

Then you need to add the hook, by saving the jar file to /lib and by updating the orientdb-server-config.xml file. You need to add <hooks> like in the example below.

<orient-server>
    ...
    <hooks>
   <hook class="be.vsko.orientdb.IcedCoffeeScriptHook" position="REGULAR"/>
    </hooks>
</orient-server>

Don't forget to restart OrientDB.

Currently the studio depends on the hook being active, but it would be quite easy to make sure that the studio doesn't need this hook, because the compilation could also be done in the browser.
That would mean that creating or updating functions in such a language could only be done from the studio, but maybe that is good enough?

What do you think?


studio.zip
IcedCoffeeScriptHook.jar

Enrico Risa

unread,
Jun 11, 2014, 9:07:07 AM6/11/14
to orient-...@googlegroups.com
Cool MrFt

i will try it :D


--

---
You received this message because you are subscribed to the Google Groups "OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

MrFT

unread,
Jun 12, 2014, 12:50:16 PM6/12/14
to orient-...@googlegroups.com, enric...@gmail.com
New versions.

Fixed a bug in the hook where LiveScript would be compiled using coffeescript compiler.

Added compile support IN the studio, so you don't need the hook anymore.






Op woensdag 11 juni 2014 15:07:07 UTC+2 schreef Enrico Risa:
IcedCoffeeScriptHook.jar
studio.zip

Luca Garulli

unread,
Jun 12, 2014, 1:15:14 PM6/12/14
to orient-database, Enrico Risa
Hey,
This is cool. I think you should do a plugin, so users can just copy under "plugins" folder and works. Take a look at Studio how is done, or ask here if needed.

About supported Scripting languages, maybe we'd need a new command in HTTP to retrieve all of registered ones, so Studio can just call it to avoid changing Studio every time. WDYT?

Lvc@

MrFT

unread,
Jun 16, 2014, 5:07:59 AM6/16/14
to orient-...@googlegroups.com, enric...@gmail.com

I don't know what exactly you want me to turn into a plugin...

Do you mean I can turn the hook into a plugin, so there is a zero-configuration way of adding this functionality? Or do you mean something else?

Also, since I added the compiler to the studio, you don't even need the hook anymore, provided you only use the studio to make changes to your functions. 



Op donderdag 12 juni 2014 19:15:14 UTC+2 schreef Lvc@:

Luca Garulli

unread,
Jun 16, 2014, 5:15:13 AM6/16/14
to orient-database, Enrico Risa
So do you mean you convert them to plain JS at client side? This would be easier to integrate. What license have the modules you used?

Lvc@

Frederik Tilkin

unread,
Jun 16, 2014, 5:28:03 AM6/16/14
to orient-...@googlegroups.com
MIT License for both.



--

---
You received this message because you are subscribed to a topic in the Google Groups "OrientDB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/orient-database/SXj2PlJGrzY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to orient-databa...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Enrico Risa

unread,
Jun 16, 2014, 5:34:05 AM6/16/14
to orient-...@googlegroups.com
Cool 
we could leave the compilation on the client-side without bothering the server. :D

Frederik Tilkin

unread,
Jun 16, 2014, 7:11:42 AM6/16/14
to orient-...@googlegroups.com
Should I send a pull request to the orientdb-studio repository?
(The code-mirror editor behaves a bit strange - it only starts showing the existing code after I type one charecter - , but I don't have too much experience with that)
Apart from that it pretty much works. Maybe someone should check out my github repository (mrft) and look at it before we merge it into the master studio repository?

Anyway the concept is that an extra property gets added called icedcoffeescript or livescript, and when that property is present it gets compiled and saved along with the OFunction document.

That's basically it.
The nice thing is that when a compile error occurs, the javascript function will contain
return "[Compiler error] ...";
in the javascript function body, so the other functions will still work, so you can continue working on a new unfinished function without impacting all the other functions.





Reply all
Reply to author
Forward
0 new messages