Class: Perforce2Svn::Mapping::Analyzer

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/perforce2svn/mapping/analyzer.rb

Instance Method Summary collapse

Methods included from Logging

configure, log, #log

Constructor Details

#initialize(base_path) ⇒ Analyzer

Returns a new instance of Analyzer.



7
8
9
# File 'lib/perforce2svn/mapping/analyzer.rb', line 7

def initialize(base_path)
  @base_path = base_path
end

Instance Method Details

#check(commands) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/perforce2svn/mapping/analyzer.rb', line 11

def check(commands)
  # TODO: May want to make this more robust, like checking perforce paths and overlaps
  succeeded = true
  commands.each do |command|
    if command.respond_to? :live_path
      path = command.live_path
      if path !~ /^\//
        path = File.join(@base_path, path)
      end
      
      unless File.file? path
        log.error("(line #{command.line_number}) The live path doesn't exist: #{command.live_path}")
        succeeded = false
      end
    end
  end
  succeeded
end