turbo-sprockets-rails3 0.3.10 → 0.3.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTc3YmY4YjI3NjViN2M5NzEzY2E1OTk3MDU1ODY4NDFlNzdmNmEzOA==
4
+ MzQ3MTExMTMzYjYyMDhmMmQ3ZGQ4N2U3OGI3NjMwN2ZlMjNmMDIwZg==
5
5
  data.tar.gz: !binary |-
6
- Y2ZhOGNkMDAxZTViMTY2NTM3N2FiZjgyODBjMGRkYWM5MmMxNDljYQ==
7
- !binary "U0hBNTEy":
6
+ ODBhNjRiZTkwNDBjYzA4NDk0OTIyYTE1YjI5OTVjMjc2YzE3MjZiOQ==
7
+ SHA512:
8
8
  metadata.gz: !binary |-
9
- NGE3MjdjMmQ2NTg3YTVkNzBmOGMzNDFlOTcyZTY4ZTVhODE4YjBkNjI5MDdh
10
- MTVmZDc3OTBmMmI2NDY5YzVjNTM1NTAyYzBiYWVmMzIxNTc5ZDBlYTQzYmJm
11
- MjU5ZGRjNTQyYmNmMDU4NzY1NmRjNTVkZThlYzk4M2RkMGY4MTk=
9
+ ZWE0ZTljMTdmZGRjZGU1MGY4Y2FjYTZiY2UyYWQ0ZTViZWY2ZTFiMWViNjll
10
+ MjE5ZmUyODViYWIxY2Y4NGMzMjcxOGUzNTRiODI1NWI5NTgxNWY0NjcxNjI4
11
+ ZmMyNWQ3ODk4OTA0YzE0NzM3NDliMTU2MWRlMDMwZGJmYzA4MTc=
12
12
  data.tar.gz: !binary |-
13
- ZWE2ZDEwMTcyYTI4Y2NhNjE3MmJiMTBlZDY2MDBmZTFlOWJkYjk0ZDI4YWUz
14
- YzM1M2U0YmViOTNiMDlmOTAxODVkODFkYzUyYmQxOTlhYzhjOWQzMmEzY2E3
15
- NTczNDQ1YjRmYTI2ZGE0ODAyODk5MTNhMGU1MTU5MGQ2OTE1YmM=
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
- @required_assets = []
83
- required_assets_cache = {}
87
+ assets = []
88
+ cache = {}
84
89
 
85
- (context._required_paths + [pathname.to_s]).each do |path|
90
+ paths.each do |path|
86
91
  if path == self.pathname.to_s
87
- unless required_assets_cache[self]
88
- required_assets_cache[self] = true
89
- @required_assets << self
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 required_assets_cache[asset_dependency]
94
- required_assets_cache[asset_dependency] = true
95
- @required_assets << asset_dependency
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
- required_assets_cache.clear
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 engine processors except ERB to return unprocessed source file
11
+ # Remove all postprocessors and engines except ERB to return unprocessed source file
11
12
  allowed_engines = [Tilt::ERBTemplate]
12
- processors = attributes.processors - (attributes.engines - allowed_engines)
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 = attributes.processors - (attributes.engines - allowed_engines)
24
+ processors = preprocessors + (allowed_engines & attributes.engines)
24
25
  @source = context.evaluate(pathname, :processors => processors)
25
26
  end
26
27
 
@@ -1,3 +1,3 @@
1
1
  module TurboSprockets
2
- VERSION = "0.3.10"
2
+ VERSION = "0.3.11"
3
3
  end
@@ -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.10
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-09-12 00:00:00.000000000 Z
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.0.0
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.0.0
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.0.5
111
+ rubygems_version: 2.1.11
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Supercharge your Rails 3 asset pipeline