class SC::Builder::Combine
This builder combines several javascript files into a single file. It is used to prepare a single javascript file for production use. This build tool expects the javascript files to have already been processed for any build directives such sc_static().
Public Instance Methods
build(dst_path)
click to toggle source
# File lib/sproutcore/builders/combine.rb, line 22 def build(dst_path) lines = "" entries = entry[:ordered_entries] || entry[:source_entries] target_name = entry.target[:target_name].to_s.sub(/^\//,'') if entry[:top_level_lazy_instantiation] && entry[:combined] lines << "; if ((typeof SC !== 'undefined') && SC && !SC.LAZY_INSTANTIATION) { SC.LAZY_INSTANTIATION = {}; } if(!SC.LAZY_INSTANTIATION['#{target_name}']) { SC.LAZY_INSTANTIATION['#{target_name}'] = []; } SC.LAZY_INSTANTIATION['#{target_name}'].push( ( function() { " end entries.each do |entry| src_path = entry.stage![:staging_path] next unless File.exist?(src_path) lines << "/* >>>>>>>>>> BEGIN #{entry[:filename]} */\n" + File.read(src_path) + "\n" end if entry[:top_level_lazy_instantiation] && entry[:combined] lines << " } ) ); " end writelines dst_path, lines end