Ruby gems with npm packages

I have figured out a robust way to have ruby gems depend on npm packages.
Ruby will install the npm dependencies during gem installation (using an extconf.rb trick), and fail to install if npm installation fails for whatever reason.

Example: - a Ruby wrapper for the critical npm package.