turbo-sprockets-rails3 0.3.10 → 0.3.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +9 -9
- data/lib/sprockets/asset_with_dependencies.rb +15 -11
- data/lib/sprockets/unprocessed_asset.rb +4 -3
- data/lib/turbo-sprockets/version.rb +1 -1
- data/test/assets_test.rb +12 -0
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzQ3MTExMTMzYjYyMDhmMmQ3ZGQ4N2U3OGI3NjMwN2ZlMjNmMDIwZg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
7
|
-
|
6
|
+
ODBhNjRiZTkwNDBjYzA4NDk0OTIyYTE1YjI5OTVjMjc2YzE3MjZiOQ==
|
7
|
+
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZWE0ZTljMTdmZGRjZGU1MGY4Y2FjYTZiY2UyYWQ0ZTViZWY2ZTFiMWViNjll
|
10
|
+
MjE5ZmUyODViYWIxY2Y4NGMzMjcxOGUzNTRiODI1NWI5NTgxNWY0NjcxNjI4
|
11
|
+
ZmMyNWQ3ODk4OTA0YzE0NzM3NDliMTU2MWRlMDMwZGJmYzA4MTc=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjBmOTMwNWNhNzI4NjI0YjdiM2Y3Nzk4ODViOTRjMmM5YmViMzA5NWVhNmZi
|
14
|
+
NTkwMmViYmEyOGEyM2QzNGVjN2I5ZmZkNzM1OTEwNzg1OWMwODhlYjJiZGVh
|
15
|
+
NTI1YzliZGY0OTUyNTFhNzhlZGM2NjVhNDM4ZmM2MWUxNmI3NTU=
|
@@ -78,28 +78,32 @@ module Sprockets
|
|
78
78
|
|
79
79
|
private
|
80
80
|
def build_required_assets(environment, context, asset_options = {})
|
81
|
+
@required_assets = resolve_dependencies(environment, context._required_paths + [pathname.to_s], asset_options) -
|
82
|
+
resolve_dependencies(environment, context._stubbed_assets.to_a, asset_options)
|
83
|
+
end
|
84
|
+
|
85
|
+
def resolve_dependencies(environment, paths, asset_options)
|
81
86
|
asset_options[:bundle] = false
|
82
|
-
|
83
|
-
|
87
|
+
assets = []
|
88
|
+
cache = {}
|
84
89
|
|
85
|
-
|
90
|
+
paths.each do |path|
|
86
91
|
if path == self.pathname.to_s
|
87
|
-
unless
|
88
|
-
|
89
|
-
|
92
|
+
unless cache[self]
|
93
|
+
cache[self] = true
|
94
|
+
assets << self
|
90
95
|
end
|
91
96
|
elsif asset = environment.find_asset(path, asset_options)
|
92
97
|
asset.required_assets.each do |asset_dependency|
|
93
|
-
unless
|
94
|
-
|
95
|
-
|
98
|
+
unless cache[asset_dependency]
|
99
|
+
cache[asset_dependency] = true
|
100
|
+
assets << asset_dependency
|
96
101
|
end
|
97
102
|
end
|
98
103
|
end
|
99
104
|
end
|
100
105
|
|
101
|
-
|
102
|
-
required_assets_cache = nil
|
106
|
+
assets
|
103
107
|
end
|
104
108
|
|
105
109
|
def build_dependency_paths(environment, context, asset_options = {})
|
@@ -6,10 +6,11 @@ module Sprockets
|
|
6
6
|
@environment = environment
|
7
7
|
context = environment.context_class.new(environment, logical_path, pathname)
|
8
8
|
attributes = environment.attributes_for(pathname)
|
9
|
+
preprocessors = environment.preprocessors(content_type)
|
9
10
|
|
10
|
-
# Remove all
|
11
|
+
# Remove all postprocessors and engines except ERB to return unprocessed source file
|
11
12
|
allowed_engines = [Tilt::ERBTemplate]
|
12
|
-
processors =
|
13
|
+
processors = preprocessors + (allowed_engines & attributes.engines)
|
13
14
|
|
14
15
|
@source = context.evaluate(pathname, :processors => processors)
|
15
16
|
|
@@ -20,7 +21,7 @@ module Sprockets
|
|
20
21
|
allowed_engines << Sass::Rails::ScssTemplate if defined?(Sass::Rails::ScssTemplate)
|
21
22
|
allowed_engines << Sass::Rails::SassTemplate if defined?(Sass::Rails::SassTemplate)
|
22
23
|
allowed_engines << Less::Rails::LessTemplate if defined?(Less::Rails::LessTemplate)
|
23
|
-
processors =
|
24
|
+
processors = preprocessors + (allowed_engines & attributes.engines)
|
24
25
|
@source = context.evaluate(pathname, :processors => processors)
|
25
26
|
end
|
26
27
|
|
data/test/assets_test.rb
CHANGED
@@ -39,6 +39,18 @@ module ApplicationTests
|
|
39
39
|
assert !File.exists?(filename), "#{filename} does exist"
|
40
40
|
end
|
41
41
|
|
42
|
+
test "assets support stub" do
|
43
|
+
app_file "app/assets/javascripts/application.js", "//= require jquery\n//= require foo\n//= stub frameworks"
|
44
|
+
app_file "app/assets/javascripts/jquery.js", "jQuery = 1;"
|
45
|
+
app_file "app/assets/javascripts/frameworks.js", "//= require jquery"
|
46
|
+
app_file "app/assets/javascripts/foo.js", "foo = 1;"
|
47
|
+
|
48
|
+
require "#{app_path}/config/environment"
|
49
|
+
|
50
|
+
get "/assets/application.js"
|
51
|
+
assert_equal "foo = 1;", last_response.body.strip
|
52
|
+
end
|
53
|
+
|
42
54
|
test "assets routes have higher priority" do
|
43
55
|
app_file "app/assets/javascripts/demo.js.erb", "a = <%= image_path('rails.png').inspect %>;"
|
44
56
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turbo-sprockets-rails3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Broadbent
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sprockets
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.
|
19
|
+
version: 2.2.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 2.
|
26
|
+
version: 2.2.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: railties
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -108,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
version: '0'
|
109
109
|
requirements: []
|
110
110
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.
|
111
|
+
rubygems_version: 2.1.11
|
112
112
|
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: Supercharge your Rails 3 asset pipeline
|