module JunglePath::Gen
Public Class Methods
api(app_root_path, tables, output_file='./api/generated.rb', name_space='Server', controller_name_space='Controller', class_name='API', base_class_name='Base', template_file=nil)
click to toggle source
# File lib/jungle_path/gen/api.rb, line 36 def self.api(app_root_path, tables, output_file='./api/generated.rb', name_space='Server', controller_name_space='Controller', class_name='API', base_class_name='Base', template_file=nil) if template_file template_file = ::File.expand_path(template_file, app_root_path) else template_file = ::File.expand_path('../api/template.erb', ::File.dirname(__FILE__)) end # template uses name_space,controller_name_space, class_name and base_class_name vars:`` template = ERB.new(File.read(template_file)) output_file = ::File.expand_path(output_file, app_root_path) result = template.result(binding) #puts result File.write(output_file, result) end
controllers(app_root_path, tables, output_file='./controllers/generated.rb', controller_name_space='Controller', schema_require_relative='../schemas/schema', template_file=nil)
click to toggle source
# File lib/jungle_path/gen/controllers.rb, line 6 def self.controllers(app_root_path, tables, output_file='./controllers/generated.rb', controller_name_space='Controller', schema_require_relative='../schemas/schema', template_file=nil) if template_file template_file = ::File.expand_path(template_file, app_root_path) else template_file = ::File.expand_path('../controller/template.erb', ::File.dirname(__FILE__)) end # template uses name_space and controller_name_space vars:`` template = ERB.new(File.read(template_file)) output_file = ::File.expand_path(output_file, app_root_path) result = template.result(binding) puts result File.write(output_file, result) end