Class AutomateIt::ShellManager::BaseDriver
In: lib/automateit/shell_manager.rb
Parent: AutomateIt::Plugin::Driver

ShellManager::BaseDriver

Base class for all ShellManager drivers.

Methods

Public Instance methods

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"

[Source]

# 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

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.

[Source]

# File lib/automateit/shell_manager.rb, line 302
  def _directory_contents(directory)
    return Dir[directory+"/{,.}*"].reject{|t| t =~ /(^|#{File::SEPARATOR})\.{1,2}$/}
  end

Returns hash of verbosity and preview settings for FileUtils commands.

[Source]

# 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

[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

[Validate]