Class: Middleman::Remover::Extension
- Inherits:
-
Extension
- Object
- Extension
- Middleman::Remover::Extension
- Defined in:
- lib/middleman-remover/extension.rb
Overview
Middleman Remover Extension
Instance Method Summary collapse
-
#initialize(app, options_hash = {}, &block) ⇒ Extension
constructor
A new instance of Extension.
- #remove(paths, dir) ⇒ Object
Constructor Details
#initialize(app, options_hash = {}, &block) ⇒ Extension
Returns a new instance of Extension.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/middleman-remover/extension.rb', line 9 def initialize(app, = {}, &block) super paths = .paths build_dir = app.config.build_dir extension = self app.after_build do extension.remove(paths, build_dir) end end |
Instance Method Details
#remove(paths, dir) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/middleman-remover/extension.rb', line 20 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 |