These are chat archives for opal/opal

17th
Oct 2016
siassaj
@siassaj
Oct 17 2016 01:15
nvm. looks like a lot of regular ruby stuff won't apply in a js context
meh.
@meh
Oct 17 2016 01:25
siassaj, yeah sadly that's the case
siassaj
@siassaj
Oct 17 2016 01:25
i wish virtus did
it also means simple_form's probably out of the equation
Jamie Gaskins
@jgaskins
Oct 17 2016 12:27
@siassaj Virtus might work since it just gives you mixins for Ruby classes. In your server-side app somewhere, if you run Opal.use_gem 'virtus', you should be able to do require 'virtus' in your client-side app.
However, simple_form would be a bit more complicated since it's built on top of Rails' action_view, which (a) is more code than you want in a JS app and (b) possibly uses Ruby trickery that might not work with Opal. A lot of things in Rails use enough arcane Ruby to break all alternative Ruby implementations, not just Opal. :-)
siassaj
@siassaj
Oct 17 2016 21:03
If I use use_gem can I trust opal to fetch the files for that gem and all its dependencies
Jamie Gaskins
@jgaskins
Oct 17 2016 21:19
@siassaj No, it just adds that gem's require paths to Opal's require path.
siassaj
@siassaj
Oct 17 2016 21:27
Perhaps i misphrased, assuming I have all of that on disk via bundled, can I assume opal will bundle all the required files into the build?
I ask because specifically with virtus it was throwing errors that indicated otherwise, although my interpretation of the errors (which I don't have atm) may be naïve
meh.
@meh
Oct 17 2016 22:10
siassaj, use_gem just adds the paths, you still have to require what you must require
Elia Schito
@elia
Oct 17 2016 23:51
@siassaj virtus uses some thread-related stuff that's not supported on opal:
⤑ opal -g virtus -e "require 'virtus'; class Foo; include Virtus::Model; attribute :bar, String; end"                                                                            ~
/Users/elia/.rvm/gems/ruby-2.3.1/gems/opal-0.10.2/lib/opal/builder.rb:118:in `read': A file required by "-e" wasn't found. (Opal::Builder::MissingRequire)
A file required by "virtus" wasn't found.
A file required by "descendants_tracker" wasn't found.
A file required by "thread_safe" wasn't found.
A file required by "thread_safe/synchronized_delegator" wasn't found.
can't find file: "monitor" in ["/Users/elia/.rvm/gems/ruby-2.3.1/gems/opal-0.10.2/opal", "/Users/elia/.rvm/gems/ruby-2.3.1/gems/opal-0.10.2/stdlib", "/Users/elia/.rvm/gems/ruby-2.3.1/gems/opal-0.10.2/lib", "/Users/elia/.rvm/gems/ruby-2.3.1/gems/thread_safe-0.3.5/lib", "/Users/elia/.rvm/gems/ruby-2.3.1/gems/descendants_tracker-0.0.4/lib", "/Users/elia/.rvm/gems/ruby-2.3.1/gems/equalizer-0.0.11/lib", "/Users/elia/.rvm/gems/ruby-2.3.1/gems/thread_safe-0.3.5/lib", "/Users/elia/.rvm/gems/ruby-2.3.1/gems/descendants_tracker-0.0.4/lib", "/Users/elia/.rvm/gems/ruby-2.3.1/gems/coercible-1.0.0/lib", "/Users/elia/.rvm/gems/ruby-2.3.1/gems/thread_safe-0.3.5/lib", "/Users/elia/.rvm/gems/ruby-2.3.1/gems/descendants_tracker-0.0.4/lib", "/Users/elia/.rvm/gems/ruby-2.3.1/gems/ice_nine-0.11.2/lib", "/Users/elia/.rvm/gems/ruby-2.3.1/gems/thread_safe-0.3.5/lib", "/Users/elia/.rvm/gems/ruby-2.3.1/gems/axiom-types-0.1.1/lib", "/Users/elia/.rvm/gems/ruby-2.3.1/gems/virtus-1.0.5/lib"]
    from /Users/elia/.rvm/gems/ruby-2.3.1/gems/opal-0.10.2/lib/opal/builder.rb:127:in `process_require'
    from /Users/elia/.rvm/gems/ruby-2.3.1/gems/opal-0.10.2/lib/opal/builder.rb:144:in `block in process_requires'
✂️