class Anamo::Fstree::Thor

Public Instance Methods

exclusions() click to toggle source
# File lib/anamo/fstree/thor.rb, line 215
def exclusions
  if defined? @exclusions
    @exclusions
  else
    return [
      '/proc',
      '/tmp',
      '/dev',
      '/run'
    ]
  end
end
exec() click to toggle source
# File lib/anamo/fstree/thor.rb, line 154
def exec

  inspect
  send

end
inspect() click to toggle source
# File lib/anamo/fstree/thor.rb, line 165
def inspect

  FileUtils.rm_rf temp_folder
  FileUtils.mkdir_p temp_folder

  idx = 0

  paths.each do |path, depth|
    traverser = Traverser.new(path, Writer.new(temp_folder, idx, path), depth, exclusions)
    traverser.compute
    idx = idx + 1
  end

end
paths() click to toggle source
# File lib/anamo/fstree/thor.rb, line 201
def paths
  if defined? @paths
    @paths
  else
    return {
      '/' => 2
    }
  end
end
send() click to toggle source
# File lib/anamo/fstree/thor.rb, line 184
def send

  files = {}
  Dir["#{temp_folder}/*"].each do |file|
    files[File.basename(file, '.*')] = UploadIO.new(File.new(file), "application/gzip", File.basename(file))
  end

  ::Anamo::Api.new.post_fstree files

end
set_exclusions(paths) click to toggle source
# File lib/anamo/fstree/thor.rb, line 211
def set_exclusions paths
  @exclusions = paths
end
set_paths(paths) click to toggle source
# File lib/anamo/fstree/thor.rb, line 197
def set_paths paths
  @paths = paths
end

Private Instance Methods

temp_folder() click to toggle source
# File lib/anamo/fstree/thor.rb, line 232
def temp_folder
  "/tmp/anamo/fstree"
end