Sha256: 80a89384dda329fab2ebbd96da6bda5b7f83b523d00889b3972bd94c9c26b9f2

Contents?: true

Size: 707 Bytes

Versions: 2

Compression:

Stored size: 707 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'fileutils'

module Genit

  # My responsability is to clean the root directory before a
  # compilation. I have to keep alive some files (.genit, config) and
  # some folders (src/, public/, etc).
  class RootCleaner

    # Public: Constructor.
    #
    # wd - The String working directory, where live the project.
    def initialize wd
      @wd = wd
    end

    # Public: Clean the root directory.
    #
    # Returns nothing.
    def clean
      Dir.foreach(@wd) do |file|
        next if file.start_with?('.') or (file == "config")
        filename = File.join(@wd, file)
        FileUtils.remove_file(filename) if File.file?(filename)
      end
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
genit-2.1 lib/genit/project/root_cleaner.rb
genit-2.0 lib/genit/project/root_cleaner.rb