Class: UiChanged::WorkerBase

Inherits:
Object
  • Object
show all
Defined in:
app/workers/ui_changed/worker_base.rb

Direct Known Subclasses

Compare, CrawlControl, CrawlTest

Class Method Summary collapse

Class Method Details

.create_folders(path) ⇒ Object



18
19
20
21
22
23
# File 'app/workers/ui_changed/worker_base.rb', line 18

def create_folders(path)
  unless Dir.exists?(path)
    puts 'creating dir path: ' + path.to_s
    FileUtils.mkdir_p path
  end
end

.remove_folder_contents_or_create(path) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/workers/ui_changed/worker_base.rb', line 5

def remove_folder_contents_or_create(path)
  # does control/test directory exist?
  puts 'checking if dir exists: ' + path
  if Dir.exists?(path)
    path_contents = path + '*'
    puts 'removing directory contents of :' + path_contents
    FileUtils.rm_rf(Dir.glob(path_contents))
  else
    # create control/test folder
    create_folders(path)
  end
end