Sha256: 9bde597acfe55b3b84e9d4cfe731efaeeb905b26590dc85f0cf26245e8542837

Contents?: true

Size: 660 Bytes

Versions: 9

Compression:

Stored size: 660 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
     	
	    #create iseq
    	
	    seq = __rho_compile(rbText)
	    arr = seq.to_a
    	
	    newName = File.basename(path).sub('.erb','_erb.iseq')
	    fName = File.join(File.dirname(path), newName)
	    fseq = File.new(fName, "w")
    	
	    Marshal.dump(arr,fseq)
    	
	    fseq.close()
	rescue Exception => e
	    puts 'erb compilation failed: ' + path
	    raise
	end 
	
  end
end
			  

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rhodes-1.5.5 lib/build/compileERB/default.rb
rhodes-1.5.4 lib/build/compileERB/default.rb
rhodes-1.5.3 lib/build/compileERB/default.rb
rhodes-1.5.2 lib/build/compileERB/default.rb
rhodes-1.5.1 lib/build/compileERB/default.rb
rhodes-1.5.0 lib/build/compileERB/default.rb
rhodes-1.4.2 lib/build/compileERB/default.rb
rhodes-1.4.1 lib/build/compileERB/default.rb
rhodes-1.4.0 lib/build/compileERB/default.rb