Voodoo::CommandPostProcessor

Utility functions for classes that use commands to postprocess generator output.

Public Instance Methods

shell_encode(string) click to toggle source

Encodes a string so that it is safe for use as a shell argument

# File voodoo/generators/command_postprocessor.rb, line 11
def shell_encode string
  '"' + string.gsub(/([\\`"$\n])/, "\\\\\\1") + '"'
end
tempfile(extension, base = nil) click to toggle source

Creates a temporary file and returns its name

# File voodoo/generators/command_postprocessor.rb, line 16
def tempfile extension, base = nil
  base = self.class.name unless base
  file = Tempfile.open(basename + extension)
  name = file.path
  file.close
  name
end
write_file_to_io(filename, io) click to toggle source

Writes the contents of the named file to an IO handle

# File voodoo/generators/command_postprocessor.rb, line 25
def write_file_to_io filename, io
  File.open(filename) { |file| io.write(file.read) }
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.