Skip to content

Commit 60f032e

Browse files
authored
Merge pull request #510 from skipkayhil/rm-legacy-conditions
Remove legacy conditions
2 parents d933dc1 + 05e40aa commit 60f032e

File tree

3 files changed

+8
-28
lines changed

3 files changed

+8
-28
lines changed

lib/sprockets/rails/helper.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ def compute_asset_path(path, options = {})
8989
message << "To bypass the asset pipeline and preserve this behavior,\n"
9090
message << "use the `skip_pipeline: true` option.\n"
9191

92-
call_stack = Kernel.respond_to?(:caller_locations) && ::Rails::VERSION::MAJOR >= 5 ? caller_locations : caller
93-
ActiveSupport::Deprecation.warn(message, call_stack)
92+
ActiveSupport::Deprecation.warn(message, caller_locations)
9493
end
9594
super
9695
end

lib/sprockets/rails/route_wrapper.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,13 @@
11
module Sprockets
22
module Rails
33
module RouteWrapper
4-
54
def internal_assets_path?
65
path =~ %r{\A#{self.class.assets_prefix}\z}
76
end
87

98
def internal?
109
super || internal_assets_path?
1110
end
12-
13-
def self.included(klass)
14-
klass.class_eval do
15-
def internal_with_sprockets?
16-
internal_without_sprockets? || internal_assets_path?
17-
end
18-
alias_method_chain :internal?, :sprockets
19-
end
20-
end
2111
end
2212
end
2313
end

lib/sprockets/railtie.rb

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,17 +53,6 @@ def precompiled_assets(clear_cache = false)
5353
@precompiled_assets ||= assets_manifest.find(config.assets.precompile).map(&:logical_path).to_set
5454
end
5555
end
56-
57-
class Engine < Railtie
58-
# Skip defining append_assets_path on Rails <= 4.2
59-
unless initializers.find { |init| init.name == :append_assets_path }
60-
initializer :append_assets_path, :group => :all do |app|
61-
app.config.assets.paths.unshift(*paths["vendor/assets"].existent_directories)
62-
app.config.assets.paths.unshift(*paths["lib/assets"].existent_directories)
63-
app.config.assets.paths.unshift(*paths["app/assets"].existent_directories)
64-
end
65-
end
66-
end
6756
end
6857

6958
module Sprockets
@@ -96,6 +85,12 @@ def configure(&block)
9685
end
9786
end
9887

88+
::Rails::Engine.initializer :append_assets_path, :group => :all do |app|
89+
app.config.assets.paths.unshift(*paths["vendor/assets"].existent_directories)
90+
app.config.assets.paths.unshift(*paths["lib/assets"].existent_directories)
91+
app.config.assets.paths.unshift(*paths["app/assets"].existent_directories)
92+
end
93+
9994
config.assets = OrderedOptions.new
10095
config.assets._blocks = []
10196
config.assets.paths = []
@@ -237,11 +232,7 @@ def self.build_manifest(app)
237232
ActionDispatch::Routing::RouteWrapper.class_eval do
238233
class_attribute :assets_prefix
239234

240-
if defined?(prepend) && ::Rails.version >= '4'
241-
prepend Sprockets::Rails::RouteWrapper
242-
else
243-
include Sprockets::Rails::RouteWrapper
244-
end
235+
prepend Sprockets::Rails::RouteWrapper
245236

246237
self.assets_prefix = config.assets.prefix
247238
end

0 commit comments

Comments
 (0)