These are chat archives for opal/opal

23rd
Jan 2016
Torstein Saltvedt
@saltvedt
Jan 23 2016 00:00
silly question, have you restarted the rails server after installing opal?
Loïc Boutet
@loicboutet
Jan 23 2016 00:01
actually I can't even start the server ^^
any rails * command throw the error
:(
Torstein Saltvedt
@saltvedt
Jan 23 2016 00:02
never used opal-rails, but seems like the config the rails initializers is wrong then
Loïc Boutet
@loicboutet
Jan 23 2016 00:03
yeah ... but that s really weird
I m just trying to configure opal the way shown here : http://reactrb.org/docs/getting-started.html
in an empty app
I would say it s a bug, but if this is a bug I don't get how anyone is using opal-rails ^^
so I guess I m doing something wrong...
Elia Schito
@elia
Jan 23 2016 00:06
@loicboutet I think it's the latest sprockets version
Brady Wied
@wied03
Jan 23 2016 00:08
@elia - Had a similar issue with karma-opal-rspec
Elia Schito
@elia
Jan 23 2016 00:08

@loicboutet try adding this line to your gemfile:

https://github.com/opal/opal-rails/blob/master/opal-rails.gemspec#L29

Loïc Boutet
@loicboutet
Jan 23 2016 00:08
testing that
Elia Schito
@elia
Jan 23 2016 00:08
gem 'sprockets-rails',     '< 3.0'
Brady Wied
@wied03
Jan 23 2016 00:08
wied03/karma-opal-rspec@c60bf2c
Loïc Boutet
@loicboutet
Jan 23 2016 00:10
Indeed
that does fix the issue
should I open an issue on opal-rails?
Loïc Boutet
@loicboutet
Jan 23 2016 00:11
OK
ylluminate
@ylluminate
Jan 23 2016 00:11
my 2¢: I think a 1.0 should be released sooner than later for pulling more confidence and growing the user base.
where are things falling as far as coverage right now? 87%
Loïc Boutet
@loicboutet
Jan 23 2016 00:13
I confirm that 0.8.1 works
Jared White
@jaredcwhite
Jan 23 2016 00:22
Quick aside...I'm literally arranging my programming career on purpose (if at all possible) so I don't ever have to get pulled into working on an Angular project. Every time I've seen Angular 1 code, it's made me feel ill. In recent times, though, I was thinking maybe Angular 2 would be a lot better. Then I saw this: https://medium.com/@MikeRyan52/angular-2-first-app-post-mortem-b2b2b3618828#.m710h172i and...OMG that is ugly!! How can anyone stand to deal with this syntax soup? :question: :question: :question:
Needless to say, I am so glad that Opal is a thing :)
Loïc Boutet
@loicboutet
Jan 23 2016 00:24
Yeah, I can't wait for the time when a ruby front dev will be a thing ;-)
George Plymale II
@ylluminarious
Jan 23 2016 00:26
@ylluminate +1 regarding opal 1.0
Jared White
@jaredcwhite
Jan 23 2016 00:28
+1 on v 1.0 -- it's a marketing thing, anything 0.x sounds experimental, but Opal is totally usable in production apps at this point so the versioning should convey that
Loïc Boutet
@loicboutet
Jan 23 2016 00:49
hmm ... since you guys were so helpful
I'm still trying to follow the reactrb tuto and now I got :
ActionView::Template::Error (Opal is not defined):
    1: <%= react_component @component_name, @render_params, { prerender: !params[:no_prerender] } %>
  app/controllers/home_controller.rb:5:in `show'
any idea?
ylluminate
@ylluminate
Jan 23 2016 00:50
exactly @jaredcwhite
Elia Schito
@elia
Jan 23 2016 00:50
@loicboutet not sure, but somewhere you should require 'opal' in your assets
Loïc Boutet
@loicboutet
Jan 23 2016 00:51
@elia the thing is I am, in the components file
Elia Schito
@elia
Jan 23 2016 00:52
@loicboutet let's cc @catmando and @fkchang, hopefully they know better
Loïc Boutet
@loicboutet
Jan 23 2016 00:52
thx ^^
Elia Schito
@elia
Jan 23 2016 00:55
@jaredcwhite @ylluminate @ylluminarious you've been heared 😉 – I'll check with @meh and @vais what they think about accelerating towards 1.0. Personally I'd also like to stabilize the API a bit more, I mean the CRuby API, but that's something that can be done regardless
George Plymale II
@ylluminarious
Jan 23 2016 00:56
@elia thanks! i think we'd all appreciate 1.0 ;)
Elia Schito
@elia
Jan 23 2016 00:57
(and docs too! …btw for that I could use some help, especially from native speakers 😸)
George Plymale II
@ylluminarious
Jan 23 2016 01:00
yeah, that definitely would be nice. i'll see what i can do with that (when i'm not waist-deep in schoolwork :()
Elia Schito
@elia
Jan 23 2016 01:01
sure thing, it's especially valuable a fresh perspective on "getting started" : )
George Plymale II
@ylluminarious
Jan 23 2016 01:01
lol, yeah
but i've had some time freeing up lately, so hopefully that's something i can do :D
Torstein Saltvedt
@saltvedt
Jan 23 2016 01:03
I've got some notes on that Elia :)
Forrest Chang
@fkchang
Jan 23 2016 01:21
@elia I hear, will address on the react.rb gitter
Elia Schito
@elia
Jan 23 2016 01:21
:+1:
Loïc Boutet
@loicboutet
Jan 23 2016 01:22
@fkchang Actually it was a naming problem on my side
putting the right module fixed the problem
Forrest Chang
@fkchang
Jan 23 2016 01:22
oh, ok, cool, I was just about to dump some info
what exactly was the prob?
Loïc Boutet
@loicboutet
Jan 23 2016 01:23
I forgot the
module Components
and was thinking that class Home::Show would be equivalent to
module Home
  class Show
but s that definitely not the case :D
Vais Salikhov
@vais
Jan 23 2016 04:55
@elia I'm not against :sparkles: 1.0 :sparkles: My concern was disappointing new users if not all language specs are passing. If something's missing from core, it's clear that it could be added, but if a language feature is broken, it could be kind of disheartening. You can only play the 1.0 card once :)
Guillaume Grossetie
@Mogztter
Jan 23 2016 09:55
Hello, I have an issue with the Node.js implementation, corelib methods are not overridden by "nodejs" methods
var Opal = require('opal-npm-wrapper').Opal;
require('./opal-builder.js');
require('./pathname.js');
require('./nodejs.js');

Opal.require('nodejs');
Opal.require('opal-builder');

Opal.get('File').$expand_path("."); // returns "." (corelib/dir $pwd method is used instead of nodejs/dir $pwd method)
Any idea ?
Elia Schito
@elia
Jan 23 2016 15:32
@Mogztter do you get anything in Opal.modules.nodejs after require('./nodejs.js');?
Elia Schito
@elia
Jan 23 2016 16:03

It appears that cdn.opal.org is down again :-)

@bwl21 :D it's cdn.opalrb.org, you were missing the rb, but I must say it took a bit for me to spot the error!

Mitch VanDuyn
@catmando
Jan 23 2016 17:01
@elia (or anybody else :-) having this little problem with @loicboutet new generator...
application.js is doing a //= require 'components' which does not seem to work
but if I change application.js to application.rb and change to ruby syntax everything is fine :-)
its like I can't do a JS require of components (which is a .rb file)
Mitch VanDuyn
@catmando
Jan 23 2016 17:07
Yeah I can't even get it to load a plain old .rb file from the .js directory... I have been using the same old set of apps so long, I can't remember what you need to do to configure rails to convert the .rb files to .js (i guess)
Mitch VanDuyn
@catmando
Jan 23 2016 17:13
okay got it... found the note about having to use application.rb unless you want to manually load stuff. (which I dont)
The only problem is it means converting the existing application.js file to rb syntax right?
which might be a bit harder for the generator...
Elia Schito
@elia
Jan 23 2016 19:06
@catmando that's a problem that I'd like to solve for opal-rails too
Mitch VanDuyn
@catmando
Jan 23 2016 19:07
@elia - so we are just doing an Opal.load('components') and it seems to be working...
but I have another question:
I need to require browser and browser/interval
but only on the client!
Elia Schito
@elia
Jan 23 2016 19:07
(the sprockets directives //= require only make files available to the opal module system)
use the special if RUBY_ENGINE == 'opal'
unless of course your server is nodejs :trollface: :smile_cat:
Mitch VanDuyn
@catmando
Jan 23 2016 19:09
exactly the problem
anyway I figured it out:
if React::IsomorphicBase.on_opal_client?
  require 'browser'
  require 'browser/interval'
end
(because React.rb has those handy methods :-) )
Elia Schito
@elia
Jan 23 2016 19:15
in opal 0.9 there's also opal/platform in stdlib that should correctly detect the JS platform and set OPAL_PLATFORM
if OPAL_PLATFORM == 'nodejs'
Bernhard Weichel
@bwl21
Jan 23 2016 22:03
@elia sorry, it was a typo here at gitter. When i posted it, cdn.opalrb.org did not work. I was in discussion with a client and during the meeting it stopped working. Now it is back. I will give up cdn and put the files on my server.
Elia Schito
@elia
Jan 23 2016 22:08
@bwl21 yeah, for non-toy stuff is always advisable : )