Sha256: f4ab5cbe4d50331ac1ae5da8ba80c775875905eb6d38bef36a11ecf0e03f1164
Contents?: true
Size: 885 Bytes
Versions: 1
Compression:
Stored size: 885 Bytes
Contents
require 'fileutils' module Middleman module Remover # Middleman Remover Extension class Extension < ::Middleman::Extension option :paths, [], 'List of remove files/directories paths' def initialize(app, options_hash = {}, &block) super paths = options.paths build_dir = app.build_dir extension = self app.after_build do extension.remove(paths, build_dir) end end def remove(paths, dir) paths.each do |path| full_path = File.join(dir, path) files = Dir.glob(full_path) if files.length > 0 FileUtils.rm_rf(files) app.logger.info "== middleman-remover: #{path} is removed ==" else app.logger.info "== middleman-remover: #{path} is not exist ==" end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
middleman-remover-1.0.1 | lib/middleman-remover/extension.rb |