opscode/chef — pull request #1252 by danielsdeleo (2014-02-05 22:23:32+00:00)
Title: Use RubyVM to syntax check in-process where possible

Ruby 1.9+ expose some functionality of the underlying virtual machine via classes under `RubyVM`. In particular, one can compile some ruby code into a VM instruction sequence without executing it. This allows us the ability to syntax check ruby code without spawning a new process. The benefits of this inline validation strategy:

* Don't need to worry about the user's environment. Odd combinations of `PATH`, `GEM_HOME`, `RUBY_OPT`, etc. can cause ruby from one install to run code for a different ruby/gem repo. See https://tickets.opscode.com/browse/CHEF-4988
* Runs faster. When bundler is active, `ruby` can start slowly since it invokes `bundler/setup` each time it runs. Even without bundler, we're removing the overhead of launching a new ruby process, which can be significant, especially on windows.