class Synqa::RemoteContentLocation

A directory of files on a remote system

Attributes

baseDir[R]

the base directory on the remote system

contentHost[R]

the remote SshContentHost

Public Class Methods

new(contentHost, baseDir, cachedContentFile = nil) click to toggle source
Calls superclass method Synqa::ContentLocation::new
# File lib/synqa.rb, line 864
def initialize(contentHost, baseDir, cachedContentFile = nil)
  super(cachedContentFile)
  @contentHost = contentHost
  @baseDir = normalisedDir(baseDir)
end

Public Instance Methods

closeConnections() click to toggle source
# File lib/synqa.rb, line 870
def closeConnections
  @contentHost.closeConnections()
end
getContentTree() click to toggle source

Get the content tree, from the cached content file if it exists, otherwise get if from listing directories and files and hash values thereof on the remote host. And also, if the cached content file name is specified, write the content tree out to that file.

# File lib/synqa.rb, line 912
def getContentTree
  if cachedContentFile and File.exists?(cachedContentFile)
    return ContentTree.readFromFile(cachedContentFile)
  else
    contentTree = contentHost.getContentTree(baseDir)
    contentTree.sort!
    if cachedContentFile != nil
      contentTree.writeToFile(cachedContentFile)
    end
    return contentTree
  end
end
getFullPath(relativePath) click to toggle source

get the full path of a relative path

# File lib/synqa.rb, line 885
def getFullPath(relativePath)
  return baseDir + relativePath
end
listDirectories() click to toggle source

list all sub-directories of the base directory on the remote host

# File lib/synqa.rb, line 895
def listDirectories
  return contentHost.listDirectories(baseDir)
end
listFileHashes() click to toggle source

list all the file hashes of the files within the base directory

# File lib/synqa.rb, line 900
def listFileHashes
  return contentHost.listFileHashes(baseDir)
end
listFiles() click to toggle source

list files within the base directory on the remote contentHost

# File lib/synqa.rb, line 875
def listFiles()
  contentHost.listFiles(baseDir)
end
ssh(commandString, dryRun = false) click to toggle source

execute an SSH command on the remote host (or just pretend, if dryRun is true)

# File lib/synqa.rb, line 890
def ssh(commandString, dryRun = false)
  contentHost.sshAndScp.ssh(commandString, dryRun)
end
sshAndScp() click to toggle source

object required to execute SCP (e.g. “scp” or “pscp”, possibly with extra args)

# File lib/synqa.rb, line 880
def sshAndScp
  return contentHost.sshAndScp
end
to_s() click to toggle source
# File lib/synqa.rb, line 904
def to_s
  return contentHost.locationDescriptor(baseDir)
end