These are chat archives for opal/opal

8th
May 2015
Kurtis Rainbolt-Greene
@krainboltgreene
May 08 2015 02:40
@elia Hey, re: our previous discussion about other filesystem operations it seems like Opal's File and Dir classes already assume some level of "during build process"?
Or they talk to a virtual fs, I can't really tell.
Kurtis Rainbolt-Greene
@krainboltgreene
May 08 2015 02:49
Ugh, this is really just becoming an annoying blocker for me. Hmm.
Elia Schito
@elia
May 08 2015 07:52
@krainboltgreene fixed on master, but with {} instead of <>
thanks to @vais of course
Elia Schito
@elia
May 08 2015 08:07
@adambeynon ping, got my message?
Vais Salikhov
@vais
May 08 2015 09:51
@elia @krainboltgreene actually both %{} and %<> format strings are fully supported now. Kernel#format (and the many names it's known by and the many forms in which it manifests itself) is 100% rubyspec-compliant since opal/opal@511565a :beers:
Elia Schito
@elia
May 08 2015 09:52
uh, maybe I did something wrong when I tried it
@vais I get ArgumentError: malformed format string - % when executing the code from @krainboltgreene's link
hash = { foo: 1 }
string = "Value: %<foo>"

puts(string % hash)
Vais Salikhov
@vais
May 08 2015 10:00
@elia I see - this must be a case not covered by rubyspec then. This is actually a pretty little-known feature of ruby for some reason. The difference between %{} and %<> is that the first one is not followed by a field specifier, but the second one must be, otherwise it does not work. So, in MRI it fails silently, but in Opal it blows up, as it should :) Check this out:
$ ruby -v -e "p('Value: %<foo>' % { foo: 1 })"
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
"Value: %"

$ ruby -v -e "p('Value: %<foo>s' % { foo: 1 })"
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
"Value: 1"

$ bundle exec opal -v -e "p('Value: %<foo>s' % { foo: 1 })"
Opal v0.8.0.dev
"Value: 1"
MRI's behavior above should be considered a bug, since it silently drops the value on the floor instead of complaining about an invalid format string. This is how we roll:
$ bundle exec opal -v -e "p('Value: %<foo>' % { foo: 1 })"
Opal v0.8.0.dev

/private/var/folders/pt/kr0lwm4d20jgc_jvpc5fyk1r0000gn/T/opal-nodejs-runner-20150508-18639-1wd0fyb:3603
      throw exception;
            ^
ArgumentError: malformed format string - %
Elia Schito
@elia
May 08 2015 10:18
go @vais! in which Opal uncovered an MRI bug :P
Vais Salikhov
@vais
May 08 2015 10:29

@elia LOL. I just checked on 2.0.0 cause I though this may be a regression in 2.2.0, but no, it's the same. Go figure. Well, @brixen did complain about MRI devs not using rubyspec :trollface: Except that there is no test covering this particular case in rubyspec either double-:trollface:

ri Kernel#sprintf just has this to say at the very bottom:

For more complex formatting, Ruby supports a reference by name. %<name>s style
uses format style, but %{name} style doesn't.

Examples:
  sprintf("%<foo>d : %<bar>f", { :foo => 1, :bar => 2 })
    #=> 1 : 2.000000
  sprintf("%{foo}f", { :foo => 1 })
    # => "1f"
