Class: TestServer::Actions::CreateDirectory

Inherits:
Object
  • Object
show all
Defined in:
lib/test_server/actions/create_directory.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, options = {}, fs_engine = FileUtils) ⇒ CreateDirectory

Returns a new instance of CreateDirectory.



11
12
13
14
15
# File 'lib/test_server/actions/create_directory.rb', line 11

def initialize(path, options = {}, fs_engine = FileUtils)
  @path      =::File.expand_path(path)
  @options   = options
  @fs_engine = fs_engine
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
24
# File 'lib/test_server/actions/create_directory.rb', line 17

def run
  if need_to_run? || options[:force] == true
    TestServer.ui_logger.warn "Creating directory \"#{path}\"."
    fs_engine.mkdir_p(path)
  else
    TestServer.ui_logger.warn "Directory \"#{path}\" already exists. Do not create it again!."
  end
end