class ASF::WithdrawalRequestFiles

Constants

STEM

Public Class Methods

findpath(userid, env, getDates=false) click to toggle source

Find the file name (or directory) that matches a person return [svnpath, name, timestamp, epoch (int)] if found return nil if not found

# File lib/whimsy/asf/documents.rb, line 276
def self.findpath(userid, env, getDates=false)
  reqdir = ASF::SVN.svnpath!(STEM)
  list, err = ASF::SVN.listnames(reqdir, env.user, env.password, getDates)
  if list # This is a list of [names] or triples [name, ISO timestamp, epoch (int)]
    names = list.select{|x,_y| x.start_with?("#{userid}.") or x == "#{userid}/"} # if there is a sig, then files are in a subdir
    if names.size == 1
      name = names.first
      path = ASF::SVN.svnpath!(STEM, getDates ? name.first : name)
      return [path, name].flatten # this works equally well with or without dates
    end
    return nil
  else
    raise Exception.new("Failed to list #{STEM} files #{err}")
  end
end
listnames(storedates, env) click to toggle source
# File lib/whimsy/asf/documents.rb, line 263
def self.listnames(storedates, env)
  cache_dir = ASF::DocumentUtils.update_cache(STEM, env, storedates: storedates)
  _, list = ASF::SVN.getlisting(STEM, nil, true, storedates, cache_dir)
  list
end
refreshnames(storedates, env) click to toggle source
# File lib/whimsy/asf/documents.rb, line 269
def self.refreshnames(storedates, env)
  ASF::DocumentUtils.update_cache(STEM, env, storedates: storedates, force: true)
end