Method: JuscrCompiler#create_file

Defined in:
lib/juscrcompiler.rb

#create_fileObject



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/juscrcompiler.rb', line 62

def create_file
  begin
    is_new_file = (File.exists? "#{@root}#{@filename}") ? false : true
    File.open("#{@root}#{@filename}", "w+") do |the_file|
      the_file.syswrite @message + @compiled_content
      puts is_new_file ? "created #{@root}#{@filename}" : "updated #{@root}#{@filename}"
    end
  rescue IOError => e
    puts "#{e.class} #{e.message} #{e.backtrace.join($/)}"
  end

end