sprockets-rails 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 34dd7537c5ed9dee4b17260193bc69074c771fa5
4
- data.tar.gz: ed01267c0b8ddb70be68e5ee283d5057f8357032
3
+ metadata.gz: d8df5417e91af9477da6beeceb415ae8b75481d3
4
+ data.tar.gz: 91005ca8206986ceaa780399d62b919a80fefcce
5
5
  SHA512:
6
- metadata.gz: 0a6258042fc29461c1386fa1239226d6f1357a4e8760d2481bbf6a26fbc9d13de5064e703502f41662cbcd39c441bc444e872e91a9699d491b6b1c580736f673
7
- data.tar.gz: ff8c7f7ead3abd74174fe67339a935227634dd77c9b65c8a86c82c4370ae1d9b9ef1b8f2355a53260256c19882d08e10518f61c2f0ad6707151e3e5758513b9e
6
+ metadata.gz: 85b55263f24cd3625b00fb0cb5bd1676c20936154318fec45cd5eb8c9c28091e61433097d1fa57465f3ee444cd3bff18f0475c518b23db3b456782309aa3fa0c
7
+ data.tar.gz: 50fa24117b9a42a736b17ab322485fc0e44f2f24dc6559abc785a385c696fdcd06c2ff46b2a915207a4bbbf6903fd6d39d9c36d6e8e50e346e6f83f46d1b037d
@@ -1,3 +1,4 @@
1
+ require 'sprockets/rails/version'
1
2
  if defined? Rails::Railtie
2
3
  require 'sprockets/railtie'
3
4
  end
@@ -21,19 +21,11 @@ module Sprockets
21
21
  Sprockets::Rails::Helper.raise_runtime_errors
22
22
  end
23
23
 
24
- class DependencyError < StandardError
25
- def initialize(path, dep)
26
- msg = "Asset depends on '#{dep}' to generate properly but has not declared the dependency\n"
27
- msg << "Please add: `//= depend_on_asset \"#{dep}\"` to '#{path}'"
28
- super msg
29
- end
30
- end
31
-
32
24
  class AssetFilteredError < StandardError
33
25
  def initialize(source)
34
26
  msg = "Asset filtered out and will not be served: " <<
35
- "add `config.assets.precompile += %w( #{source} )` " <<
36
- "to `config/application.rb` and restart your server"
27
+ "add `Rails.application.config.assets.precompile += %w( #{source} )` " <<
28
+ "to `config/initializers/assets.rb` and restart your server"
37
29
  super(msg)
38
30
  end
39
31
  end
@@ -71,7 +63,7 @@ module Sprockets
71
63
 
72
64
  def compute_asset_path(path, options = {})
73
65
  # Check if we are inside Sprockets context before calling check_dependencies!.
74
- check_dependencies!(path) if defined?(_dependency_assets)
66
+ check_dependencies!(path) if defined?(depend_on)
75
67
 
76
68
  if digest_path = asset_digest_path(path)
77
69
  path = digest_path if digest_assets
@@ -85,7 +77,7 @@ module Sprockets
85
77
  # Computes the full URL to a asset in the public directory. This
86
78
  # method checks for errors before returning path.
87
79
  def asset_path(source, options = {})
88
- check_errors_for(source)
80
+ check_errors_for(source, options)
89
81
  path_to_asset(source, options)
90
82
  end
91
83
  alias :path_to_asset_with_errors :asset_path
@@ -139,7 +131,7 @@ module Sprockets
139
131
 
140
132
  if options["debug"] != false && request_debug_assets?
141
133
  sources.map { |source|
142
- check_errors_for(source)
134
+ check_errors_for(source, :type => :javascript)
143
135
  if asset = lookup_asset_for_path(source, :type => :javascript)
144
136
  asset.to_a.map do |a|
145
137
  super(path_to_javascript(a.logical_path, :debug => true), options)
@@ -161,7 +153,7 @@ module Sprockets
161
153
  options = sources.extract_options!.stringify_keys
162
154
  if options["debug"] != false && request_debug_assets?
163
155
  sources.map { |source|
164
- check_errors_for(source)
156
+ check_errors_for(source, :type => :stylesheet)
165
157
  if asset = lookup_asset_for_path(source, :type => :stylesheet)
166
158
  asset.to_a.map do |a|
167
159
  super(path_to_stylesheet(a.logical_path, :debug => true), options)
@@ -177,21 +169,20 @@ module Sprockets
177
169
  end
178
170
 
179
171
  protected
180
- # Checks if the asset is included in the dependencies list.
172
+ # Ensures the asset is included in the dependencies list.
181
173
  def check_dependencies!(dep)
182
- if raise_runtime_errors && !_dependency_assets.detect { |asset| asset.include?(dep) }
183
- raise DependencyError.new(self.pathname, dep)
184
- end
174
+ depend_on(dep)
175
+ depend_on_asset(dep)
185
176
  end
186
177
 
187
178
  # Raise errors when source does not exist or is not in the precompiled list
188
- def check_errors_for(source)
179
+ def check_errors_for(source, options)
189
180
  source = source.to_s
190
181
  return source if !self.raise_runtime_errors || source.blank? || source =~ URI_REGEXP
191
- asset = lookup_asset_for_path(source)
182
+ asset = lookup_asset_for_path(source, options)
192
183
 
193
- if asset && asset_needs_precompile?(source, asset.pathname.to_s)
194
- raise AssetFilteredError.new(source)
184
+ if asset && asset_needs_precompile?(asset.logical_path, asset.pathname.to_s)
185
+ raise AssetFilteredError.new(asset.logical_path)
195
186
  end
196
187
  end
197
188
 
@@ -0,0 +1,5 @@
1
+ module Sprockets
2
+ module Rails
3
+ VERSION = "2.1.2"
4
+ end
5
+ end
@@ -69,16 +69,14 @@ module Sprockets
69
69
 
70
70
  # Configuration options that should invalidate
71
71
  # the Sprockets cache when changed.
72
- version_fragments = [
72
+ app.assets.version = [
73
+ app.assets.version,
73
74
  config.assets.version,
74
75
  config.action_controller.relative_url_root,
75
- config.action_controller.asset_host
76
+ config.action_controller.asset_host,
77
+ Sprockets::Rails::VERSION,
76
78
  ].compact.join('-')
77
79
 
78
- if version_fragments.present?
79
- app.assets.version += "-#{version_fragments}"
80
- end
81
-
82
80
  # Copy config.assets.paths to Sprockets
83
81
  config.assets.paths.each do |path|
84
82
  app.assets.append_path path
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Peek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-08 00:00:00.000000000 Z
11
+ date: 2014-04-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sprockets
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: railties
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '3.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '3.0'
69
83
  description:
70
84
  email: josh@joshpeek.com
71
85
  executables: []
@@ -79,6 +93,7 @@ files:
79
93
  - lib/sprockets/rails/legacy_asset_tag_helper.rb
80
94
  - lib/sprockets/rails/legacy_asset_url_helper.rb
81
95
  - lib/sprockets/rails/task.rb
96
+ - lib/sprockets/rails/version.rb
82
97
  - lib/sprockets/railtie.rb
83
98
  homepage: https://github.com/rails/sprockets-rails
84
99
  licenses: