Ensure a valid ruby exists before using it

If `command -v ruby` doesn't return a valid ruby binary, don't use the JSON parsing parts of the init script that depend on ruby. Also check for the validity of `-rubygems` as a ruby argument, as this works in ruby before 1.9, but after, it's invalid.

Fixes https://github.com/elasticsearch/cookbook-elasticsearch/issues/215.
Put back empty line to minimize diff.