Method: Lam::Build::HandlerGenerator#generate
- Defined in:
- lib/lam/build/handler_generator.rb
#generate ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/lam/build/handler_generator.rb', line 17 def generate js_path = "#{Lam.root}#{@js_path}" FileUtils.mkdir_p(File.dirname(js_path)) template_path = File.('../templates/handler.js', __FILE__) template = IO.read(template_path) # Important ERB variables with examples: # @handler - handlers/controllers/posts.create # @process_type - controller @process_type = @handler.split('/')[1].singularize result = ERB.new(template, nil, "-").result(binding) puts "generating #{js_path}" IO.write(js_path, result) # FileUtils.cp(template_path, js_path) end |