Sha256: 7fa8f898fdbfb4006649a8fad17b6fce498975e8cc2ed8365b68df8507dbaa0e
Contents?: true
Size: 578 Bytes
Versions: 66
Compression:
Stored size: 578 Bytes
Contents
require 'find' require 'erb' dir = File.dirname(File.expand_path(__FILE__)) ext = ".erb" Find.find(dir) do |path| if File.extname(path) == ext begin strFile = IO.read(path) strFile.force_encoding('utf-8') rbText = ERB.new( strFile ).src newName = File.basename(path).sub('.erb','_erb.rb') fName = File.join(File.dirname(path), newName) frb = File.new(fName, "wb") frb.write( rbText ) frb.close() rescue Exception => e puts "\nYou have a syntax error in your ERB: " + path exit 1 end end end
Version data entries
66 entries across 66 versions & 1 rubygems