Class: Readorder::Commands::Sort

Inherits:
Readorder::Command show all
Defined in:
lib/readorder/commands/sort.rb

Overview

Run an anlyzer to gather all the information and then output the filenames to stdout or to the output file

Instance Attribute Summary

Attributes inherited from Readorder::Command

#analyzer, #filelist, #options, #output

Instance Method Summary collapse

Methods inherited from Readorder::Command

#after, #before, command_name, #command_name, commands, #error, find, #get_physical?, inherited, #initialize, #logger, #results, #results_dbfile, #shutdown

Constructor Details

This class inherits a constructor from Readorder::Command

Instance Method Details

#runObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/readorder/commands/sort.rb', line 9

def run

  analyzer.collect_data
  analyzer.log_summary_report

  field = nil
  if get_physical? then
    logger.info "using first physical block number order"
    field = 'first_physical_block_number'
  else
    logger.info "using inode number order"
    field = 'inode_number'
  end

  analyzer.results.each_valid_by_field( field ) do |row|
    output.puts row['filename']
  end
end