module Backup::Utilities::Helpers
Allows these utility methods to be included in other classes, while allowing them to be stubbed in spec_helper for all specs.
Public Instance Methods
utility_remote(name)
click to toggle source
Returns the full path to the specified utility. Raises an error if utility can not be found in the system's $PATH
# File lib/backup/utilities.rb, line 229 def utility_remote(name) name = name.to_s.strip raise Error, 'Utility Name Empty' if name.empty? req = Backup::Remote::Command.new cmd = %Q(which '#{ name }' 2>/dev/null) res = req.run_ssh_cmd(server_host, server_ssh_options, cmd) output = res[:output].chomp raise Error, <<-EOS if res[:res]==0 || output.empty? Could not locate '#{ name }'. Reason: #{output}, #{res[:error]}. EOS UTILITY[name] ||= output UTILITY[name].dup end
Private Instance Methods
gnu_tar?()
click to toggle source
# File lib/backup/utilities.rb, line 251 def gnu_tar?; Utilities.gnu_tar?; end