Elia Schito
@elia
May 08 2015 10:31
@vais should be noted that now they're actually using it https://github.com/ruby/rubyspec
Vais Salikhov
@vais
May 08 2015 10:31
It's officially my favorite feature of Ruby :stuck_out_tongue_closed_eyes:
:stuck_out_tongue_winking_eye:
Elia Schito
@elia
May 08 2015 10:32
:smile_cat:
Vais Salikhov
@vais
May 08 2015 10:36
@elia my git-fu is still not strong enough to sync our outdated rubyspec fork with theirs :sweat_smile:
Elia Schito
@elia
May 08 2015 10:37
I still dream up on doing it myself, but I lack time-fu :clock230:
last time I think mike did the hard work
opal/opal#528
Vais Salikhov
@vais
May 08 2015 10:54
@elia the way I think about it is we still have plenty of failing cases to work on as it is, so no rush :)
AstonJ
@AstonJ
May 08 2015 11:25
Nice one @elia :+1:
Elia Schito
@elia
May 08 2015 11:26
:smile:
Vais Salikhov
@vais
May 08 2015 11:28
Where in the world is @mieko? I was just reading his "Opal" blog post from a year ago. Posting it to reddit/r/ruby now, it really resonated with me. Hope he's doing well.
AstonJ
@AstonJ
May 08 2015 11:36
That’s a nice post @vais @mieko (looks like he hastn’t blogged for over a year?). Btw I think it would be a good idea to put every blog post about Opal on the Opal site somewhere (I proposed the same thing about Volt).
Elia Schito
@elia
May 08 2015 11:38
@AstonJ you think you can do a PR on https://github.com/opal/opalrb.org adding a resources page with those links?
AstonJ
@AstonJ
May 08 2015 11:41
Sure - can you think of any other links you feel should be added? (I’ll Google later too) @elia
Elia Schito
@elia
May 08 2015 11:41
the opalrb twitter account should have a good collection of them
AstonJ
@AstonJ
May 08 2015 11:55
Awesome thanks :)
Vais Salikhov
@vais
May 08 2015 12:31
@AstonJ make sure you include this one - it got me interested in Opal ;) http://confreaks.tv/videos/rubyconf2013-opal-a-new-hope-for-ruby-programmers
Elia Schito
@elia
May 08 2015 12:38
once again kudos to @fkchang :clap:
AstonJ
@AstonJ
May 08 2015 12:44
@vais Is that the one where I’m on stage with DHH? ;-) Hehe :sparkles:
Vais Salikhov
@vais
May 08 2015 12:54
:)
Rick Carlino
@RickCarlino
May 08 2015 14:30
Holy crap! /r/ruby has so many Opal related posts right now!
Vais Salikhov
@vais
May 08 2015 14:54

@RickCarlino from http://opalrb.org/docs/faq

Why does Opal exist?

To try and keep ruby relevant in a world where client-side apps are making javascript the primary development platform.

I think Opal deserves more attention on /r/ruby. Right now the burden is on us to give the community something worth talking about.
BTW @elia @adambeynon the "try and keep ruby relevant" always rubbed me the wrong way. Does anyone else feel that way?

Rick Carlino
@RickCarlino
May 08 2015 14:55
@vais Just so I make myself apparent- I think the high volume of Opal posts on /r/ruby is a good thing.
Vais Salikhov
@vais
May 08 2015 14:55
@RickCarlino no, I understood you correctly :) Just offering an explanation as to why.
Rick Carlino
@RickCarlino
May 08 2015 14:56
But yeah "try and keep Ruby relevant" might indicate that its losing relevance to some people
Maybe "spread the power of Ruby to new platforms"
AstonJ
@AstonJ
May 08 2015 14:57
Is r/ruby, reddit? I have never seen the appeal tbh - it just looks like a stripped down forum but where it’s really difficult to keep track of the conversation.
Agree with Rick - I think the Opal FAQ can be reworded at some point :)
Rick Carlino
@RickCarlino
May 08 2015 14:59
You might want to give it a second look. They have some great conversations on there, plus Reddit drives thousands of readers per week to my blog. It's a great place to share stuff that's useful to other developers. The key is to subscribe to good subreddits.
The upvotes / downvotes stop people from being spammy, too.
Vais Salikhov
@vais
May 08 2015 14:59
@AstonJ what @RickCarlino said :+1:
Rick Carlino
@RickCarlino
May 08 2015 15:01
Also, "Reddit Enhancement Suite" is a pretty good user script if you're having trouble keeping track of stuff. Adds a ton of features as a browser plugin.
AstonJ
@AstonJ
May 08 2015 15:04
I think I posted about my Rails book idea on there a while back (or was it HN lol) - the responses were alright actually. It’s just that some of the threads I’ve seen on there seem indicate it is a ‘free for all’, which I find tedious. I will check out the Ruby bits tho.
This message was deleted
Rick Carlino
@RickCarlino
May 08 2015 15:06
studio audience says "Awwww..."
AstonJ
@AstonJ
May 08 2015 15:07
The one @dfyx posted has had the most comments (Red Hot Ruby article) :)
So this is the one to follow right? https://www.reddit.com/r/ruby/
I am sure I had the ‘AstonJ’ user, but on trying to reset password it says no email with that username
meh.
@meh
May 08 2015 15:11
vais, yeah, I agree, but I also never read the FAQ :P
AstonJ
@AstonJ
May 08 2015 15:24

