class AutomateIt::ShellManager::BaseDriver
ShellManager::BaseDriver¶ ↑
Base class for all ShellManager drivers.
Public Instance Methods
peer_for(source, target)
click to toggle source
Returns derived filename to use as a peer given the source
and target
. This is necessary for differentiating between directory and file targets.
For example:
# Get the peer for an extant target directory: peer_for("foo", "/tmp") # => "/tmp/foo" # Get the peer for anything else: peer_for("foo", "/bar") # => "/bar"
# File lib/automateit/shell_manager.rb, line 280 def peer_for(source, target) return FileUtils.send(:fu_each_src_dest0, source, target){|a, b| b} end
Protected Instance Methods
_directory_contents(directory)
click to toggle source
Return array of all the directory’s top-level contents, including hidden files with “.” prefix on UNIX. Directories are returned just as a name, you’ll need to expand those separately if needed.
# File lib/automateit/shell_manager.rb, line 302 def _directory_contents(directory) return Dir[directory+"/{,.}*"].reject{|t| t =~ /(^|#{File::SEPARATOR})\.{1,2}$/} end
_fileutils_opts()
click to toggle source
Returns hash of verbosity and preview settings for FileUtils commands.
# File lib/automateit/shell_manager.rb, line 292 def _fileutils_opts opts = {} opts[:verbose] = false # Generate our own log messages opts[:noop] = true if preview? return opts end
_replace_owner_with_user(opts)
click to toggle source
# File lib/automateit/shell_manager.rb, line 285 def _replace_owner_with_user(opts) value = opts.delete(:owner) opts[:user] = value if value and not opts[:user] return opts end