Sha256: 1643dce76c94ac7d49544c3b325c9e0bbb30b948bab3feb8e37e38651baaab58

Contents?: true

Size: 1.47 KB

Versions: 24

Compression:

Stored size: 1.47 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"
DEFAULTS_X = {
  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

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

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
oddb2xml-2.9.5 bin/compare_v5
oddb2xml-2.9.4 bin/compare_v5
oddb2xml-2.9.3 bin/compare_v5
oddb2xml-2.9.2 bin/compare_v5
oddb2xml-2.9.1 bin/compare_v5
oddb2xml-2.9.0 bin/compare_v5
oddb2xml-2.8.9 bin/compare_v5
oddb2xml-2.8.8 bin/compare_v5
oddb2xml-2.8.7 bin/compare_v5
oddb2xml-2.8.6 bin/compare_v5
oddb2xml-2.8.5 bin/compare_v5
oddb2xml-2.8.4 bin/compare_v5
oddb2xml-2.8.3 bin/compare_v5
oddb2xml-2.8.2 bin/compare_v5
oddb2xml-2.8.1 bin/compare_v5
oddb2xml-2.8.0 bin/compare_v5
oddb2xml-2.7.9 bin/compare_v5
oddb2xml-2.7.8 bin/compare_v5
oddb2xml-2.7.7 bin/compare_v5
oddb2xml-2.7.6 bin/compare_v5