adambeynon changed the topic of #opal to: http://opalrb.org - Ruby runtime and library on top of Javascript | 1.0.0 is near | This channel is logged at http://irclog.whitequark.org/opal
<ylluminate> so adambeynon, after putting in https://gist.github.com/5c78c849d295c0e26f82 for the Gemfile
<ylluminate> we're seeing a "connection closed" on the js console
<ylluminate> no other discernible errors
<ylluminate> console output for browser (safari): https://gist.github.com/9800172045bf66665be6
<ryanstout> quick question. would it make since and or be possible to copy the ruby comments to JS comments? I know other parsers add a sexp for comments. I'm thinking the main use case would be to help debugging during development.
<meh`> ryanstout, possible, sure, but I don't see much use for it
<ylluminate> hey that is a good idea for an option. i don't think it would be good for production, but yeah
<meh`> ylluminate, there are already source maps for debugging tho
<ylluminate> could be useful to track locations
<ylluminate> hmm, okay, have not looked into those yet
<ryanstout> right. sorry, I forget about source maps. I've had trouble getting those working.
<ryanstout> I'll spend more time and just try to get that working
<ylluminate> so how do you work with those?
<meh`> ylluminate, you need a browser that supports them
<ylluminate> so it's automatic
ryanstout has quit [Quit: ryanstout]
elia has quit [Quit: Computer has gone to sleep.]
ryanstout has joined #opal
fkchang`` has quit [Ping timeout: 272 seconds]
marcandre has quit [Remote host closed the connection]
ryanstout has quit [Quit: ryanstout]
elia has joined #opal
<adambeynon> ylluminate: regarding source maps, master branch has a much better implementation
<adambeynon> Unreleased yet though
elia has quit [Quit: (IRC Client: textualapp.com)]
elia has joined #opal
kludge` has quit [Ping timeout: 250 seconds]
kludge` has joined #opal
GitHub174 has joined #opal
<GitHub174> [opal] adambeynon pushed 1 new commit to master: http://git.io/Pyc2Sw
GitHub174 has left #opal [#opal]
<GitHub174> opal/master 71bc4a6 Adam Beynon: Fix lexing bug to allow `!` as def name
travis-ci has joined #opal
<travis-ci> [travis-ci] opal/opal#1570 (master - 71bc4a6 : Adam Beynon): The build passed.
<travis-ci> [travis-ci] Build details : http://travis-ci.org/opal/opal/builds/15033159
travis-ci has left #opal [#opal]
GitHub96 has joined #opal
<GitHub96> [opal] adambeynon pushed 1 new commit to master: http://git.io/bgLXKg
<GitHub96> opal/master 71c0f56 Adam Beynon: Treat !/not expressions as a method call on receiver
GitHub96 has left #opal [#opal]
travis-ci has joined #opal
travis-ci has left #opal [#opal]
<travis-ci> [travis-ci] opal/opal#1571 (master - 71c0f56 : Adam Beynon): The build passed.
<travis-ci> [travis-ci] Build details : http://travis-ci.org/opal/opal/builds/15033888
meh` has quit [Ping timeout: 240 seconds]
DouweM has quit [Ping timeout: 264 seconds]
elia has quit [Quit: Computer has gone to sleep.]
marcandre has joined #opal
fkchang has joined #opal
<fkchang> adambeynon: are source maps served through opal-server via opal-sprockets? I'm thinking the right way to serve up opal files via sinatra and opal-sprockets is to make a gem like https://github.com/kalasjocke/sinatra-asset-pipeline which calls sprockets class via a assets path added to the sinatra app, rather than the Rack::Cascade thing that the opal-browser server does. I was hoping to basically take the sinatra gem and just change
<fkchang> it to use opal-sprockets
elia has joined #opal
<adambeynon> fkchang: I dont know about opal-browser, I havent written any of that
<adambeynon> but yes, opal::server handles the sourcemaps
<fkchang> adambeynon: long story short, opal-browser's server uses Rack::Cascade to put opal-server and sinatra in a cascade of of servers to handle requests. First one that doesn't return 404 is the one used. The sinatra gem creates an assets path on the sinatra server that calls the sprockets class
<fkchang> I figure that's the better way to do it
<fkchang> I suppose the gem could add an assets path, call opal-sprockets, and a source maps path and call whatever object does that work
<adambeynon> fkchang: I imagine the setup would be close to how opal-rails handles things
<adambeynon> opal-rails doesnt use opal-server
<adambeynon> because rails already has its own sprockets instance running
<adambeynon> so opal-rails just adds all the opal load paths into that existing instance
<adambeynon> integrating with sinatra might be easiest by doing the same thing
<adambeynon> (does sinatra use sprockets by default? maybe it doesnt..)
<fkchang> opal-sprockets just adds opal load paths to sprockets? There has to be a compile step too, I imagine
<fkchang> opal-server and opal-rails both must use the same source maps object?
<fkchang> adambeynon: how do you add to load path for opal-rspec, I can't seem to do $: << "../app"
<adambeynon> opal-rails loads this rack middleware to handle the sourcemaps
<adambeynon> fkchang: Opal.append_path('../app')
<adambeynon> the opal load path is different from the ruby load path
<fkchang> so in my spec file require '../app/opal_class_to_be_tested' finds the class, but Opal.append_path "../app"; require 'opal_class_to_be_tested' doesn't
<fkchang>
<fkchang>
<fkchang> NoMethodError: undefined method `append_path' for Opal
<adambeynon> Opal.append_path() must be done in ruby itself, i.e. in the ruby code running inside cruby/rubinius/etc
<adambeynon> that tells sprockets to add the path
<adambeynon> we cant modify the path at runtime
<fkchang> so this is for my opal-rspec template, I want to do the equivalent of $: << "where the opal code is" in the spec_helper so I can just require those at the top, what's the way to to this. For my opal-sprockets compile rake tasks, I have added the path to the environment so that's fine, is there an option on the opal-rspec rake task to do the same
GitHub48 has joined #opal
<GitHub48> opal/master 1afbc44 Adam Beynon: Fix bug in truthy/falsy tests for booleans as objects
GitHub48 has left #opal [#opal]
<GitHub48> [opal] adambeynon pushed 1 new commit to master: http://git.io/DI4KcA
<adambeynon> fkchang: yes, the rake task you can do the same.
<adambeynon> fkchang: generally, I try to use Opal.append_path() when possible
<adambeynon> e.g. every opal gem adds itself to Opal.append_path()
<fkchang> what's the rake task option name?
<adambeynon> fkchang: exactly the same: `append_path()`
<adambeynon> the object yielded by the rake task is just an instance of Opal::Server
<adambeynon> so you can use it exactly the same as in the config.ru file
<fkchang> adambeynon: thanks. I'll have repo up shortly with a static html/compiled js that tests both opal and js from opal-rspec. A validity check would be appreciated
DouweM has joined #opal
<fkchang> adambeynon: I'm commenting it heavily so it can be a source of documentation
<adambeynon> fkchang: of course, let me know when its ready
<adambeynon> fkchang: yeah, that sounds good
travis-ci has joined #opal
<travis-ci> [travis-ci] Build details : http://travis-ci.org/opal/opal/builds/15042599
<travis-ci> [travis-ci] opal/opal#1572 (master - 1afbc44 : Adam Beynon): The build passed.
travis-ci has left #opal [#opal]
<fkchang> adambeynon: https://github.com/fkchang/testing_js_with_opal - I will document all the templates in opal-starter-kit similarly
<fkchang> adambeynon: improved the doc a bit
DouweM has quit [Quit: Leaving...]
grios has joined #opal
<grios> hello, i'm trying to use opal-browser to work with canvas, is this working? I'm always getting an "Uncaught NoMethodError: undefined method `Element' for #<Browser::Canvas:197> "
DouweM has joined #opal
GitHub108 has joined #opal
<GitHub108> [opal] adambeynon pushed 1 new commit to master: http://git.io/lK-R2g
GitHub108 has left #opal [#opal]
<GitHub108> opal/master f983a92 Adam Beynon: Fix bug where wrong regexps flags were generated (fixes #426)
<adambeynon> grios: I havent used opal-browser, but I can try to help
DouweM has quit [Quit: Leaving...]
<adambeynon> grios: is `Element` a method you are calling yourself?
<grios> ok, so this erro happen when I try to instantiate a new canvas, Browser::Canvas.new("myCanvas")
<grios> adambeynon: this is probably related with this line https://github.com/opal/opal-browser/blob/master/opal/browser/canvas.rb#L22
<adambeynon> I think that is an old method. meh` has written opal-browser, so it would be best to wait until he is back
<adambeynon> I havent used it
<adambeynon> hes usually here most of the time..
<grios> adambeynon: thank you. i'll digging here to see if I can find anything
<fkchang> bummer, the starwars music on my presentation caused youtube to mute the entire video..
<adambeynon> fkchang: the confreaks video?
fkchang` has joined #opal
<elia> fkchang, copyright infringement? :'(
fkchang has quit [Ping timeout: 246 seconds]
DouweM has joined #opal
travis-ci has joined #opal
<travis-ci> [travis-ci] Build details : http://travis-ci.org/opal/opal/builds/15046810
<travis-ci> [travis-ci] opal/opal#1573 (master - f983a92 : Adam Beynon): The build passed.
travis-ci has left #opal [#opal]
brixen has quit [Ping timeout: 264 seconds]
<grios> adambeynon: so just a more conceptual question. I'm evaluating opal for a map like system, which is very heavy in picture. So i was thinking about using canvas for this, and then I thought about using opal-browser as it seems to be the only way to access canvas with opal, am i right? or there's another way to do this?
brixen has joined #opal
<adambeynon> grios: yes. you could always write a simple wrapper if you wanted to use it with jquery or another dom lib though
<adambeynon> but, opal-browser has a pretty comprehensive wrapper which seems a lot nicer to use
yllox has joined #opal
gplymale has joined #opal
gplymale has quit [Client Quit]
<grios> adambeynon: thats what i thought, and its already there instead of having to build a new one :P
yllox has quit [Ping timeout: 260 seconds]
ylluminate has quit [Ping timeout: 272 seconds]
grios has quit [Ping timeout: 265 seconds]
ylluminate has joined #opal
grios has joined #opal
elia has quit [Quit: Computer has gone to sleep.]
DouweM has quit [Quit: Leaving...]
lectrick has quit [Read error: Connection reset by peer]
fkchang`` has joined #opal
fkchang` has quit [Ping timeout: 250 seconds]
lectrick_ has joined #opal
GitHub88 has joined #opal
<GitHub88> [opal] adambeynon pushed 1 new commit to master: https://github.com/opal/opal/commit/eb13fcb06040a277ba39d8ef400b6fac789c9c1a
<GitHub88> opal/master eb13fcb Adam Beynon: Support single character strings using escaped characters
GitHub88 has left #opal [#opal]
GitHub5 has joined #opal
<GitHub5> [opal] adambeynon pushed 1 new commit to master: https://github.com/opal/opal/commit/6ab1d9ac8166e2a3ff6f876a0fbe78d05b9cf827
GitHub5 has left #opal [#opal]
<GitHub5> opal/master 6ab1d9a Adam Beynon: Add spec for previous character string fix
travis-ci has joined #opal
<travis-ci> [travis-ci] opal/opal#1574 (master - eb13fcb : Adam Beynon): The build passed.
travis-ci has left #opal [#opal]
<travis-ci> [travis-ci] Build details : http://travis-ci.org/opal/opal/builds/15052238
travis-ci has joined #opal
<travis-ci> [travis-ci] opal/opal#1575 (master - 6ab1d9a : Adam Beynon): The build passed.
<travis-ci> [travis-ci] Build details : http://travis-ci.org/opal/opal/builds/15052345
travis-ci has left #opal [#opal]
DouweM has joined #opal
DouweM has quit [Quit: Leaving...]
meh` has joined #opal
marcandre has quit [Remote host closed the connection]
marcandre has joined #opal
elia has joined #opal
fkchang`` has quit [Ping timeout: 240 seconds]
elia has quit [Read error: Connection reset by peer]
<meh`> ylluminate, ping
elia has joined #opal
<meh`> adambeynon, ping
<adambeynon> Hi meh`
<meh`> adambeynon, I'm having a problem getting the canvas stuff to work
<meh`> it's related to constants
grios has left #opal [#opal]
<adambeynon> The constants resolution is still a bit off
<meh`> no wait, it works in the repl
<meh`> mmh
<meh`> I'm confused now
<adambeynon> Lol
<meh`> ok, found it
<adambeynon> Caching issue perhaps?
<adambeynon> Oh
<meh`> no no
<meh`> found it
<meh`> >> Class.new { class Foo; end; class Bar < Foo; end }::Foo
<meh`> => Foo
<meh`> (ripl):3: warning: toplevel constant Foo referenced by #<Class:0x0000000177c058>::Foo
gabriel has joined #opal
<meh`> >> Class.new { class Foo; end; class Bar < Foo; end }::Foo
<meh`> uninitialized constant Object::Foo
gabriel has left #opal [#opal]
<meh`> the constant inside the block doesn't work
grios has joined #opal
<adambeynon> I think constant definitions inside blocks and def methods are wrong
<adambeynon> They write to the outer scope
<adambeynon> I.e. The nearest class or top level
<meh`> it's a blocker for opal-browser#5
<adambeynon> Can't you use a full constant path, until it's fixed.
<adambeynon> .
<adambeynon> ?
<adambeynon> Typing punctuations on an iPhone is tricky...
<meh`> adambeynon, what would be the full path in the block?
<meh`> the block is defined inside Browser::Canvas
<ylluminate> hey meh`, thanks for looking into this. grios is the one who was hitting the issue earlier
<meh`> ylluminate, yeah, it was old code imported from about 2 years ago and since I never used it I forgot to fix it
<ylluminate> gotcha. yeah we're wanting to go hog wild with canvas it appears
<meh`> ylluminate, if you use it, I'll maintain it, it's just it's something very hard to write tests for
<ylluminate> we're dealing with large a mapping scenario where there are a tremendous amount of large and small images involved
<meh`> adambeynon, yeah, ain't working even full pathed
<meh`> adambeynon, I'll open an issue about it
<adambeynon> Ok
<meh`> but yeah, how I'm doing it now is rather smelly in the first place
<meh`> ylluminate, do you think it makes sense to make canvas 2d only?
<meh`> the current bug comes from separation of the various context types, but only 2d is supported there
<meh`> and I think it'd make more sense to have a different library for webgl stuff in the first place
<meh`> grios, you too since you were the one hitting the bug
<ylluminate> i think you're right meh`
<ylluminate> it would make sense to have an additional webgl for the 3d stuff
<grios> if only 2d is supported, I don't see a problem
<ylluminate> grios and i are talking about it a little here and it makes sense to have them as two different libs
<meh`> ok, making the changes then, it should be usable in a bit
<ylluminate> appreciate it!
fkchang has joined #opal
meh`_ has joined #opal
meh` has quit [Ping timeout: 246 seconds]
grios has quit [Ping timeout: 246 seconds]
marcandre has quit [Remote host closed the connection]
marcandre has joined #opal
grios has joined #opal
<elia> adambeynon, what irc client are u using on the iphone?
<elia> adambeynon, btw you can't define constants from inside methods (just checked)
<elia> cc meh`_
fkchang has quit [Ping timeout: 246 seconds]
<meh`_> elia, you're right
elia has quit [Quit: Computer has gone to sleep.]
<meh`_> grios, ylluminate, got it working
<ylluminate> excellent, thanks so much meh`_
<ylluminate> i assume you've yet to push it to the repo
<meh`_> yeah, pushed now
<ylluminate> cool
<meh`_> http://sprunge.us/TCJB?rb stupid example