Method: Confmake::Command#write_file

Defined in:
lib/confmake/command.rb

#write_file(output_file_contents, output_filename) ⇒ Object



124
125
126
127
128
129
130
131
132
133
# File 'lib/confmake/command.rb', line 124

def write_file output_file_contents, output_filename
  return File.write output_filename, output_file_contents unless File.exists? output_filename
  
  if File.exists? output_filename and force?
    puts "Overwriting #{output_filename}..."
    File.write output_filename, output_file_contents
  else
    puts "#{output_filename} already exists, use the --force flag to overwrite"
  end
end