Sha256: 6171b30baa1fd093f9c3d82cd4a5a68d061f4ab9ababe3d3a83525d501bb9415
Contents?: true
Size: 979 Bytes
Versions: 3
Compression:
Stored size: 979 Bytes
Contents
require 'erb' require 'tilt/erb' require 'ib/generator/rendering_helper' class IB::Generator def initialize motion_template_type # NOTE: motion_template_type equal to Motion::Project::App.template # but, this class use its value for judging build platform. @build_platform = motion_template_type end def absolute_template_path path File.expand_path(File.join(File.dirname(__FILE__), path)) end def render_stub_file path, files template = Tilt::ERBTemplate.new(absolute_template_path(path), { :trim => '<>' }) template.render(RenderingHelper.new(@build_platform, files)) end def write files, dest files = IB::Parser.new.find_all(files) FileUtils.mkpath dest File.open("#{dest}/Stubs.h", 'w') do |f| f.write render_stub_file('generator/templates/Stubs.h.erb', files) end File.open("#{dest}/Stubs.m", 'w') do |f| f.write render_stub_file('generator/templates/Stubs.m.erb', files) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ib-0.4.3 | lib/ib/generator.rb |
ib-0.4.2 | lib/ib/generator.rb |
ib-0.4.1 | lib/ib/generator.rb |