class Genit::RootCleaner

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).

Public Class Methods

new(wd) click to toggle source

Public: Constructor.

wd - The String working directory, where live the project.

# File lib/genit/project/root_cleaner.rb, line 14
def initialize wd
  @wd = wd
end

Public Instance Methods

clean() click to toggle source

Public: Clean the root directory.

Returns nothing.

# File lib/genit/project/root_cleaner.rb, line 21
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