lib/xray/middleware.rb in xray-rails-0.1.15 vs lib/xray/middleware.rb in xray-rails-0.1.16

- old
+ new

@@ -72,10 +72,20 @@ # Matches: # <script src="/assets/jquery.js"></script> # <script src="/assets/jquery-min.js"></script> # <script src="/assets/jquery.min.1.9.1.js"></script> # <script src="/assets/jquery.min.1.9.1-89255b9dbf3de2fbaa6754b3a00db431.js"></script> - html.sub!(/<script[^>]+\/#{after_script_name}([-.]{1}[\d\.]+)?([-.]{1}min)?(-\h{32})?\.js[^>]+><\/script>/) do + script_pattern = / + <script[^>]+ + \/#{after_script_name} # Name of the script itself + ([-.]{1}[\d\.]+)? # Optional version identifier (e.g. -1.9.1) + ([-.]{1}min)? # Optional -min suffix + (\.self)? # Sprockets 3 appends .self to the filename + (-\h{32,64})? # Fingerprint varies based on Sprockets version + \.js # Must have .js extension + [^>]+><\/script> + /x + html.sub!(script_pattern) do h = ActionController::Base.helpers "#{$~}\n" + h.javascript_include_tag(script_name) end end