Module: FileHelper

Defined in:
lib/core/helpers/file_helper.rb

Overview

Utility to manage various directory functions

Instance Method Summary collapse

Instance Method Details

#files(dirname, glob = "**/*") ⇒ Object



13
14
15
16
17
18
19
20
# File 'lib/core/helpers/file_helper.rb', line 13

def files(dirname, glob = "**/*")
  files = []
  ConfDirHelper.get_conf_paths(dirname).each do |dir|
    find = "#{dir}#{glob}"
    files << Dir.glob(find).select { |f| File.file?(f) } if Dir.exist?(dir)
  end
  files.flatten.map { |f| File.absolute_path(f) }
end

#temp_dir(folder = SecureRandom.uuid) ⇒ Object



7
8
9
10
11
# File 'lib/core/helpers/file_helper.rb', line 7

def temp_dir(folder = SecureRandom.uuid)
  path = "/tmp/radial/#{folder}"
  FileUtils.mkdir_p path
  path
end