lib/wurfl/command/loader.rb in wurfl-1.2.0 vs lib/wurfl/command/loader.rb in wurfl-1.3.0
- old
+ new
@@ -10,43 +10,38 @@
def usage
puts "Usage: wurfltools.rb loader [-p -v -h -e patchfile] -f wurflfile"
puts " --file, -f (wurflfile): The master WURFL file to load."
puts " --extension, -e (patchfile): A patch file to extend the traits of the master WURLF file."
puts " --print, -p : Prints out handsets."
- puts " --verbose, -v : Verbose output."
puts " --help, -h : Prints this message."
puts " --database, -d (databasename): Makes a PStore database for quick loading of data with other tools."
puts " --load, -l (databasename): Loads handsets from a PStore database instead of XML file."
exit 1
end
def execute
print = false
insert = false
- verbose = false
wurflfile = nil
patchfile = nil
pstorefile = nil
pstoreload = false
begin
options = GetoptLong.new(
["-p","--print", GetoptLong::NO_ARGUMENT],
["-h","--help", GetoptLong::NO_ARGUMENT],
- ["-v","--verbose", GetoptLong::NO_ARGUMENT],
["-f","--file", GetoptLong::REQUIRED_ARGUMENT],
["-e","--extension", GetoptLong::REQUIRED_ARGUMENT],
["-d","--database", GetoptLong::REQUIRED_ARGUMENT],
["-l","--load", GetoptLong::REQUIRED_ARGUMENT]
)
options.each do |opt,arg|
case opt
when "-p"
print = true
- when "-v"
- verbose = true
when "-h"
usage
exit 1
when "-f"
wurflfile = arg
@@ -74,11 +69,11 @@
fallbacks = nil
if pstorefile && pstoreload
begin
puts "Loading data from #{pstorefile}"
- hands, fallbacks = load_wurfl_pstore(pstorefile)
+ hands = load_wurfl_pstore(pstorefile)
puts "Loaded"
rescue => err
STDERR.puts "Error: Cannot load PStore file."
STDERR.puts err.message
exit 1
@@ -91,39 +86,41 @@
end
starttime = Time.now
puts "Loading wurfl file #{wurflfile}"
- wurfll.verbose = verbose
-
- hands, fallbacks = wurfll.load_wurfl(wurflfile)
+ hands = wurfll.load_wurfl(wurflfile)
restime = Time.now - starttime
puts "Done loading wurfl. Load took #{restime} seconds."
if patchfile
starttime = Time.now
puts "Loading Patch file #{patchfile}"
- hands, fallbacks = wurfll.load_wurfl(patchfile)
+ hands = wurfll.load_wurfl(patchfile)
restime = Time.now - starttime
puts "Done loading patchfile. Load took #{restime} seconds."
end
end
if pstorefile && !pstoreload
begin
puts "Saving data into #{pstorefile}"
- save_wurfl_pstore(pstorefile, hands, fallbacks)
+ save_wurfl_pstore(pstorefile, hands)
puts "Saved"
rescue => err
STDERR.puts "Error: Cannot creat PStore file."
STDERR.puts err.message
end
end
if print
- wurfll.print_wurfl hands
+ hands.each do |key,value|
+ puts "********************************************\n\n"
+ puts "#{key}\n"
+ value.each { |key,value| puts "#{key} = #{value}" }
+ end
end
end
end