Sha256: 05c87d6dc99be096484ddc5f3c6190c20829d7446e9ed6cbf2648932aa3c0e10
Contents?: true
Size: 731 Bytes
Versions: 15
Compression:
Stored size: 731 Bytes
Contents
# encoding: utf-8 module LocalPac module Actions class CreateDirectory private attr_reader :fs_engine, :path, :options public def initialize(path, options = {}, fs_engine = FileUtils) @path =::File.expand_path(path) @options = options @fs_engine = fs_engine end def run if need_to_run? || options[:force] == true LocalPac.ui_logger.warn "Creating directory \"#{path}\"." fs_engine.mkdir_p(path) else LocalPac.ui_logger.warn "Directory \"#{path}\" already exists. Do not create it again!." end end private def need_to_run? !::File.exists?(path) end end end end
Version data entries
15 entries across 15 versions & 1 rubygems