FIX: HTMLBars compilation was broken in production mode

This commit is contained in:
Robin Ward 2015-05-07 10:52:31 -04:00
parent 098556c78d
commit d9e5302a16
6 changed files with 22 additions and 47330 deletions

View File

@ -42,7 +42,7 @@ gem 'active_model_serializers', '~> 0.8.3'
gem 'onebox' gem 'onebox'
gem 'ember-rails' gem 'ember-rails'
gem 'ember-source', '1.9.0.beta.4' gem 'ember-source', '1.11.3.1'
gem 'handlebars-source', '2.0.0' gem 'handlebars-source', '2.0.0'
gem 'barber' gem 'barber'
gem 'babel-transpiler' gem 'babel-transpiler'

View File

@ -45,10 +45,9 @@ GEM
babel-transpiler (0.6.0) babel-transpiler (0.6.0)
babel-source (>= 4.0, < 5) babel-source (>= 4.0, < 5)
execjs (~> 2.0) execjs (~> 2.0)
barber (0.5.0) barber (0.9.0)
ember-source ember-source (>= 1.0, < 2)
execjs execjs (>= 1.2, < 3)
handlebars-source (>= 1.0.0.rc.4)
better_errors (2.1.1) better_errors (2.1.1)
coderay (>= 1.0.0) coderay (>= 1.0.0)
erubis (>= 2.6.6) erubis (>= 2.6.6)
@ -68,23 +67,23 @@ GEM
docile (1.1.5) docile (1.1.5)
dotenv (1.0.2) dotenv (1.0.2)
email_reply_parser (0.5.8) email_reply_parser (0.5.8)
ember-data-source (0.14) ember-data-source (1.0.0.beta.16.1)
ember-source ember-source (~> 1.8)
ember-rails (0.14.1) ember-handlebars-template (0.1.5)
barber (>= 0.9.0)
sprockets (>= 2.1, < 3.1)
ember-rails (0.18.2)
active_model_serializers active_model_serializers
barber (>= 0.4.1) ember-data-source (>= 1.0.0.beta.5)
ember-data-source ember-handlebars-template (>= 0.1.1, < 1.0)
ember-source ember-source (>= 1.1.0)
execjs (>= 1.2)
handlebars-source
jquery-rails (>= 1.0.17) jquery-rails (>= 1.0.17)
railties (>= 3.1) railties (>= 3.1)
ember-source (1.9.0.beta.4) ember-source (1.11.3.1)
handlebars-source (~> 2.0)
erubis (2.7.0) erubis (2.7.0)
eventmachine (1.0.7) eventmachine (1.0.7)
excon (0.44.4) excon (0.44.4)
execjs (2.4.0) execjs (2.5.2)
exifr (1.1.3) exifr (1.1.3)
fabrication (2.9.8) fabrication (2.9.8)
fakeweb (1.3.0) fakeweb (1.3.0)
@ -220,7 +219,7 @@ GEM
method_source (0.8.2) method_source (0.8.2)
mime-types (1.25.1) mime-types (1.25.1)
mini_portile (0.6.2) mini_portile (0.6.2)
minitest (5.6.0) minitest (5.6.1)
mocha (1.1.0) mocha (1.1.0)
metaclass (~> 0.0.1) metaclass (~> 0.0.1)
mock_redis (0.14.0) mock_redis (0.14.0)
@ -295,7 +294,7 @@ GEM
qunit-rails (0.0.7) qunit-rails (0.0.7)
railties railties
r2 (0.2.5) r2 (0.2.5)
rack (1.5.2) rack (1.5.3)
rack-mini-profiler (0.9.3) rack-mini-profiler (0.9.3)
rack (>= 1.1.3) rack (>= 1.1.3)
rack-openid (1.3.1) rack-openid (1.3.1)
@ -467,7 +466,7 @@ DEPENDENCIES
certified certified
email_reply_parser email_reply_parser
ember-rails ember-rails
ember-source (= 1.9.0.beta.4) ember-source (= 1.11.3.1)
eventmachine eventmachine
fabrication (= 2.9.8) fabrication (= 2.9.8)
fakeweb (~> 1.3.0) fakeweb (~> 1.3.0)

View File

@ -1,7 +1,7 @@
<% <%
if Rails.env.development? || Rails.env.test? if Rails.env.development? || Rails.env.test?
require_asset ("ember-template-compiler.js") require_asset ("ember-template-compiler.js")
require_asset ("ember.debug.js") require_asset ("ember.custom.debug.js")
else else
require_asset ("ember.prod.js") require_asset ("ember.prod.js")
end end

View File

@ -3,11 +3,11 @@ module Ember
class Template < Tilt::Template class Template < Tilt::Template
# Wrap in an IIFE in development mode to get the correct filename # Wrap in an IIFE in development mode to get the correct filename
def compile_ember_handlebars(string) def compile_ember_handlebars(string, ember_template = 'Handlebars')
if ::Rails.env.development? if ::Rails.env.development?
"(function() { try { return Ember.Handlebars.compile(#{indent(string).inspect}); } catch(err) { throw err; } })()" "(function() { try { return Ember.#{ember_template}.compile(#{indent(string).inspect}); } catch(err) { throw err; } })()"
else else
"Handlebars.compile(#{indent(string).inspect});" "Ember.#{ember_template}.compile(#{indent(string).inspect});"
end end
end end
end end

File diff suppressed because it is too large Load Diff