rosstimson/chef-ruby_install — pull request #7 by bclarkindy (2014-05-24 20:19:35+00:00)
Title: Additional LWRP options (with tests), including execute as non-root

This PR was created to address two issues... successfully installing a ruby as a non-privileged user (eg. to `~/.rubies` with proper ownership) and to allow patched installations.

To install a ruby as a non-root user (eg. as vagrant:vagrant into ~/.rubies), we need to be able to pass the `--no-install-deps` flag to ruby-install. Otherwise the run will likely puke when ruby-install is executed as non-root and attempts to sudo to install deps (well, at leat in my test env). To allow for patched installs, we need the `--patch` option. In addition to these options, I also added some others for the sake of completeness (though not all of them).

I also included a commit that contains a test cookbook `user_ruby` and related test-kitchen suites and serverspec tests to exemplify the items mentioned above. This includes a) installing a ruby as vagrant to its home directory, and b) installing a patched ruby 2.0 into Ubuntu-14.04 (which is otherwise impossible to install due to issues w/ readline).

The `user_ruby` test cookbook includes some comments to give an example pattern of installing a ruby to a user's home directory. As long as the `install_deps` attribute is exposed in the LWRP, this should address issue #1. With it, the only attributes needed to install a ruby is the username of an (existing) user and the actual ruby to be installed. The rest can be determined with some help from our good friend `etc`.

As a side note, some of the logic included in the `user_ruby` test cookbook *could* be integrated directly into the LWRP, albeit at the possible expense of making it slightly more "opinionated". I guess it depends on whether the intent is to leave it all up to the implementer, or to provide reasonable (and overridable) defaults that mimic the actual ruby-install command. I'll save that for another comment/issue.

Please feel free to merge, cherry-pick, provide feedback for edits, etc.