Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Commit

Permalink
ConcatenatedAsset -> BundledAsset
Browse files Browse the repository at this point in the history
  • Loading branch information
sstephenson committed May 18, 2011
1 parent 45277e2 commit 4199996
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/sprockets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Sprockets
autoload :AssetPathname, "sprockets/asset_pathname"
autoload :CharsetNormalizer, "sprockets/charset_normalizer"
autoload :Compressor, "sprockets/compressor"
autoload :ConcatenatedAsset, "sprockets/concatenated_asset"
autoload :BundledAsset, "sprockets/bundled_asset"
autoload :ContentTypeMismatch, "sprockets/errors"
autoload :CircularDependencyError, "sprockets/errors"
autoload :Context, "sprockets/context"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
require 'time'

module Sprockets
class ConcatenatedAsset
class BundledAsset
attr_reader :logical_path, :pathname
attr_reader :content_type, :mtime, :length, :digest
attr_reader :_dependency_paths
Expand Down
4 changes: 2 additions & 2 deletions lib/sprockets/directive_processor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def prepare
# Implemented for Tilt#render.
#
# `context` is a `Context` instance with methods that allow you to
# access the environment and append to the concatenation. See
# `Context` for the complete API.
# access the environment and append to the bundle. See `Context`
# for the complete API.
def evaluate(context, locals, &block)
@context = context

Expand Down
4 changes: 2 additions & 2 deletions lib/sprockets/environment_index.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require 'sprockets/asset_pathname'
require 'sprockets/concatenated_asset'
require 'sprockets/bundled_asset'
require 'sprockets/errors'
require 'sprockets/static_asset'
require 'pathname'
Expand Down Expand Up @@ -111,7 +111,7 @@ def build_asset(logical_path, pathname, options)

if formats(extension).any?
logger.info "[Sprockets] #{logical_path} building"
asset = ConcatenatedAsset.new(self, logical_path, pathname, options)
asset = BundledAsset.new(self, logical_path, pathname, options)
else
asset = StaticAsset.new(self, logical_path, pathname)
end
Expand Down
10 changes: 5 additions & 5 deletions test/test_asset.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def setup
end
end

class ConcatenatedAssetTest < Sprockets::TestCase
class BundledAssetTest < Sprockets::TestCase
def setup
@env = Sprockets::Environment.new
@env.paths << fixture_path('asset')
Expand All @@ -103,7 +103,7 @@ def setup
include AssetTests

test "class" do
assert_kind_of Sprockets::ConcatenatedAsset, @asset
assert_kind_of Sprockets::BundledAsset, @asset
end

test "requiring the same file multiple times has no effect" do
Expand Down Expand Up @@ -134,12 +134,12 @@ def setup
asset("application.js").to_a.map(&:pathname)
end

test "concatenated asset body is just its own contents" do
test "bundled asset body is just its own contents" do
assert_equal "\ndocument.on('dom:loaded', function() {\n $('search').focus();\n});\n",
asset("application.js").body
end

test "concating joins files with blank line" do
test "bundling joins files with blank line" do
assert_equal "var Project = {\n find: function(id) {\n }\n};\nvar Users = {\n find: function(id) {\n }\n};\n\ndocument.on('dom:loaded', function() {\n $('search').focus();\n});\n",
asset("application.js").to_s
end
Expand Down Expand Up @@ -343,7 +343,7 @@ def setup
asset("constants.js").to_s
end

test "multiple charset defintions are stripped from css concatenation" do
test "multiple charset defintions are stripped from css bundle" do
assert_equal "@charset \"UTF-8\";\n.foo {}\n\n.bar {}\n", asset("charset.css").to_s
end

Expand Down
6 changes: 3 additions & 3 deletions test/test_environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ def self.test(name, &block)
end
end

test "find concatenated asset in environment" do
test "find bundled asset in environment" do
assert_equal "var Gallery = {};\n", @env["gallery.js"].to_s
end

test "find concatenated asset with absolute path environment" do
test "find bundled asset with absolute path environment" do
assert_equal "var Gallery = {};\n", @env[fixture_path("default/gallery.js")].to_s
end

Expand Down Expand Up @@ -314,7 +314,7 @@ def setup
assert_nil @env["gallery.css"]
end

test "concatenated asset is stale if its mtime is updated or deleted" do
test "bundled asset is stale if its mtime is updated or deleted" do
filename = File.join(fixture_path("default"), "tmp.js")

begin
Expand Down

0 comments on commit 4199996

Please sign in to comment.