Sha256: 9d4569aee5d68320283815a63bb5a8b1e01a6f3de1e2f2e6adefa3199d3fab2f

Contents?: true

Size: 1.16 KB

Versions: 43

Compression:

Stored size: 1.16 KB

Contents

# ===========================================================================
# Project:   Abbot - SproutCore Build Tools
# Copyright: ©2010 Apple Inc.
#            portions copyright @2006-2011 Strobe Inc.
#            and contributors
# ===========================================================================

require "sproutcore/builders/base"
require 'json'

module SC

  # If a target is a prefetched module, this builder will take the contents of its packed file
  # and wrap it in strings.
  class Builder::StringWrapper < Builder::Base

    def build(dst_path)
      src_path = entry.source_entry[:build_path]
      entry.source_entry.build!

      return if not File.exist? src_path

      # Normalize the target name by removing any initial forward slash
      target = entry.target
      target_name = target[:target_name].to_s.sub(/^\//,'')

      # Set the source property of the module's SC.MODULE_INFO hash to the
      # JSON-escaped contents of the file.
      output = "SC.MODULE_INFO['#{target_name}'].source = "

      content = readlines(src_path)
      output += content.join.to_json

      output += ";"

      writeline dst_path, output
    end

  end

end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
sproutcore-1.11.0 lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.11.0.rc3 lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.11.0.rc2 lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.11.0.rc1 lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.10.3.1 lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.10.2 lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.10.1 lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.10.0 lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.10.0.rc.3 lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.10.0.rc.2 lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.10.0.rc.1 lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.9.2 lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.9.1 lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.9.0 lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.8.2.1 lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.8.1 lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.8.0 lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.7.1.beta-java lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.7.1.beta lib/sproutcore/builders/string_wrapper.rb
sproutcore-1.6.0.1-java lib/sproutcore/builders/string_wrapper.rb