Skip to content
This repository has been archived by the owner on Jun 10, 2018. It is now read-only.

Commit

Permalink
Add option for number of assets to keep
Browse files Browse the repository at this point in the history
Fixes #276
  • Loading branch information
josh committed Jan 10, 2012
1 parent 477c409 commit 1048813
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/rake/sprocketstask.rb
Expand Up @@ -49,6 +49,9 @@ def environment
#
attr_accessor :assets

# Number of old assets to keep.
attr_accessor :keep

# Logger to use during rake tasks. Defaults to using stderr.
#
# t.logger = Logger.new($stdout)
Expand Down Expand Up @@ -78,6 +81,7 @@ def initialize(name = :assets)
@environment = lambda { Sprockets::Environment.new(Dir.pwd) }
@logger = Logger.new($stderr)
@logger.level = Logger::INFO
@keep = 2

yield self if block_given?

Expand Down Expand Up @@ -105,7 +109,7 @@ def define
desc name == :assets ? "Clean old assets" : "Clean old #{name} assets"
task "clean_#{name}" do
with_logger do
manifest.clean
manifest.clean(keep)
end
end

Expand Down

0 comments on commit 1048813

Please sign in to comment.