Extract simple platform checks from Rakefile, gemspec, spec_helper

As a first step to updating dependencies while maintaining compatibility,
extract common simple platform detection helpers.