Permalink
Browse files

removing underscore templates, using ejs gem instead

  • Loading branch information...
1 parent 5722e5f commit 9d0f9819398b4674296ce9289703ea3c5fc43ef4 Ryan Fitzgerald committed May 23, 2011
View
@@ -3,4 +3,5 @@ log/*.log
pkg/
test/dummy/db/*.sqlite3
test/dummy/log/*.log
-test/dummy/tmp/
+test/dummy/tmp/
+test/dummy/.sass-cache/
View
10 Gemfile
@@ -1,17 +1,19 @@
source "http://rubygems.org"
-gem 'rails', '3.1.0.beta1'
+# gem 'rails', '3.1.0.beta1'
# Bundle edge Rails instead:
-# gem 'rails', :git => 'git://github.com/rails/rails.git'
+gem 'rails', :git => 'git://github.com/rails/rails.git'
+gem 'tilt', :git => "git://github.com/rtomayko/tilt.git"
+gem 'sprockets', :git => "git://github.com/sstephenson/sprockets.git"
+gem 'execjs', :git => "git://github.com/sstephenson/execjs.git"
gem 'sqlite3'
gem 'sass'
gem 'coffee-script'
gem 'uglifier'
gem 'jquery-rails'
-
-gem 'tilt', :git => "git://github.com/rtomayko/tilt.git"
+gem 'ejs'
if RUBY_VERSION < '1.9'
gem "ruby-debug", ">= 0.10.3"
View
@@ -1,93 +1,113 @@
GIT
- remote: git://github.com/rtomayko/tilt.git
- revision: b8e1cd20900f666d8127405be4a060e74274de8b
- specs:
- tilt (1.3)
-
-GEM
- remote: http://rubygems.org/
+ remote: git://github.com/rails/rails.git
+ revision: a5fb1c61755f03a8c75b0a434fb2aca57502293b
specs:
- actionmailer (3.1.0.beta1)
- actionpack (= 3.1.0.beta1)
+ actionmailer (3.1.0.rc1)
+ actionpack (= 3.1.0.rc1)
mail (~> 2.3.0)
- actionpack (3.1.0.beta1)
- activemodel (= 3.1.0.beta1)
- activesupport (= 3.1.0.beta1)
+ actionpack (3.1.0.rc1)
+ activemodel (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
builder (~> 3.0.0)
erubis (~> 2.7.0)
- i18n (~> 0.6.0beta1)
- rack (~> 1.3.0.beta)
+ i18n (~> 0.6)
+ rack (~> 1.3.0)
rack-cache (~> 1.0.1)
- rack-mount (~> 0.7.2)
+ rack-mount (~> 0.8.1)
rack-test (~> 0.6.0)
- sprockets (~> 2.0.0.beta.2)
+ sprockets (~> 2.0.0.beta.8)
tzinfo (~> 0.3.27)
- activemodel (3.1.0.beta1)
- activesupport (= 3.1.0.beta1)
+ activemodel (3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
bcrypt-ruby (~> 2.1.4)
builder (~> 3.0.0)
- i18n (~> 0.6.0beta1)
- activerecord (3.1.0.beta1)
- activemodel (= 3.1.0.beta1)
- activesupport (= 3.1.0.beta1)
- arel (~> 2.1.0)
+ i18n (~> 0.6)
+ activerecord (3.1.0.rc1)
+ activemodel (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ arel (~> 2.1.1)
tzinfo (~> 0.3.27)
- activeresource (3.1.0.beta1)
- activemodel (= 3.1.0.beta1)
- activesupport (= 3.1.0.beta1)
- activesupport (3.1.0.beta1)
+ activeresource (3.1.0.rc1)
+ activemodel (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ activesupport (3.1.0.rc1)
+ i18n (~> 0.6)
+ multi_json (~> 1.0)
+ rails (3.1.0.rc1)
+ actionmailer (= 3.1.0.rc1)
+ actionpack (= 3.1.0.rc1)
+ activerecord (= 3.1.0.rc1)
+ activeresource (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ bundler (~> 1.0)
+ railties (= 3.1.0.rc1)
+ railties (3.1.0.rc1)
+ actionpack (= 3.1.0.rc1)
+ activesupport (= 3.1.0.rc1)
+ rack-ssl (~> 1.3.2)
+ rake (>= 0.8.7)
+ thor (~> 0.14.6)
+
+GIT
+ remote: git://github.com/rtomayko/tilt.git
+ revision: 0f37285473221067fb8df6924aa2735e2d06bf5e
+ specs:
+ tilt (1.3.1)
+
+GIT
+ remote: git://github.com/sstephenson/execjs.git
+ revision: de9d10fa91a26f501ce08b9fa96bd19a534cb936
+ specs:
+ execjs (1.0.0)
multi_json (~> 1.0)
+
+GIT
+ remote: git://github.com/sstephenson/sprockets.git
+ revision: 4e6333c24343d34e30fe3d8a856b66fceb058214
+ specs:
+ sprockets (2.0.0.beta.8)
+ hike (~> 1.0)
+ rack (~> 1.0)
+ tilt (!= 1.3.0, ~> 1.1)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
archive-tar-minitar (0.5.2)
- arel (2.1.0)
+ arel (2.1.1)
bcrypt-ruby (2.1.4)
builder (3.0.0)
coffee-script (2.2.0)
coffee-script-source
execjs
- coffee-script-source (1.1.0)
+ coffee-script-source (1.1.1)
columnize (0.3.2)
+ ejs (1.0.0)
erubis (2.7.0)
- execjs (0.3.3)
- multi_json (~> 1.0)
hike (1.0.0)
- i18n (0.6.0beta1)
- jquery-rails (1.0.1)
+ i18n (0.6.0)
+ jquery-rails (1.0.7)
railties (~> 3.0)
thor (~> 0.14)
- json (1.5.1)
linecache19 (0.5.12)
ruby_core_source (>= 0.1.4)
mail (2.3.0)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
- multi_json (1.0.1)
+ multi_json (1.0.3)
polyglot (0.3.1)
- rack (1.3.0.beta)
- rack-cache (1.0.1)
+ rack (1.3.0)
+ rack-cache (1.0.2)
rack (>= 0.4)
- rack-mount (0.7.2)
+ rack-mount (0.8.1)
rack (>= 1.0.0)
rack-ssl (1.3.2)
rack
rack-test (0.6.0)
rack (>= 1.0)
- rails (3.1.0.beta1)
- actionmailer (= 3.1.0.beta1)
- actionpack (= 3.1.0.beta1)
- activerecord (= 3.1.0.beta1)
- activeresource (= 3.1.0.beta1)
- activesupport (= 3.1.0.beta1)
- bundler (~> 1.0)
- railties (= 3.1.0.beta1)
- railties (3.1.0.beta1)
- actionpack (= 3.1.0.beta1)
- activesupport (= 3.1.0.beta1)
- rack-ssl (~> 1.3.2)
- rake (>= 0.8.7)
- thor (~> 0.14.6)
- rake (0.8.7)
+ rake (0.9.0)
ruby-debug-base19 (0.11.25)
columnize (>= 0.3.1)
linecache19 (>= 0.5.11)
@@ -99,28 +119,27 @@ GEM
ruby_core_source (0.1.5)
archive-tar-minitar (>= 0.5.2)
sass (3.1.1)
- sprockets (2.0.0.beta.2)
- hike (~> 1.0)
- rack (~> 1.0)
- tilt (~> 1.0)
sqlite3 (1.3.3)
thor (0.14.6)
treetop (1.4.9)
polyglot (>= 0.3.1)
tzinfo (0.3.27)
- uglifier (0.5.1)
- execjs
- json
+ uglifier (0.5.4)
+ execjs (>= 0.3.0)
+ multi_json (>= 1.0.2)
PLATFORMS
ruby
DEPENDENCIES
coffee-script
+ ejs
+ execjs!
jquery-rails
- rails (= 3.1.0.beta1)
+ rails!
ruby-debug19
sass
+ sprockets!
sqlite3
tilt!
uglifier
View
@@ -1,4 +1,4 @@
-Copyright 2011 YOURNAME
+Copyright 2011 Ryan Fitzgerald
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
View
@@ -5,7 +5,7 @@ class Engine < ::Rails::Engine
config.autoload_paths << File.expand_path("../backbone-rails", __FILE__)
config.after_initialize do |app|
- app.assets.engines.register '.jst', Tilt::UnderscoreTemplate
+ # app.assets.register_engine '.jst', Tilt::UnderscoreTemplate
end
end
@@ -1,18 +0,0 @@
-require 'tilt/template'
-
-module Tilt
- class UnderscoreTemplate < Template
- self.default_mime_type = 'text/x-underscore-template'
-
- def initialize_engine
- require_template_library 'backbone-rails/underscore'
- end
-
- def prepare; end
-
- def evaluate(scope, locals, &block)
- Underscore.render(name, data)
- end
-
- end
-end
@@ -1,15 +0,0 @@
-class Underscore
- extend ActionView::Helpers::JavaScriptHelper
-
- JST_START = "(function(){"
- JST_END = "}).call(this);"
- NAMESPACE = "JST"
- SETUP_NAMESPACE = "this.#{NAMESPACE} = this.#{NAMESPACE} || {};"
-
- def self.render(name, data)
- template = "this.#{NAMESPACE}['#{name}'] = _.template(\"#{escape_javascript data}\");"
-
- [JST_START, SETUP_NAMESPACE, template, JST_END].join("\n")
- end
-
-end
@@ -12,12 +12,4 @@ def setup
test "underscore.js is found as an asset" do
assert_not_nil @app.assets["underscore"]
end
-
- test "jst extension is registered" do
- assert @app.assets.engines.extensions.include?(".jst")
- end
-
- test "jst extension is registered to UnderscoreTemplate" do
- assert_equal Tilt::UnderscoreTemplate, @app.assets.engines[".jst"]
- end
end
View
@@ -9,12 +9,3 @@
# Load support files
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
-FIXTURE_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "fixtures"))
-
-def fixture(path)
- IO.read(fixture_path(path))
-end
-
-def fixture_path(path)
- File.join(FIXTURE_ROOT, path)
-end
@@ -1,24 +0,0 @@
-require 'test_helper'
-require 'backbone-rails/tilt/underscore_template'
-
-class UnderscoreTemplateTest < Test::Unit::TestCase
- FIXTURE_ROOT = File.expand_path(File.join(File.dirname(__FILE__), "fixtures"))
-
- def fixture(path)
- IO.read(fixture_path(path))
- end
-
- def fixture_path(path)
- File.join(FIXTURE_ROOT, path)
- end
-
- def template_for(path)
- Tilt::UnderscoreTemplate.new(fixture_path(path))
- end
-
- def test_render_simple_jst
- compiled = template_for("hello.js.jst").evaluate(nil, nil)
-
- assert_equal "(function(){\nthis.JST = this.JST || {};\nthis.JST['hello'] = _.template(\"Hello <%= name %>\");\n}).call(this);", compiled
- end
-end
View
@@ -1,11 +0,0 @@
-require 'test_helper'
-require 'backbone-rails/underscore'
-
-class UnderscoreTest < ActiveSupport::TestCase
-
- test "render simple template" do
- result = Underscore.render("hello", "hello <%= name %>")
- assert_equal "(function(){\nthis.JST = this.JST || {};\nthis.JST['hello'] = _.template(\"hello <%= name %>\");\n}).call(this);", result
- end
-
-end

0 comments on commit 9d0f981

Please sign in to comment.