Sha256: 84633b340265f3c17e4a040674c4dc41a647acc23697cdbcb40348d8d6012a50

Contents?: true

Size: 1.55 KB

Versions: 12

Compression:

Stored size: 1.55 KB

Contents

#!/usr/bin/env ruby
require 'pathname'

root = Pathname.new(__FILE__).realpath.parent.parent
$:.unshift root.join('lib') if $0 == __FILE__

require 'oddb2xml/version'
require 'oddb2xml/compare'
require 'optimist'
    DEFAULTSx = {
      :components => ["PRODUCTS", "LIMITATIONS", "ITEMS",],
      :fields_to_ignore => ['COMP', 'DOSAGE_FORMF', 'MEASUREF'],
      :fields_as_floats => [ 'PEXT', 'PEXF', 'PPUB' ],
      :min_diff_for_floats => 0.01,
      :case_insensitive => true,
    }

@opts = Optimist::options(ARGV) do
  version "#$0 ver.#{Oddb2xml::VERSION}"
  banner <<-EOS
  Usage:
  compare_v5 [option] first_v5_xml second_v5_xml
EOS
  opt :components,          "components to compare", :default => Oddb2xml::CompareV5::DEFAULTS[:components]
  opt :fields_as_floats,    "Fields that should be compared as floats", :default => Oddb2xml::CompareV5::DEFAULTS[:fields_as_floats]
  opt :fields_to_ignore,    "Ignore these fields", :default => Oddb2xml::CompareV5::DEFAULTS[:fields_to_ignore]
  opt :min_diff_for_floats, "Minimal difference when comparing floats", :default => Oddb2xml::CompareV5::DEFAULTS[:min_diff_for_floats]
  opt :case_insensitive,    "case_insensitive comparison", :default => Oddb2xml::CompareV5::DEFAULTS[:case_insensitive]
end
$stdout.sync = false

args = ARGV
if args.size != 2
  puts "you must pass exactly two  existing files. Not #{args}"
  exit 2
end

startTime = Time.now
result = Oddb2xml::CompareV5.new(ARGV.first, ARGV.last, @opts).compare
diff = (Time.now-startTime).to_i
puts "#{Time.now.strftime("%H:%M:%S")}: #{__FILE__} done. Took #{diff} seconds"

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
oddb2xml-2.7.1 bin/compare_v5
oddb2xml-2.7.0 bin/compare_v5
oddb2xml-2.6.9 bin/compare_v5
oddb2xml-2.6.8 bin/compare_v5
oddb2xml-2.6.7 bin/compare_v5
oddb2xml-2.6.6 bin/compare_v5
oddb2xml-2.6.5 bin/compare_v5
oddb2xml-2.6.4 bin/compare_v5
oddb2xml-2.6.3 bin/compare_v5
oddb2xml-2.6.2 bin/compare_v5
oddb2xml-2.6.1 bin/compare_v5
oddb2xml-2.6.0 bin/compare_v5