21760/22005 update preflight to delete old lib dir

In order to install in the top-level site_ruby directory, we need to clean out
any installs in the old site_ruby/1.8 location. We're doing this by setting a
variable in the package:apple task. If it's set, we remove all files there as
well as files in the new location.

While I'm here:
* update erb to strip leading and trailing spaces
* validate critical variables so a script is never generated with dangerous paths
* only target top-level files/dirs in lib, since we're doing rm -RF anyway
Use Dir.glob(), don't require rubygems or rake, use Dir.chdir as a block
use instance_variable_get instead of eval
(21868) Move facter libary target to /Library/Ruby/Site

We currently drop the facter library files in /usr/lib/ruby/site_ruby/1.8
OSX, which is a symlink to /Library/Ruby/Site/1.8. As of OSX 10.9 Maverick
this will no longer work because it will be ruby 2.0.0. There are hard way
and easy ways to solve this problem. A hard way would be to somehow
introspect the target host at install time, and then dynamically copy the
payload into the correct ruby version specific path. Another hard way woul be
to create different OSX packages for different versions of OSX. Or, we could
pick the easy way, which is to just install into /Library/Ruby/Site (the
equivalent of /usr/lib/ruby/site_ruby). Since facter will work on all rubies
shipped with supported versions of OSX, this will "just work".

Signed-off-by: Moses Mendoza <moses@puppetlabs.com>
Merge pull request #593 from MosesMendoza/21868/stable/cherry_pick_mavericks_pkging

21868/stable/cherry pick mavericks pkging