Class: PhTools::Phls

Inherits:
Runner show all
Defined in:
lib/phls.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Runner

#initialize

Constructor Details

This class inherits a constructor from PhTools::Runner

Class Method Details

.aboutObject



11
12
13
# File 'lib/phls.rb', line 11

def self.about
  %(generates list of phtools friendly files)
end

Instance Method Details

#run!Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/phls.rb', line 15

def run!
  @dirs_to_scan.each do |dir|
    fmask = File.join(dir, @recursive ? '**' : '', "{#{@filemasks * ','}}")
    files = Dir.glob(fmask, File::FNM_CASEFOLD)
    files_sorted = files.sort_by(&:downcase)
    files_sorted.each { |f| output_file(PhFile.new(f)) if File.file?(f) }
  end
rescue SignalException
  PhTools.puts_error 'EXIT on user interrupt Ctrl-C'
  exit 1
rescue StandardError => e
  PhTools.puts_error "FATAL: #{e.message}", e
  exit 1
end