File tree Expand file tree Collapse file tree 2 files changed +40
-8
lines changed Expand file tree Collapse file tree 2 files changed +40
-8
lines changed Original file line number Diff line number Diff line change 5
5
module Sprockets
6
6
module Rails
7
7
class Task < Rake ::SprocketsTask
8
- attr_accessor :cache_path
8
+ attr_accessor :app
9
+
10
+ def initialize ( app = nil )
11
+ self . app = app
12
+ super ( )
13
+ end
14
+
15
+ def environment
16
+ if app
17
+ app . assets
18
+ else
19
+ super
20
+ end
21
+ end
22
+
23
+ def output
24
+ if app
25
+ File . join ( app . root , 'public' , app . config . assets . prefix )
26
+ else
27
+ super
28
+ end
29
+ end
30
+
31
+ def assets
32
+ if app
33
+ app . config . assets . precompile
34
+ else
35
+ super
36
+ end
37
+ end
38
+
39
+ def cache_path
40
+ if app
41
+ "#{ app . config . root } /tmp/cache/assets"
42
+ else
43
+ @cache_path
44
+ end
45
+ end
46
+ attr_writer :cache_path
9
47
10
48
def define
11
49
namespace :assets do
Original file line number Diff line number Diff line change @@ -58,13 +58,7 @@ def configure(&block)
58
58
59
59
rake_tasks do |app |
60
60
require 'sprockets/rails/task'
61
-
62
- Sprockets ::Rails ::Task . new do |t |
63
- t . environment = lambda { app . assets }
64
- t . output = File . join ( app . root , 'public' , app . config . assets . prefix )
65
- t . assets = app . config . assets . precompile
66
- t . cache_path = "#{ app . config . root } /tmp/cache/assets"
67
- end
61
+ Sprockets ::Rails ::Task . new ( app )
68
62
end
69
63
70
64
config . after_initialize do |app |
You can’t perform that action at this time.
0 commit comments