Class: Perforce2Svn::Mapping::MappingFile

Inherits:
Object
  • Object
show all
Defined in:
lib/perforce2svn/mapping/mapping_file.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mapping_file, options) ⇒ MappingFile

Returns a new instance of MappingFile.



31
32
33
34
35
36
37
38
# File 'lib/perforce2svn/mapping/mapping_file.rb', line 31

def initialize(mapping_file, options)
  load_mapping_file(mapping_file, options)
  analyze(mapping_file)

  if options[:analysis_only]
    exit 0
  end
end

Instance Attribute Details

#authorObject (readonly)

Returns the value of attribute author.



29
30
31
# File 'lib/perforce2svn/mapping/mapping_file.rb', line 29

def author
  @author
end

#commandsObject (readonly)

Returns the value of attribute commands.



29
30
31
# File 'lib/perforce2svn/mapping/mapping_file.rb', line 29

def commands
  @commands
end

#mappingsObject (readonly)

Returns the value of attribute mappings.



29
30
31
# File 'lib/perforce2svn/mapping/mapping_file.rb', line 29

def mappings
  @mappings
end

#messageObject (readonly)

Returns the value of attribute message.



29
30
31
# File 'lib/perforce2svn/mapping/mapping_file.rb', line 29

def message
  @message
end

Class Method Details

.help_fileObject



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

def self.help_file
  map_file = File.join(File.dirname(__FILE__), 'help.txt')
  contents = ""
  color = Choosy::Printing::Color.new
  File.open(map_file, 'r') do |file|
    file.each_line do |line|
      contents << if line =~ /^#/
                    color.blue(line)
                  elsif line =~ /^([\w-]+)(.*)/
                    color.green($1) + $2 + "\n"
                  else
                    line
                  end
     end
  end
          
  contents
end