Something like this? @vais @RickCarlino @elia @meh @adambeynon

Why does Opal exist?

Opal exists because the power of Ruby in the browser is, and always has been, extremely appealing.

Thanks to this power, Opal is now paving the way to allow developers to do what they could previously only dream off - isomorphic Ruby.

(Just initital thoughts - feel free to edit/modify)
AstonJ
@AstonJ
May 08 2015 15:33

Version 2:

Why does Opal exist?

Opal exists because the prospect of the power of Ruby in the browser was too good to ignore.

Thanks to this power, Opal is now paving the way to allow developers to do what they could previously only dream off - client side apps in Ruby as well as full stack isomorphic Ruby.

Michał Kalbarczyk
@fazibear
May 08 2015 16:18
Hi, I’m messing around with new opal beta and source maps, and it looks like everything point to last line of ruby source ? Any clues why this thing happened ? Using sprockets 3.0 ?
Michał Kalbarczyk
@fazibear
May 08 2015 16:27
Screen Shot 2015-05-08 at 18.27.04.png
Forrest Chang
@fkchang
May 08 2015 16:41
@vais @RickCarlino @elia @meh @adambeynon @AstonJ On the note of spreading opal/explaining why rubyists should adopt Opal, I'm stumped. I thought my Rubyconf 13 video that brought @vais into the fold would've done it, I think I covered enough bases that a Rubyist would think it's a no brainer. Perhaps I showed too much info? Maybe I wasn't specific enough. I propose a bunch of Opal talks for conferences every year trying spread the message from various angles, to date only the Star Wars one was accepted. My Jubilee talk for Rubyconf 14 slips in Opal in the side door and I show that code, but that one also surprises me in how little attention Rubyists are paying to the "Ruby everywhere" thing that Jubilee and Opal give you.
Some of it think needs concrete, pertinent examples. This Ruby-fying javascript series I'm blogging about is attempting to do that w/real world code. I've been assembling a pattern language around it that blogging is helping me solidify. I'm hoping give names to concrete things that explain why coding browser code in Opal really is much better can help.
Forrest Chang
@fkchang
May 08 2015 16:47
@all any help on having me flesh these out would be appreciated. If ppl can read, comment, discuss those things, that might help. I see how pattern languages yielded Design Patterns and all the descendant * Patterns exploded by cataloging and naming things - I hope to enumerate the reasons starting w/my Ruby-fying JS. I'm trying to think about how to reword the messages, which I think are pretty darn solid for the Rubyist, in my various talk proposals. These days, they distill to why Ruby is better in the browser, and how Ruby everywhere is both viable and joyful.
AstonJ
@AstonJ
May 08 2015 16:47

You’re doing a great job @fkchang :+1:

I think what Opal could really do with is some screencasts (or blogs) from the very basics up (bit like I am aiming to do with Volt :point_up: May 8 2015 6:31 AM). I am crap at JS so suggest someone with a better knowledge has a go instead of me.

Ideally (at least in my mind) a series on Opal would show youhow to do stuff that you would usually use JS for without even mentioning JS. Almost like JS has been rendered superfluous.

