class Sprockets::Rails::Task - sprockets-rails-2.1.3 Documentation

# class Sprockets::Rails::Task

### Attributes

app[RW]
cache_path[W]

### Public Class Methods

new(app = nil) click to toggle source
Calls superclass method

    # File lib/sprockets/rails/task.rb, line 11
    def initialize(app = nil)
      self.app = app
      super()
    end

### Public Instance Methods

assets() click to toggle source
Calls superclass method

    # File lib/sprockets/rails/task.rb, line 32
    def assets
      if app
        app.config.assets.precompile
      else
        super
      end
    end

cache_path() click to toggle source

    # File lib/sprockets/rails/task.rb, line 40
    def cache_path
      if app
        "#{app.config.root}/tmp/cache/assets"
      else
        @cache_path
      end
    end

define() click to toggle source

    # File lib/sprockets/rails/task.rb, line 49
    def define
      namespace :assets do
        # 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|
          keep = Integer(args.keep || 2)
          with_logger do
            manifest.clean(keep)
          end
        end

        desc "Remove compiled assets"
        task :clobber => :environment do
          with_logger do
            manifest.clobber
            rm_rf cache_path if cache_path
          end
        end
      end
    end

environment() click to toggle source
Calls superclass method

    # File lib/sprockets/rails/task.rb, line 16
    def environment
      if app
        app.assets
      else
        super
      end
    end

output() click to toggle source
Calls superclass method

    # File lib/sprockets/rails/task.rb, line 24
    def output
      if app
        File.join(app.root, 'public', app.config.assets.prefix)
      else
        super
      end
    end