<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
<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()
<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
<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: 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]