Forrest Chang
@fkchang
May 08 2015 16:48
When I get around to building opal-inspector and the ilk, the message will be how opal will have better tooling/environment -- I've had that talk brewing for a while, I have the movie theme, quotes, multimedia all lined up for that. I do need the feature thats somewhere deep down in @adambeynon 's todo list to be able to retrieve the code and comments to duplicate some of the small talk env stuff. Maybe @vais knows enough about the innards of Opal now that he could hit it
@AstonJ if you need my opal blogs http://funkworks.blogspot.com/search/label/opal - I had been meaning to collect all the various blogs at one point myself
Rick Carlino
@RickCarlino
May 08 2015 16:52
@fkchang I think it just takes time. My thought is that once Volt hits 1.0 and has proven itself in production it will be Opal's killer app.
I heard about Opal for the first time maybe 18 months ago? When I heard about it I thought "Oh, cool. I'm going to star this and hope to god it grows an ecosystem"
Im sure others who hear about Opal thinking the same thing- they're optimistic, but they need reassurance.
Forrest Chang
@fkchang
May 08 2015 16:55
@RickCarlino I think volt is definitely cool, but I feel Rails integration needs more pumping. When you can use Rails for all the good and many things it does well, and then Opal for the front end, that's huge for pretty much anyone who does rails. I tried to explain that in my Jubilee talk w/my demo app, where I summarized it as "Use rails to get me to the game, Jubilee/opal to play the game". Twitter signup oauth, like 3 lines in Rails, -- BAM, real time sync w/servers and players, a handful of Jubilee/opal code bam!
AstonJ
@AstonJ
May 08 2015 16:55

Sounds good Forrest. I do think we need to cover the basics first because that way we make it super easy for anyone to jump in - even benefits in the way of just helping with the mental shift.

Agree with Rick too. Volt is going to be Opal’s first killer app, which in turn is going to get Opal a lot more interest. I sometimes think that Opal is actually going to be more of the heart/engine, of frameworks like Volt, Clearspring, Vienna, Fire etc. In some ways that is better for the Opal team as it’s less people asking support questions.

