RexOps/Rex — pull request #505 by ferki (2014-12-06 13:09:46+00:00)
Title: Take version into account with is_installed

This changeset essentially reverts #416, and fixes it (and more) with a different approach. Changes to mention:
- use `Rex::Commands::Pkg::install()` with `pkg 'X', ensure => 'ver.si.on';` to be able to check for installed version before deciding whether to take action
- pass around `pkg` and `install` command's options to `is_installed()` and `install()` methods living under the `Rex::Pkg` namespace, so they could implement their own logic based on the provided values (for example in the Base package, but in OS-specific implementations as well, like for Gentoo and FreeBSD)
- clarify log messages by including version information if they are provided
- simplify `has_package` test + documenting the optional `$version` parameter for it

The two issues we need to keep in mind when there is a package version specified with `pkg` or `install`:
1. if the version information changes on a later run, ensure that the new version becomes installed
2. if the version information doesn't change on a lter run, ensure that the package doesn't get reinstalled every time (could be especially annoying on Gentoo :))

@krimdomu: please review and discuss this approach
@fr34k8: if I understand it correctly, you mentioned in https://github.com/RexOps/Rex/pull/444#issuecomment-58349796 that you would be interested in something like this. Your feedback on whether this solves your problems/needs would be very much appreciated! Feel free to comment here or contact us on our other channels.