Class: Wurfl::Command::Sanitycheck
- Inherits:
-
Wurfl::Command
- Object
- Wurfl::Command
- Wurfl::Command::Sanitycheck
- Defined in:
- lib/wurfl/command/sanitycheck.rb
Overview
A simple command line tool to make sure that a wurfl file properly parses. Used to make sure changes to Wurfl/Patch files are OK.
Instance Method Summary collapse
Instance Method Details
#execute ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/wurfl/command/sanitycheck.rb', line 6 def execute if ARGV.size != 1 puts "Must have the path of the wurfl file to check" exit 1 end lines = File.open(ARGV[0],"r").readlines curdev = nil c = 0 lines.each do |line| line = line.strip if line =~ /^(<d)evice.*[^\/]>$/ curdev = line elsif line =~ /^(<d)evice.*\/>$/ if curdev puts "#{c}:A device was not closed and we got a new device! #{curdev}" end curdev = nil elsif line =~ /^(<\/d)evice>$/ if curdev.nil? puts "#{c}:A closing device with no opening! #{curdev}" end curdev=nil end c += 1 end if curdev puts "The curent device was not closed #{curdev}" end puts "Done" end |