Verbose Logging

software development with some really amazing hair

T + G I F R

sinatra-bundles Plays Nice With Eval

· · Posted in Programming
Tagged with

I recently added a Javascript file to my bundle with sinatra-bundles that uses Javascript's eval functionality. The call to eval executed code that referenced a method parameter. sinatra-bundles compresses Javascript files, and as part of that, shrinks variable names.

Normally this isn't a problem, but in this case of eval, it became a problem, since it was trying to reference a local variable that no longer existed (because it got shrunk to something like a).

In this commit, I rearranged a bunch of stuff, upgraded some stuff, but I also fixed this. It's straight forward, and only shrinks variables if the Javascript doesn't include the string eval(.

If you need this functionality, use the new version 0.1.3, which can be found on rubygems.org. Install with

$ gem install sinatra-bundles

Enjoy!