Method: Chef::Sugar::Shell#version_for
- Defined in:
- lib/chef/sugar/shell.rb
#version_for(cmd, flag = '--version') ⇒ String
The version for a given command. This method does NOT check if the command exists! It is assumed the command existence has been checked with which or similar. To simply check if an installed version is acceptable, please see installed_at_version.
Assumptions:
1. The command exists.
2. The command outputs version information to +$stdout+.
107 108 109 110 111 112 |
# File 'lib/chef/sugar/shell.rb', line 107 def version_for(cmd, flag = '--version') cmd = Mixlib::ShellOut.new("#{cmd} #{flag}") cmd.run_command cmd.error! cmd.stdout.strip end |