class Barber::Ember::Precompiler

Attributes

ember_template_compiler_path[R]

Public Class Methods

ember_template_compiler_path=(path) click to toggle source
# File lib/barber/ember/precompiler.rb, line 6
def ember_template_compiler_path=(path)
  instance.ember_template_compiler_path = path
end
new() click to toggle source
Calls superclass method
# File lib/barber/ember/precompiler.rb, line 13
def initialize
  super

  self.ember_template_compiler_path = ::Ember::Source.bundled_path_for("ember-template-compiler.js")
end

Public Instance Methods

compiler_version() click to toggle source
# File lib/barber/ember/precompiler.rb, line 37
def compiler_version
  compiler_version = []
  compiler_version << "ember:#{ember_version}"
  compiler_version << "handlebars:#{handlebars_version}" if handlebars_version

  compiler_version.join('/')
end
ember_template_compiler_path=(path) click to toggle source
# File lib/barber/ember/precompiler.rb, line 19
def ember_template_compiler_path=(path)
  @ember = @ember_version = @context = nil

  @ember_template_compiler_path = path
end
ember_template_precompiler() click to toggle source
# File lib/barber/ember/precompiler.rb, line 25
def ember_template_precompiler
  @ember ||= File.new(@ember_template_compiler_path)
end
precompiler() click to toggle source
# File lib/barber/ember/precompiler.rb, line 29
def precompiler
  @precompiler = File.new(File.expand_path("../../javascripts/ember_precompiler.js", __FILE__))
end
sources() click to toggle source
Calls superclass method Barber::Precompiler#sources
# File lib/barber/ember/precompiler.rb, line 33
def sources
  super + [ember_template_precompiler]
end

Private Instance Methods

ember_version() click to toggle source
# File lib/barber/ember/precompiler.rb, line 47
def ember_version
  @ember_version ||= context.eval('typeof Ember !== "undefined" && Ember.VERSION') || '(none)'
end
handlebars_version() click to toggle source
# File lib/barber/ember/precompiler.rb, line 51
def handlebars_version
  return @handlebars_version if defined?(@handlebars_version)

  @handlebars_version = context.eval('typeof require !== "undefined" && require("handlebars") && require("handlebars").VERSION');
end