Class: Genit::RootCleaner
- Inherits:
-
Object
- Object
- Genit::RootCleaner
- Defined in:
- lib/genit/project/root_cleaner.rb
Overview
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).
Instance Method Summary collapse
-
#clean ⇒ Object
Public: Clean the root directory.
-
#initialize(wd) ⇒ RootCleaner
constructor
Public: Constructor.
Constructor Details
#initialize(wd) ⇒ RootCleaner
Public: Constructor.
wd - The String working directory, where live the project.
15 16 17 |
# File 'lib/genit/project/root_cleaner.rb', line 15 def initialize wd @wd = wd end |
Instance Method Details
#clean ⇒ Object
Public: Clean the root directory.
Returns nothing.
22 23 24 25 26 27 28 |
# File 'lib/genit/project/root_cleaner.rb', line 22 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 |