Sha256: c5dc31a3d97296fd73f8a034b8f8d3f3fbd466a16ec93803cf34b62b8c5342fc

Contents?: true

Size: 785 Bytes

Versions: 14

Compression:

Stored size: 785 Bytes

Contents

# ===========================================================================
# Project:   Abbot - SproutCore Build Tools
# Copyright: ©2011 Strobe Inc.
#            and contributors
# ===========================================================================

require "sproutcore/builders/base"
require "fileutils"
require "json"

module SC

  class Builder::Handlebars < Builder::Base

    def readlines(src_path)
      if File.exist?(src_path) && !File.directory?(src_path)
        File.read(src_path)
      else
        ""
      end
    end

    def build(dst_path)
      template_name = entry.rootname[/^.*\/([^\/]*)$/, 1]
      writelines dst_path, "SC.TEMPLATES[#{template_name.inspect}] = SC.Handlebars.compile(#{readlines(entry[:source_path]).to_json})"
    end
  end

end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
sproutcore-1.6.0.beta.3-x86-mingw32 lib/sproutcore/builders/handlebars.rb
sproutcore-1.6.0.beta.3-java lib/sproutcore/builders/handlebars.rb
sproutcore-1.6.0.beta.3 lib/sproutcore/builders/handlebars.rb
sproutcore-1.6.0.beta.2-x86-mingw32 lib/sproutcore/builders/handlebars.rb
sproutcore-1.6.0.beta.2-java lib/sproutcore/builders/handlebars.rb
sproutcore-1.6.0.beta.2 lib/sproutcore/builders/handlebars.rb
sproutcore-1.6.0.beta.1 lib/sproutcore/builders/handlebars.rb
sproutcore-1.5.0-java lib/sproutcore/builders/handlebars.rb
sproutcore-1.5.0 lib/sproutcore/builders/handlebars.rb
sproutcore-1.5.0.rc.2 lib/sproutcore/builders/handlebars.rb
sproutcore-1.5.0.rc.1 lib/sproutcore/builders/handlebars.rb
sproutcore-1.5.0.pre.5 lib/sproutcore/builders/handlebars.rb
sproutcore-1.5.0.pre.4.1 lib/sproutcore/builders/handlebars.rb
sproutcore-1.5.0.pre.4 lib/sproutcore/builders/handlebars.rb