Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove String template

  • Loading branch information...
commit c6047e22b671b9b8e527de5f56a60b282125605f 1 parent 0899459
@josh josh authored
View
2  lib/sprockets.rb
@@ -28,7 +28,6 @@ module Sprockets
autoload :SassImporter, "sprockets/sass_importer"
autoload :SassTemplate, "sprockets/sass_template"
autoload :ScssTemplate, "sprockets/scss_template"
- autoload :StringTemplate, "sprockets/string_template"
# Internal utilities
autoload :ArgumentError, "sprockets/errors"
@@ -106,5 +105,4 @@ module Cache
# Other
register_engine '.erb', ERBTemplate
- register_engine '.str', StringTemplate
end
View
17 lib/sprockets/string_template.rb
@@ -1,17 +0,0 @@
-module Sprockets
- class StringTemplate < Template
- def prepare
- hash = "TILT#{data.hash.abs}"
- @code = "<<#{hash}.chomp\n#{data}\n#{hash}"
- end
-
- def precompiled_template(locals)
- @code
- end
-
- def precompiled(locals)
- source, offset = super
- [source, offset + 1]
- end
- end
-end
View
2  test/fixtures/asset/multipleengine.js
@@ -1 +1 @@
-// =require "users.js.erb.str"
+// =require "users.js.erb"
View
2  test/fixtures/asset/unknownexts.min.js
@@ -1,2 +1,2 @@
-// =require "users.js.erb.str"
+// =require "users.js.erb"
// =require "jquery.tmpl.min"
View
0  test/fixtures/asset/users.js.erb.str → test/fixtures/asset/users.js.erb
File renamed without changes
View
0  test/fixtures/engines/moo.js.str → test/fixtures/engines/moo.js
File renamed without changes
View
19 test/test_engines.rb
@@ -39,25 +39,6 @@ def teardown
assert_equal 'application/javascript', asset.content_type
end
- test "overriding an engine globally" do
- env1 = new_environment
- assert_equal %(console.log("Moo, #{RUBY_VERSION}");\n), env1["moo.js"].to_s
-
- Sprockets.register_engine ".str", StringTemplate
- env2 = new_environment
- assert_equal %(console.log("Moo, moo");\n), env2["moo.js"].to_s
- end
-
- test "overriding an engine in an environment" do
- env1 = new_environment
- env2 = new_environment
-
- env1.register_engine ".str", StringTemplate
- assert_equal %(console.log("Moo, moo");\n), env1["moo.js"].to_s
-
- assert_equal %(console.log("Moo, #{RUBY_VERSION}");\n), env2["moo.js"].to_s
- end
-
def new_environment
Sprockets::Environment.new.tap do |env|
env.append_path(fixture_path('engines'))
View
12 test/test_environment.rb
@@ -35,13 +35,13 @@ def self.test(name, &block)
end
test "extensions" do
- ["coffee", "erb", "less", "sass", "scss", "str", "css", "js"].each do |ext|
+ ["coffee", "erb", "less", "sass", "scss", "css", "js"].each do |ext|
assert @env.extensions.to_a.include?(".#{ext}"), "'.#{ext}' not in #{@env.extensions.inspect}"
end
end
test "engine extensions" do
- ["coffee", "erb", "less", "sass", "scss", "str"].each do |ext|
+ ["coffee", "erb", "less", "sass", "scss"].each do |ext|
assert @env.engine_extensions.include?(".#{ext}")
end
["css", "js"].each do |ext|
@@ -53,7 +53,7 @@ def self.test(name, &block)
["css", "js"].each do |ext|
assert @env.format_extensions.include?(".#{ext}")
end
- ["coffee", "erb", "less", "sass", "scss", "str"].each do |ext|
+ ["coffee", "erb", "less", "sass", "scss"].each do |ext|
assert !@env.format_extensions.include?(".#{ext}")
end
end
@@ -551,7 +551,7 @@ def foo; end
assert !@env.engines[".foo"]
assert !@env.extensions.include?(".foo")
- @env.register_engine ".foo", Sprockets::StringTemplate
+ @env.register_engine ".foo", Sprockets::ERBTemplate
assert @env.engines[".foo"]
assert @env.extensions.include?(".foo")
@@ -564,7 +564,7 @@ def foo; end
assert_nil e1.engines[".foo"]
assert_nil e2.engines[".foo"]
- e1.register_engine ".foo", Sprockets::StringTemplate
+ e1.register_engine ".foo", Sprockets::ERBTemplate
assert e1.engines[".foo"]
assert_nil e2.engines[".foo"]
@@ -647,7 +647,7 @@ def setup
assert_nil env.engines[".foo"]
assert_nil index.engines[".foo"]
- env.register_engine ".foo", Sprockets::StringTemplate
+ env.register_engine ".foo", Sprockets::ERBTemplate
assert env.engines[".foo"]
assert_nil index.engines[".foo"]
Please sign in to comment.
Something went wrong with that request. Please try again.