Forrest Chang
@fkchang
May 08 2015 16:55
Being able to leverage your old code and the entire Rails ecosystem isn't to be laughed at
AstonJ
@AstonJ
May 08 2015 16:56
Also agree with you about Rails integration Forrest.
Forrest Chang
@fkchang
May 08 2015 16:56
We deployed our 1st production rails app w/opal last night. Opal was a huge part of the success
AstonJ
@AstonJ
May 08 2015 16:56
(I’m off shopping now but will catch up later)
Rick Carlino
@RickCarlino
May 08 2015 16:56
That's true- maybe I'll write an article titled "How to get Opal in your existing Rails app today"
We can see how people take to it.
Forrest Chang
@fkchang
May 08 2015 16:56
I think Rails ppl need to see and hear this. The problem is none of the production rails app are open source
Rick Carlino
@RickCarlino
May 08 2015 16:57
I work on two production Rails apps that are opensource. I can try to wedge it in where possible
although, both use angular :(
Forrest Chang
@fkchang
May 08 2015 16:58
I'll get down to blogging about various techniques I've come up with that I think are pretty nice. It'd be nice if we could get a little blog circle on that. @adambeynon and @elia would have probably the most data on that
Rick Carlino
@RickCarlino
May 08 2015 16:59
Doesn't "The Opalist" cover this sort of stuff currently? Who runs that?
Forrest Chang
@fkchang
May 08 2015 16:59
I'd be curious what @jaredcwhite is working on. Kudos again on the opalist. I think that will help w/the cause. It has me committing to providing content for each issue which I think is a good thing. Sometimes we just need deadlines to get stuff to the top fo the q
On another thing, a message I know most ppl don't grok is that I think "Ruby web components" has the potential to be significant -- matching w/all the other web components (official and implemented by various frameworks) buzz that I also realize most ppl don't grok. It's why I really like @meh 's lissio
React has been strong in pushing the reasons why lissio is really significant, but lissio's implementation is better, IMO, it's all objects, all Ruby, cohesively together
at the point, coding is just Ruby
and that is significant
Jared White
@jaredcwhite
May 08 2015 17:07
@RickCarlino @fkchang Opalist is a bi-weekly email newsletter. I also have a matching blog, which I'm obviously happy to open up to anyone who would like to publish on that, although I suspect most people writing a blog post will want to post on their own blog. (Which is fine, I can link to that from the newsletter!) So...I'm checking Reddit, Ruby news sites, etc. like anybody, but if you specifically want to make sure your content ends up in Opalist just send it my way. hello@whitefusion.io
Rick Carlino
@RickCarlino
May 08 2015 17:20
Good stuff. Would probably be good if it had a "Submit an article" form or something. I'll have some content here shortly.
Elia Schito
@elia
May 08 2015 18:53

I think it just takes time.

I agree, if anyone remember how Ruby & Rails were considered in the early years…

We deployed our 1st production rails app w/opal last night.

@fkchang that would be cool to list on the site, that too in the early years helped rails

@fkchang also I think that would be cool if you were blogging from the opalrb.org blog, at least for general stuff
Elia Schito
@elia
May 08 2015 19:13
@jaredcwhite how many days left before the next opalist issue?
Rick Carlino
@RickCarlino
May 08 2015 19:13
Great question.
RickCarlino @RickCarlino wants to know how long he can procrastinate
Elia Schito
@elia
May 08 2015 19:14
haha, meee too
was thinking it would be nice to have the 0.8 post out for that date
Rick Carlino
@RickCarlino
May 08 2015 19:28
Oh lol @edubkendo is in here. Long time no see, sir.
We met many moons ago in the TowerJS days
Jared White
@jaredcwhite
May 08 2015 19:34
@RickCarlino Great point, I will work on that. @elia Next issue's going out Wednesday next week (May 13). I will try to get you a PR for a link as well. :shipit:
Elia Schito
@elia
May 08 2015 19:38
ok, then I don't think I'll be able to write something :(
great to hear about that PR
If you guys have any production app with opal installer would be also great to have a "trysted by" section in the homepage
AstonJ
@AstonJ
May 08 2015 20:10

@jaredcwhite Do you think you could update the Opal site with a list of all Opal related articles to date too? :point_up: May 8 2015 12:38 PM Seems more sense for you to do it if you are already scouring the web for Opal-related stuff :)

If you can’t no worries, but could you email us a list of Opal-related articles you know of to date please? One of us can add them to the site then.

Elia Schito
@elia
May 08 2015 20:12
@AstonJ @jaredcwhite opening now an issue on opalrb.org to gather the list so you too can accumulate stuff there and get an agreement on where it's better to put them in the site :smiley:
AstonJ
@AstonJ
May 08 2015 20:13
Awesome, thanks @elia :)
Elia Schito
@elia
May 08 2015 20:14
opal/opalrb.org#19
Mitch VanDuyn
@catmando
May 08 2015 21:10
anybody have strategies for configuring opal between development/test/production.
For example i have a string value that I need to have a different value depending on whether we are in test/development or production.
Rick Carlino
@RickCarlino
May 08 2015 21:12
Is ERB an option?
Oh wait, I'm not sure that would work. It might in the asset pipeline, though. Have you tried adding a .erb to the end and putting in some ERB with an ENV[] var?
Adam Beynon
@adambeynon
May 08 2015 21:13
yep, I use the erb solution (with asset pipeline)
Rick Carlino
@RickCarlino
May 08 2015 21:14
Ah, but you don't like it I take it?
Probably makes it hard for your syntax highlight to do its job
Elia Schito
@elia
May 08 2015 21:14
I tend to prefer data attributes, in some cases I used meta tags and loaded into ENV (inside opal)
Adam Beynon
@adambeynon
May 08 2015 21:15
umm, its not ideal. I keep meaning to move to something similar to elia ^^
Mitch VanDuyn
@catmando
May 08 2015 21:30
soo not be a dummy but... I stuck a little file (config.js.rb.erb) into the assets folder.
I can require it fine in the opal code, but the erb is not getting expanded
do I have to do something to enable this in the asset pipeline?
Elia Schito
@elia
May 08 2015 21:31
v0.7?
Mitch VanDuyn
@catmando
May 08 2015 21:32
yeah more or less (its my patched version mostly 0.7)
Elia Schito
@elia
May 08 2015 21:32
then you either use master or you use the .erb as main file
in 0.7 only the main file gets full sprockets treatment
0.8 restores full sprockets processing while keeping support for require order
Mitch VanDuyn
@catmando
May 08 2015 21:37
the main file being like application.js.rb ?
Elia Schito
@elia
May 08 2015 21:37
yep, would be application.js.rb.erb
that should work
Mitch VanDuyn
@catmando
May 08 2015 21:43
nope :-(
but ...
Elia Schito
@elia
May 08 2015 21:44
that is the file you use for javascript_include_tag?
assuming rails
Mitch VanDuyn
@catmando
May 08 2015 21:44
what exactly do we mean by top level file...
what if you have multiple?
Elia Schito
@elia
May 08 2015 21:45
example?
Mitch VanDuyn
@catmando
May 08 2015 21:45
we have a ton of javascript_include_tags
Elia Schito
@elia
May 08 2015 21:45
shouldn't be a problem
Mitch VanDuyn
@catmando
May 08 2015 21:45
our asset pipeline structure is a mess
so as long as its being pulled in via the top level javascript_include_tag it should work
Elia Schito
@elia
May 08 2015 21:46
does it work you use erb on a plain js file?
yep
Mitch VanDuyn
@catmando
May 08 2015 21:50
so as long as I directly include config.js.rb.erb all should be well correct?
Elia Schito
@elia
May 08 2015 21:50
it should
Mitch VanDuyn
@catmando
May 08 2015 21:51
trying now...
Elia Schito
@elia
May 08 2015 21:51
:+1:
Brian Glusman
@bglusman
May 08 2015 21:57
Just pushed up a tetris that runs in opal and on shoes locally FYI :-) bglusman/tetris
Mitch VanDuyn
@catmando
May 08 2015 21:58
@elia, yeah that works fine... bottom line (for me any way - add a config.js.rb.erb file and then include it the top level header. That works for dev and production. For running rspec in the browser I will just add the config to the spec helper.
I'm thinking a little gem would be nice, or perhaps just add something to opal-rails
Elia Schito
@elia
May 08 2015 21:59
@bglusman awe
@bglusman just add a screenshot to the readme plz!
@catmando 0.8 should fix thise kind of issues
Mitch VanDuyn
@catmando
May 08 2015 22:01
@elia, not so much from an issue standpoint, but just would be nice to have a standard solution
Elia Schito
@elia
May 08 2015 22:03
sorry, I though the gem would have been to solve the require problem, plz be patient :smile_cat:
Mitch VanDuyn
@catmando
May 08 2015 22:05
no drama here at all, thanks for all the great work.. opal has been a life saver for us!
Brian Glusman
@bglusman
May 08 2015 22:13
@elia it's easy far from done, literally just pushed up the first version with Abby kind of proof it's at all functional :-)
Elia Schito
@elia
May 08 2015 22:14
@bglusman k, will wait, but think of the children! :D
Vais Salikhov
@vais
May 08 2015 22:45

@fkchang thanks for all the great work you've been doing to spread awareness of Opal. Just want you to know that it's made a huge difference. It will take time, but we're getting there.

I do need the feature thats somewhere deep down in @adambeynon 's todo list to be able to retrieve the code and comments to duplicate some of the small talk env stuff. Maybe @vais knows enough about the innards of Opal now that he could hit it

I wish I did :) Is there an issue for this on GH? This would be the first step. I will be offline for a couple days, but will check back ;)