Sha256: 8fa13463e9b444f767b392af317a607efa82610082263317b35f258ab8ead7d3

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

#                                                                          
# File 'cleantask.rb' created on 19 feb 2008 at 19:33:03.                    
#
# See 'dokkit.rb' or +LICENSE+ for licence information.                      
#                                                                          
# (C) 2008 Andrea Fazzi <andrea.fazzi@alca.le.it> (and contributors). 
#                                                                          

require 'rake/clean'
require 'dokkit/dokkitlib'

module Dokkit
  class CleanTask < DokkitLib
    def initialize(model, namespace = 'clean')
      super(model, namespace)
    end
    
    private
    
    def pre_block_configuration
      @config.output_dir ||= Dokkit::DEFAULT_OUTPUT_DIR
      @config.cache_dir ||= Dokkit::DEFAULT_CACHE_DIR      
    end
    def define_dokkit_clean_output
      desc 'Remove output directory'
      dokkit_task :output do
        if File.exists?(@config.output_dir)
          @logger.info('Removing output directory')
          rm_rf(@config.output_dir, :verbose => false)
        end
      end
    end
    def define_dokkit_clean_cache
      desc 'Remove cache directory'
      dokkit_task :cache do
        if File.exists?(@model.cache.cache_dir)
          @logger.info('Removing cache directory')
          @model.cache.clean
        end
      end
    end
    def define_dokkit_clean_backup
      desc 'Remove backup files (invoke rake:clean)'
      dokkit_task :backup => ['rake:clean']
    end
    def define_dokkit_clean_all
      desc 'Clobber all generated output and cache'
      dokkit_task :all => [:output, :cache, :backup]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dokkit-0.3.0 lib/dokkit/cleantask.rb