aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/sprockets
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/sprockets')
-rw-r--r--actionpack/lib/sprockets/assets.rake7
-rw-r--r--actionpack/lib/sprockets/helpers.rb3
-rw-r--r--actionpack/lib/sprockets/helpers/precompile_helper.rb13
-rw-r--r--actionpack/lib/sprockets/helpers/rails_helper.rb3
-rw-r--r--actionpack/lib/sprockets/railtie.rb5
5 files changed, 20 insertions, 11 deletions
diff --git a/actionpack/lib/sprockets/assets.rake b/actionpack/lib/sprockets/assets.rake
index a801050084..80c3d4d0b8 100644
--- a/actionpack/lib/sprockets/assets.rake
+++ b/actionpack/lib/sprockets/assets.rake
@@ -39,12 +39,13 @@ namespace :assets do
config = Rails.application.config
config.assets.compile = true
config.assets.digest = digest unless digest.nil?
-
config.assets.digests = {}
- env = Rails.application.assets
+ env = Rails.application.assets
+ env.context_class.send :include, ::Sprockets::Helpers::PrecompileHelper
+
target = File.join(Rails.public_path, config.assets.prefix)
- compiler = Sprockets::StaticCompiler.new(env,
+ compiler = Sprockets::StaticCompiler.new(env,
target,
config.assets.precompile,
:manifest_path => config.assets.manifest,
diff --git a/actionpack/lib/sprockets/helpers.rb b/actionpack/lib/sprockets/helpers.rb
index a952a55c5e..cd9c8f62e6 100644
--- a/actionpack/lib/sprockets/helpers.rb
+++ b/actionpack/lib/sprockets/helpers.rb
@@ -1,5 +1,6 @@
module Sprockets
module Helpers
- autoload :RailsHelper, "sprockets/helpers/rails_helper"
+ autoload :RailsHelper, "sprockets/helpers/rails_helper"
+ autoload :PrecompileHelper, "sprockets/helpers/precompile_helper"
end
end
diff --git a/actionpack/lib/sprockets/helpers/precompile_helper.rb b/actionpack/lib/sprockets/helpers/precompile_helper.rb
new file mode 100644
index 0000000000..ca7927f6fb
--- /dev/null
+++ b/actionpack/lib/sprockets/helpers/precompile_helper.rb
@@ -0,0 +1,13 @@
+module Sprockets
+ module Helpers
+ module PrecompileHelper
+ def controller
+ nil
+ end
+
+ def config
+ Rails.application.config.action_controller
+ end
+ end
+ end
+end
diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb
index e1d8fccf04..f866bc626e 100644
--- a/actionpack/lib/sprockets/helpers/rails_helper.rb
+++ b/actionpack/lib/sprockets/helpers/rails_helper.rb
@@ -8,9 +8,6 @@ module Sprockets
def asset_paths
@asset_paths ||= begin
- config = self.config if respond_to?(:config)
- config ||= Rails.application.config
- controller = self.controller if respond_to?(:controller)
paths = RailsHelper::AssetPaths.new(config, controller)
paths.asset_environment = asset_environment
paths.asset_digests = asset_digests
diff --git a/actionpack/lib/sprockets/railtie.rb b/actionpack/lib/sprockets/railtie.rb
index 2cf54b7777..e29612d320 100644
--- a/actionpack/lib/sprockets/railtie.rb
+++ b/actionpack/lib/sprockets/railtie.rb
@@ -43,10 +43,7 @@ module Sprockets
ActiveSupport.on_load(:action_view) do
include ::Sprockets::Helpers::RailsHelper
-
- app.assets.context_class.instance_eval do
- include ::Sprockets::Helpers::RailsHelper
- end
+ app.assets.context_class.send :include, ::Sprockets::Helpers::RailsHelper
end
end