187

Use case:

I'd like to use https://github.com/garethr/hiera-etcd (which depends on this gem)
to provide an etcd backend for hiera on my puppetmaster.
But I must use RHEL 6.5, which only ships with ruby 1.8.7.

I'm aware of Software Collections on RHEL 6, but PuppetLabs
doesn't yet support software collections.
https://tickets.puppetlabs.com/browse/PUP-1112

I'd deploy puppetmaster on RHEL 7 (Ruby 2.x), but el7
doesn't have the passenger gem available yet in rpm format.

Changes:

* Enforce ruby 1.8.7 hashrocket style and update via:
  `bundle exec rubocop --only='Style/HashSyntax' -a`

* Handle differences in net/http codebase between 1.8 and 1.9+

* On ruby 1.8, use posix-spawn in test harness

  > The posix-spawn library aims to implement a subset of the Ruby
  > 1.9 Process::spawn interface in a way that takes advantage of
  > fast process spawning interfaces when available and provides
  > sane fallbacks on systems that do not.

* Exclude rubocop and coco in bundle on ruby 1.8 to
  avoid pulling in deps like celluloid and rainbow.
@ranjib 

This branch is finally clean on travis as of https://travis-ci.org/ranjib/etcd-ruby/builds/34876805
The test harness is also clean on my local el6 (ruby 1.8.7) and fedora 20 (ruby 2.x) envs.

the popen makes it work on all the tested platforms, but I was reluctant to use popen on ruby 1.9 since it provides the spawn method. 

the approach i had used earlier (posix-spawn) was falling back to a subshell on ubuntu (but not on redhat), which means the pid return value was off by 1. i've stripped everything about posix-spawn back out of the branch.

i think it's ready to :ship: if you'll accept it.