Permalink
Browse files

Updated to use the Ember codebase

  • Loading branch information...
1 parent 164c60f commit ac34352210fc6fba6d54fea5c6c3348753c18564 @keithpitt keithpitt committed Jan 3, 2012
View
BIN .DS_Store
Binary file not shown.
View
@@ -5,3 +5,4 @@ pkg/*
*.rbc
*.log
test/dummy/tmp
+.DS_Store
@@ -17,10 +17,10 @@ def prepare
end
# Generates Javascript code from a HandlebarsJS template.
- # The SC template name is derived from the lowercase logical asset path
+ # The Ember template name is derived from the lowercase logical asset path
# by replacing non-alphanum characheters by underscores.
def evaluate(scope, locals, &block)
- "SC.TEMPLATES[\"#{scope.logical_path}\"] = Handlebars.template(#{precompile(data)});\n"
+ "Ember.TEMPLATES[\"#{scope.logical_path}\"] = Handlebars.template(#{precompile(data)});\n"
end
private
@@ -34,7 +34,7 @@ def runtime
end
def ember
- [ "sproutcore-precompiler.js", "sproutcore-core.js" ].map do |name|
+ [ "ember-precompiler.js", "ember.min.js" ].map do |name|
File.read(File.expand_path(File.join(__FILE__, "..", "..", "..", "vendor/assets/javascripts/#{name}")))
end.join("\n")
end
@@ -1,3 +1,3 @@
module EmberRails
- VERSION = "0.1.0"
+ VERSION = "0.2.0"
end
View
@@ -5,7 +5,7 @@ class HomeControllerTest < ActionController::TestCase
test "page header should include link to asset" do
get :index
assert_response :success
- assert_select 'head script[type="text/javascript"][src="/assets/templates/test.js"]', true
+ assert_select 'head script[type="text/javascript"][src="/assets/templates/test.js"]', true, @response.body
end
end
@@ -15,13 +15,13 @@ class HjsTemplateTest < ActionController::IntegrationTest
test "asset pipeline should serve template" do
get "/assets/templates/test.js"
assert_response :success
- assert @response.body == "SC.TEMPLATES[\"templates/test\"] = Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {\nhelpers = helpers || Handlebars.helpers;\n var buffer = '', stack1, stack2, stack3, stack4, tmp1, self=this, functionType=\"function\", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;\n\n\n stack1 = depth0;\n stack2 = \"test\";\n stack3 = {};\n stack4 = \"true\";\n stack3['escaped'] = stack4;\n stack4 = helpers.bind || SC.get(depth0, \"bind\");\n tmp1 = {};\n tmp1.hash = stack3;\n tmp1.contexts = [];\n tmp1.contexts.push(stack1);\n tmp1.data = data;\n if(typeof stack4 === functionType) { stack1 = stack4.call(depth0, stack2, tmp1); }\n else if(stack4=== undef) { stack1 = helperMissing.call(depth0, \"bind\", stack2, tmp1); }\n else { stack1 = stack4; }\n data.buffer.push(escapeExpression(stack1) + \"\\n\");\n return buffer;\n});\n"
+ assert @response.body == "Ember.TEMPLATES[\"templates/test\"] = Handlebars.template(function anonymous(Handlebars,depth0,helpers,partials,data) {\nhelpers = helpers || Ember.Handlebars.helpers;\n var buffer = '', stack1, stack2, stack3, stack4, tmp1, self=this, functionType=\"function\", helperMissing=helpers.helperMissing, undef=void 0, escapeExpression=this.escapeExpression;\n\n\n stack1 = depth0;\n stack2 = \"test\";\n stack3 = {};\n stack4 = \"true\";\n stack3['escaped'] = stack4;\n stack4 = helpers.bind || depth0.bind;\n tmp1 = {};\n tmp1.hash = stack3;\n tmp1.contexts = [];\n tmp1.contexts.push(stack1);\n tmp1.data = data;\n if(typeof stack4 === functionType) { stack1 = stack4.call(depth0, stack2, tmp1); }\n else if(stack4=== undef) { stack1 = helperMissing.call(depth0, \"bind\", stack2, tmp1); }\n else { stack1 = stack4; }\n data.buffer.push(escapeExpression(stack1) + \"\\n\");\n return buffer;\n});\n", @response.body.inspect
end
test "ensure new lines inside the anon function are persisted" do
get "/assets/templates/new_lines.js"
assert_response :success
- assert @response.body.include?("helpers['if']\n")
+ assert @response.body.include?("helpers['if'];\n"), @response.body.inspect
end
end
Binary file not shown.
Oops, something went wrong.

0 comments on commit ac34352

Please sign in to comment.