Method: Onceover::Controlrepo.init_write_file

Defined in:
lib/onceover/controlrepo.rb

.init_write_file(contents, out_file) ⇒ Object



609
610
611
612
613
614
615
616
617
# File 'lib/onceover/controlrepo.rb', line 609

def self.init_write_file(contents, out_file)
  create_dirs_and_log(File.dirname(out_file))
  if File.exist?(out_file)
    puts "#{'skipped'.yellow} #{Pathname.new(out_file).relative_path_from(Pathname.new(Dir.pwd)).to_s} #{'(exists)'.yellow}"
  else
    File.write(out_file, contents)
    puts "#{'created'.green} #{Pathname.new(out_file).relative_path_from(Pathname.new(Dir.pwd)).to_s}"
  end
end