Sha256: aed167cb4d07fca9cb0c607f136c1d380c7e5f7e10f15122efbeba12edd98bae

Contents?: true

Size: 605 Bytes

Versions: 2

Compression:

Stored size: 605 Bytes

Contents

class DirectoryCreator
    def self.create_directories(directories, delete_if_exists = false)
        directories.each do |dir|
            create_directory(dir, delete_if_exists)
        end
    end

    private

    def self.create_directory(dir, delete_if_exists)
        if Dir.exist?(dir)
            if delete_if_exists
                FileUtils.rm_rf(dir)
                Solara.logger.debug("🧹 Deleted directory: #{dir}")
                Dir.mkdir(dir)
            end
        else
            Dir.mkdir(dir)
        end
        Solara.logger.debug("✨  Created directory: #{dir}")
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solara-0.2.0 solara/lib/core/scripts/directory_creator.rb
solara-0.1.0 solara/lib/core/scripts/directory_creator.rb