In Files

Parent

XmlFile

Public Class Methods

copy(file_name, output_dir) click to toggle source
# File lib/rest.rb, line 22
def XmlFile.copy file_name, output_dir
  dir_name = File.dirname( file_name )

  if ( dir_name =~ /^\// )
    puts STDERR, "Absolute file names aren't allowed as XML file names."
      + " (#{dir_name})";
    return
  end

  if ( dir_name )
    output_dir += "/" + dir_name
  end
  
  if ( dir_name && !dir_name.empty? && !File.exist?( dir_name ) )
    `mkdir -p #{output_dir}`
    if ( $? != 0 )
      puts STDERR, "Unable to create directory '#{dir_name}'"
    end
  end
  src_file = find_file( file_name )
  unless File.absolute_path(output_dir) == File.absolute_path(File.split( src_file).first)
    # do not copy to itself
    FileUtils.cp( src_file, output_dir ) 
  end

end
exist?(file_name) click to toggle source
# File lib/rest.rb, line 14
def XmlFile.exist? file_name
  exists? file_name
end
exists?(file_name) click to toggle source
# File lib/rest.rb, line 18
def XmlFile.exists? file_name
  find_file file_name
end
find_file(file_name) click to toggle source
# File lib/rest.rb, line 49
def XmlFile.find_file file_name
  if ( File.exists? file_name )
    return file_name
  end
 
  if ( !@@include_dir.empty? )
    file_name = @@include_dir + "/" + file_name
    if ( File.exists? file_name )
      return file_name
    end
  end
  
  return nil
end
include_dir=(dir) click to toggle source
# File lib/rest.rb, line 7
def XmlFile.include_dir= dir
  if !dir
    dir = ""
  end
  @@include_dir = dir
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.