Class: Sprockets::Rails::Task
- Inherits:
-
Rake::SprocketsTask
- Object
- Rake::SprocketsTask
- Sprockets::Rails::Task
- Defined in:
- lib/sprockets/rails/task.rb
Instance Attribute Summary collapse
-
#app ⇒ Object
Returns the value of attribute app.
Instance Method Summary collapse
- #assets ⇒ Object
- #define ⇒ Object
- #environment ⇒ Object
-
#initialize(app = nil) ⇒ Task
constructor
A new instance of Task.
- #manifest ⇒ Object
- #output ⇒ Object
Constructor Details
#initialize(app = nil) ⇒ Task
Returns a new instance of Task.
11 12 13 14 |
# File 'lib/sprockets/rails/task.rb', line 11 def initialize(app = nil) self.app = app super() end |
Instance Attribute Details
#app ⇒ Object
Returns the value of attribute app.
9 10 11 |
# File 'lib/sprockets/rails/task.rb', line 9 def app @app end |
Instance Method Details
#assets ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/sprockets/rails/task.rb', line 35 def assets if app app.config.assets.precompile else super end end |
#define ⇒ Object
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/sprockets/rails/task.rb', line 51 def define namespace :assets do %w( environment precompile clean clobber ).each do |task| Rake::Task[task].clear if Rake::Task.task_defined?(task) end # Override this task change the loaded dependencies desc "Load asset compile environment" task :environment do # Load full Rails environment by default Rake::Task['environment'].invoke end desc "Compile all the assets named in config.assets.precompile" task :precompile => :environment do with_logger do manifest.compile(assets) end end desc "Remove old compiled assets" task :clean, [:keep] => :environment do |t, args| with_logger do manifest.clean(Integer(args.keep || self.keep)) end end desc "Remove compiled assets" task :clobber => :environment do with_logger do manifest.clobber end end end end |
#environment ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/sprockets/rails/task.rb', line 16 def environment if app # Use initialized app.assets or force build an environment if # config.assets.compile is disabled app.assets || Sprockets::Railtie.build_environment(app) else super end end |
#manifest ⇒ Object
43 44 45 46 47 48 49 |
# File 'lib/sprockets/rails/task.rb', line 43 def manifest if app Sprockets::Manifest.new(index, output, app.config.assets.manifest) else super end end |
#output ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/sprockets/rails/task.rb', line 26 def output if app config = app.config File.join(config.paths['public'].first, config.assets.prefix) else super end end |