These are chat archives for opal/opal

1st
Apr 2016
CJ Lazell
@cj
Apr 01 2016 18:08
afternoon. shouldn't I be able to require 'bigdecimal' ? can't find file: "bigdecimal" in ["/home/cj/apps/cj.io/young_actors_house/.bundle/gems/opal-0.9.2/opal"
@elia just tried the latest release, I'm getting Opal::GemNotFound: can't find gem opal when I do Opal.use_gem 'opal-jquery'
Jamie Gaskins
@jgaskins
Apr 01 2016 18:17
@cj You don't need to use Opal.use_gem 'opal-jquery'. That adds opal-jquery's server-side path to Opal's load path — which is probably not what you want. Just load the gem normally on the server side and it'll add itself to Opal's load path on its own.
CJ Lazell
@cj
Apr 01 2016 18:20
@jgaskins if you don't add use_gem, opal doesn't know to require it. ie if I don't have Opal.use_gem 'opal-connect' I can't do require 'opal/connect' in my opal code
Jamie Gaskins
@jgaskins
Apr 01 2016 18:21
@cj Try adding Opal.append_path File.expand_path('../../opal', __FILE__) inside your opal-connect.rb in your gem.
CJ Lazell
@cj
Apr 01 2016 18:21
if I'm also including a gem that isn't opal I need to do that too
I need to do Opal.use_gem 'ability_list' otherwise require 'ability_list' won't work
Jamie Gaskins
@jgaskins
Apr 01 2016 18:22
You never need to use Opal.use_gem unless you want server-side code to run client-side.
CJ Lazell
@cj
Apr 01 2016 18:22
I do
lol
that's why I'm using it :)
in 0.10.0.beta2 it's broken
Jamie Gaskins
@jgaskins
Apr 01 2016 18:23
Add Opal.append_path File.expand_path('..', __FILE__) to your lib/ability_list.rb.
CJ Lazell
@cj
Apr 01 2016 18:24
I shouldn't have to fork gems just to add that line, that's what use_gem is for....
Jamie Gaskins
@jgaskins
Apr 01 2016 18:25
Yes, exactly. Not for loading a gem made to run on Opal.
If you are using a gem that is intended to run client-side, you don't need Opal.use_gem to load it.
CJ Lazell
@cj
Apr 01 2016 18:25
these gems are server side gems that can also work client side
use_gem is what I want :) it's broken in the latest release
Jamie Gaskins
@jgaskins
Apr 01 2016 18:26
So if you're using it to load opal-jquery or opal-connect, you're missing something.
CJ Lazell
@cj
Apr 01 2016 18:27
ok, well it's still broken for when I load ability_list and screnriver :)
Jamie Gaskins
@jgaskins
Apr 01 2016 18:27
That's a different thing than what started this discussion.
CJ Lazell
@cj
Apr 01 2016 18:27
no it's not, I was pointing out use_gem is broken. you were the one that pointed out I don't need to use it lol
doesn't change the fact it doesn't work in the latest release :)
I appreciate you pointing out that fact though :)
CJ Lazell
@cj
Apr 01 2016 18:39
@jgaskins I updated the gem to use Opal.append_path. Going to open a ticket about use_gem in a sec
seems like require "bigdecimal" work in 0.10.0 which is nice :)
CJ Lazell
@cj
Apr 01 2016 19:51
anyone know why Opal.Opal.Compiler.$new('pts "blah"') wouldn't work in 0.10.0? Opal.Opal.Compiler doesn't seem to exist anymore
Elia Schito
@elia
Apr 01 2016 20:25
@cj have you required 'opal-parser' on the client?
CJ Lazell
@cj
Apr 01 2016 20:25
@elia yes
Elia Schito
@elia
Apr 01 2016 20:25
I'll try locally
CJ Lazell
@cj
Apr 01 2016 20:25
@elia zetachang/opalrb-loader#4
thank you
Elia Schito
@elia
Apr 01 2016 20:28
@cj you're right that is not there in that form, but it's available via opal
⤑ opal -v -ropal-parser -e'p Opal::Compiler.new "p :bla"'                      ~
Opal v0.10.0.beta2
#<Opal::Compiler:0x25c>
@cj this should work if you need it: Opal.get('Opal')).$$scope.get('Compiler')).$new("p :bla"))
Elia Schito
@elia
Apr 01 2016 20:33
this also works: Opal.Opal.$$scope.Compiler
CJ Lazell
@cj
Apr 01 2016 20:34
@elia shouldn't Opal.Opal.Compiler work though? or was it removed on purpose?
@elia that does work though, I can change it to that for now
Elia Schito
@elia
Apr 01 2016 20:38
@cj no, not done on purpose, it's something in the runtime or the compiler
please open an issue, it was convenient to have
CJ Lazell
@cj
Apr 01 2016 20:39
will do :)
done opal/opal#1418
Elia Schito
@elia
Apr 01 2016 20:42
thx
CJ Lazell
@cj
Apr 01 2016 20:43
no problem