Class: Avm::Tools::Runner::Files::Format

Inherits:
Object
  • Object
show all
Defined in:
lib/avm/tools/runner/files/format.rb

Instance Method Summary collapse

Instance Method Details

#dirty_filesObject



35
36
37
# File 'lib/avm/tools/runner/files/format.rb', line 35

def dirty_files
  scm.dirty_files.map { |f| scm.root_path.join(f.path) }.select(&:exist?).map(&:to_s)
end

#formatter_optionsObject



25
26
27
28
29
# File 'lib/avm/tools/runner/files/format.rb', line 25

def formatter_options
  { ::Avm::FileFormats::SearchFormatter::OPTION_APPLY => parsed.apply?,
    ::Avm::FileFormats::SearchFormatter::OPTION_RECURSIVE => !parsed.no_recursive?,
    ::Avm::FileFormats::SearchFormatter::OPTION_VERBOSE => parsed.verbose? }
end

#runObject



21
22
23
# File 'lib/avm/tools/runner/files/format.rb', line 21

def run
  ::Avm::FileFormats::SearchFormatter.new(source_paths, formatter_options).run
end

#scmObject



31
32
33
# File 'lib/avm/tools/runner/files/format.rb', line 31

def scm
  @scm ||= ::Avm::Registry.scms.detect('.')
end

#source_pathsObject



39
40
41
42
43
44
45
# File 'lib/avm/tools/runner/files/format.rb', line 39

def source_paths
  if parsed.dirty?
    parsed.paths + dirty_files
  else
    parsed.paths.if_present(%w[.])
  end
end