These are chat archives for opal/opal

26th
Jun 2016
Guillaume Grossetie
@Mogztter
Jun 26 2016 16:40
opal-6000.PNG
6000 commits !
Yehonathan Sharvit
@viebel
Jun 26 2016 16:59
@catmando could you share information about how to execute gems in the browser?
Mitch VanDuyn
@catmando
Jun 26 2016 17:42
Will try to get something to u later today or tomorrow @viebel
There is an article I wrote that is buried in the opal docs... perhaps someone knows where it ended up
Yehonathan Sharvit
@viebel
Jun 26 2016 18:08
It will be very helpful if you send me material @catmando
Mitch VanDuyn
@catmando
Jun 26 2016 18:09
@viebel just to make sure I answer the right question... what r u trying to do :-)
Yehonathan Sharvit
@viebel
Jun 26 2016 19:14
@catmando I'm trying to run a ruby piece of code that requires a ruby gem e.g. https://github.com/hamstergem/hamster
Jamie Gaskins
@jgaskins
Jun 26 2016 19:19
@viebel The hamster gem doesn't run on Opal. :-( I fixed the syntax errors it generated, but it turns out it also depends on concurrent-ruby, which depends on a native (C/Java) extension.
I wanted it because I use a lot of immutability in my Clearwater apps (with grand_central as my data store), so I put a lot of effort into making it work, but concurrent-ruby isn't something Opal can run.
I was actually surprised when it relied on that gem because I thought persistent data structures were innately thread-safe.
Yehonathan Sharvit
@viebel
Jun 26 2016 19:24
@jgaskins can you share an example of a gem that works in Opal + how to make it work inside the browser?
Mitch VanDuyn
@catmando
Jun 26 2016 19:41
Did u look at canonbol gem?
Let me know if what u need
If that's what u need
Yehonathan Sharvit
@viebel
Jun 26 2016 19:46
Thanks @catmando. Where is the lists of all the gems that are compatible with opal?
Mitch VanDuyn
@catmando
Jun 26 2016 19:47
I don't think anyone has published one. Great idea though
Mitch VanDuyn
@catmando
Jun 26 2016 20:00
I converted a couple of gems as long as they don't depend on obvious problem areas things seem to work
Yehonathan Sharvit
@viebel
Jun 26 2016 20:02
Could you share the converted gems, somehow? I'd like to have a repository of gems in javascript. Does it make sense?
Yehonathan Sharvit
@viebel
Jun 26 2016 20:18
@catmando does it make sense?
Mitch VanDuyn
@catmando
Jun 26 2016 21:59
The couple I mentioned are released as standard gems
A good start would be to propose a list of gems to be converted. It would make an excellent beginner project to do the conversion
Jamie Gaskins
@jgaskins
Jun 26 2016 22:23

@viebel Some gems that aren't Opal-aware can be used directly by calling Opal.use_gem(gem_name) on the server side. This adds their require paths to Opal's list of require paths. Then you can require them in your client-side app as normal Ruby libraries.

Unfortunately, for it to work, those gems can't use anything Opal doesn't support, like threads, files (in the browser), native extensions, POSIX stuff (fork, processes), Net::HTTP, and other things that can't be done in the browser (at least, not the way Ruby does it).