These are chat archives for opal/opal

9th
Jun 2015
Vais Salikhov
@vais
Jun 09 2015 03:42
@jaredcwhite, LOL, that was me at my most marketing-ish-est, not sure I get more marketing-ish than that :)In other news, opal/rubyspec is in the process of merging with the canonical rubyspec fork used by ruby itself, ruby/rubyspec. Even though we've been pulling latest changes from ruby/rubyspec for a little while now to keep opal/rubyspec up-to-date, a few days ago @eregon kindly landed a hand to merge our changes into ruby/rubyspec and extended an invitation for Opal to use and contribute to ruby/rubyspec directly (i.e. opal/rubyspec is going away).
Vais Salikhov
@vais
Jun 09 2015 05:10
...and opal/rubyspec is gone, we are now working with :sparkles: the canonical ruby/rubyspec :sparkles: directly opal/opal@e573e8f
"Everything you wanted to know about benchmarking Opal but were afraid to ask"
:wink:
Elia Schito
@elia
Jun 09 2015 08:07
great!
Elia Schito
@elia
Jun 09 2015 12:21
@adambeynon https://www.youtube.com/playlist?list=PLE7tQUdRKcyYo1VtPcjHhtPxQ0cTzq5Tn anything I shuold absolutely watch? (excluding sandi and tom stuart)
Mitch VanDuyn
@catmando
Jun 09 2015 15:20
hello - I just upgraded from opal 0.6 to 0.7 and opal-rspec is throwing this error:
Uncaught TypeError: Cannot set property 'hash' of undefined kernel.rb:482Uncaught NameError: uninitialized constant Object::RSpec
Mitch VanDuyn
@catmando
Jun 09 2015 15:30
just moved back to opal 0.6 and it works, then moved to opal 0.7 and it fails
Christian Käser
@dfyx
Jun 09 2015 15:30
@elia Is it intended that opal-jquery doesn't wrap replaceWith()?
Elia Schito
@elia
Jun 09 2015 15:30
@dfyx consider that a PR opportunity ;)
Christian Käser
@dfyx
Jun 09 2015 15:31
Will do
Elia Schito
@elia
Jun 09 2015 15:31
@catmando sometimes trashing tmp/cache/assets and restarting the server helps
Mitch VanDuyn
@catmando
Jun 09 2015 15:32
@elia - this is just a simple rack server
is there an equivilent cache?
Elia Schito
@elia
Jun 09 2015 15:34
oh, I guess no
Mitch VanDuyn
@catmando
Jun 09 2015 15:42
do you have to require opal some place in 0.7?
for what its worth here is config.ru
require 'bundler'
Bundler.require

require "opal-rspec"

Opal.append_path File.expand_path('../spec', __FILE__)

run Opal::Server.new { |s|
  s.main = 'opal/rspec/sprockets_runner'
  s.append_path 'spec'
  s.append_path 'spec/vendor'
  s.append_path Opal::React.bundled_path
  s.debug = true
  s.index_path = 'spec/reactjs/index.html.erb'
}
Mitch VanDuyn
@catmando
Jun 09 2015 15:52
and when I change so that it reads just like the instructions on the github page I get this:
http://localhost:9292/assets/opal/rspec/sprockets_runner.js 404 not found!!!!
Elia Schito
@elia
Jun 09 2015 15:53
sorry, but can't help very much right now
Mitch VanDuyn
@catmando
Jun 09 2015 16:00
understood, but man I hope somebody can give me a clue what is going on... going to try a fresh setup from scratch
Forrest Chang
@fkchang
Jun 09 2015 16:33
@catmando I've not done it as a simple rack server, but from experience w/using in opal-rails, I'd say the message is pretty clear, that it can't find the sprockets_runner.js. You specify it as the main file, so either you have your own copy of it, or you want to access the sprockets_runner in opal-rspec gem, which means you'll have to add it to opal's load path so it finds it as you've specified it (or specify it differently)
Mitch VanDuyn
@catmando
Jun 09 2015 17:27
@fkchang head is spinning... I'll take any suggestion. Right now I can get rid of that error (sprockets runner not found) by requiring 'opal-rspec'
but perhaps that is what is causing the other breakages. I just don't fully follow your suggestion, I got that I have to include sprockets_runner.js someplace, but where exactly, and where do I get it?
Sorry to be dim :-)
I mean I see a "spec_runner.js" in opal_spec/vendor...
I see the .rb.erb file, so I guess I can bodge this up someway...
Mitch VanDuyn
@catmando
Jun 09 2015 18:37
Hi
Forrest Chang
@fkchang
Jun 09 2015 19:54
@catmando s.main = 'opal/rspec/sprockets_runner' specifies the file for Opal::Server to run - somehow the you need the spec files, the class files, need to get loaded and rspec needs to get kicked off. This can be done in a number of ways, all via the code file run, or in the index_path file or some combination of both (i.e. load the files in the index, kick off the suite in the js.rb). That being said, IIRC, there are sprocket_runners in both opal-rspec and opal-rails (at least to facilitate being able to run a rake task and to hit the /opal_spec in the app itself, you can imagine the 2 end points would be different). Since you are not using opal-rails, I would have to assume the sprockets_runner.js.rb you want to run is the one in opal-rspec gem. Re: your error I can't tell ifuninitialized constant Object::RSpec is the problem, but I would suspect that maybe you are missing an opal-rspec reference. It might be one of those cases where you need to require it on the server side for 1 thing, and on the client for the other half
Mitch VanDuyn
@catmando
Jun 09 2015 19:57
@fkchang. Hey thanks a lot. Meanwhile I looked at another gem source I have that DOES have seem to work okay (opal-aasm) and I see that the developer of react.rb has some things I don't understand in the way files are required. I think that may be causing the problem. Thanks again, I'll let everybody know what I figure out for future reference.
Mitch VanDuyn
@catmando
Jun 09 2015 20:18

@/all So can somebody explain why (and how it works) I see opal gem structures like this:
top-level

   | - lib
         | - opal
         | - opal-gemname.rb
   | - opal
         | - opal
         | - opal-remname.rb

Am I right in guessing that the code in the lib directory only runs on the server, while in outer opal directory is common?

I have been doing an

if RUBY_ENGINE = = 'opal'
   ...
else
   ...
end

to achieve this, but I am looking at some other gems it does not have the RUBY_ENGINE == 'opal' anywhere, but yet I am pretty sure some of these gems (like opal-rspec) must have some differences between server and client.

I think this is at this is related to why I can't get react.rb to run opal-rspec. I have an older version of react.rb that has the if RUBY_ENGINE... and it works fine.

Any help appreciated!

Mitch VanDuyn
@catmando
Jun 09 2015 20:53
figured it out... you have to use latest released opal-rspec with latest released opal. Gemfile was locked at opal-rspec 3x...
Jared White
@jaredcwhite
Jun 09 2015 21:05
@catmando the lib ... opal structure is actually an older convention. Using the if conditional within /lib alone is newer and preferred AFAIK.