class ProxyTester::Actions::CreateDirectory

Attributes

fs_engine[R]
options[R]
path[R]

Public Class Methods

new(path, options = {}, fs_engine = FileUtils) click to toggle source
# File lib/proxy_tester/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

Public Instance Methods

run() click to toggle source
# File lib/proxy_tester/actions/create_directory.rb, line 17
def run
  if need_to_run? || options[:force] == true
    ProxyTester.ui_logger.warn "Creating directory \"#{path}\"."
    fs_engine.mkdir_p(path)
  else
    ProxyTester.ui_logger.warn "Directory \"#{path}\" already exists. Do not create it again!."
  end
end

Private Instance Methods

need_to_run?() click to toggle source
# File lib/proxy_tester/actions/create_directory.rb, line 28
def need_to_run?
  !::File.exists?(path)
end