Sha256: f713d4a23430f30934c349ca21eb98d1bddc6c2e7fb9f32529b44796477942d8
Contents?: true
Size: 587 Bytes
Versions: 4
Compression:
Stored size: 587 Bytes
Contents
require 'fileutils' require 'coffee-script' module Generator class CoffeeGenerator def generate input_folder, output_folder Dir.glob("#{input_folder}/*.coffee").select do |file| next unless File.file? file result = compile(file) file_name = file.split('/')[-1].gsub('.coffee', '.js') write File.join(output_folder, file_name), result end end def compile file CoffeeScript.compile(File.read(file)) end def write file, content File.open(file, "w") do |f| f.write content end end end end
Version data entries
4 entries across 4 versions & 1 rubygems