Hi Group, I’m trying to see how Rails at ``startup time’’ creates Javascripts within the Clientside of the browser.
rails s #starting my program
I’ve used both Byebug within Ruby code and Firefoxe’s debugger within the browser. ==> Firefox’s debug shows me the generated scripts like jquery etc but this is after the fact: the code producing the scripts has already executed. I want to observe how/when it generates the script and how various callbacks are registered particularly in jquery. Eg plot function using flot.
==> Byebug stops when the Ruby code does an eval expression when tracing from config/application.rb : I used byebug’s set linetrace to observe the following: Tracing: /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:33 options = {} Tracing: /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:34 if config =~ /.ru$/ Tracing: /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:35 cfgfile = ::File.read(config) Tracing: /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:36 if cfgfile[/^#\(.)/] && opts Tracing: /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:39 cfgfile.sub!(/^END\n.\Z/m, ‘’) Tracing: /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:40 app = new_from_string cfgfile, config Tracing: /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:49 eval “Rack::Builder.new {\n” + builder_script + “\n}.to_app”, Tracing: /Library/Ruby/Gems/2.0.0/gems/rack-1.6.4/lib/rack/builder.rb:49 eval “Rack::Builder.new {\n” + builder_script + “\n}.to_app”,
where the eval statement just sits and waits. At that point I had to abort the program at startup using Cntl C
My questions so far are:
-
how to trace outside programs called by Ruby like Rack::Builder’’ above to continue my investigations. Other more powerfull debug tracers to use? DTRACE? 1.5) Can break points be placed against the source code before the dynamic tracing begins? or have a pre-programmed script set the breakpoints at runtime?
-
how is javascript executed by ``Ruby start up’’ to manufacture the local registered scripts: ie, the various crossovers between Ruby and Javascript contexts
Any pointers to documents/websites/forums where these questions allow me to continue my investigations is appreciated
I thank you in advance for your ``eyes and ears’’ evaluating my request Dave