#!/usr/bin/env ruby require 'pathname' root = Pathname.new(__FILE__).realpath.parent.parent $:.unshift root.join('lib') if $0 == __FILE__ require 'optparse' require 'mechanize' require 'oddb2xml' require 'oddb2xml/options' options = Oddb2xml::Options.new args = ARGV.dup begin options.parser.parse!(args) rescue OptionParser::MissingArgument, OptionParser::InvalidArgument, OptionParser::InvalidOption puts Oddb2xml::Options.help exit end opts = options.opts if args.size > 0 puts "Please remove unused parameters #{args}" exit 2 end # TEMP if path = args.first opts[:transfer_dat] = path end startTime = Time.now ui = Oddb2xml::Cli.new(opts) begin if opts[:format] == :xml opts[:ean14] = true # force end #puts opts if opts[:debug] if RUBY_VERSION.to_f < 1.9 message = <<-MES Once you find some time, please upgrade your Ruby to 1.9.3 ;) then you will not see anymore warnings MES warn message end ui.run rescue Interrupt exit end diff = (Time.now-startTime).to_i puts "#{Time.now}: #{__LINE__} done. Took #{diff} seconds"; $stdout.sync