libis-format 0.9.35 → 0.9.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/libis/format/identifier.rb +15 -3
- data/lib/libis/format/version.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 102c089d1a23d177c40e693c0e2d87182659e6e9
         | 
| 4 | 
            +
              data.tar.gz: 4a9b393229a17eac40db9a2540a84fc8e2e75eeb
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 3470b7edeab6bea691f5a25ba02d76cba85618026a61beb1ace8023c73d3270a916b585ae006189792cc0b064f760c28f4f7871f983859d7158bf7037aad8067
         | 
| 7 | 
            +
              data.tar.gz: 6d90ae9419afb3c2cda8d060e4fb6b809fa575cfacf407049dc25694ff51fa74bc812ad38f2b5f1cc38a41a50fedcf2130290fa3913fd2ce6bfc267ea46947d2
         | 
| @@ -43,6 +43,7 @@ module Libis | |
| 43 43 | 
             
                    options[:droid] = true unless options.keys.include?(:droid) and options[:tool] and options[:tool] != :droid
         | 
| 44 44 | 
             
                    options[:fido] = true unless options.keys.include?(:fido) and options[:tool] and options[:tool] != :fido
         | 
| 45 45 | 
             
                    options[:file] = true unless options.keys.include?(:file) and options[:tool] and options[:tool] != :file
         | 
| 46 | 
            +
                    options[:xml_validation] = true unless options.keys.include?(:xml_validation) and !options[:xml_validation]
         | 
| 46 47 |  | 
| 47 48 | 
             
                    result = {messages: [], output: {}, formats: {}}
         | 
| 48 49 |  | 
| @@ -64,11 +65,16 @@ module Libis | |
| 64 65 | 
             
                      log_msg(result, :error, "Error running File: #{e.message} @ #{e.backtrace.first}")
         | 
| 65 66 | 
             
                    end
         | 
| 66 67 |  | 
| 68 | 
            +
                    # Let's not waiste time on this. If not standard, it will fail in Rosetta anyway.
         | 
| 67 69 | 
             
                    # get_extension_identification(file, options[:recursive], result)
         | 
| 68 70 |  | 
| 69 71 | 
             
                    # determine XML type. Add custom types at runtime with
         | 
| 70 72 | 
             
                    # Libis::Tools::Format::Identifier.add_xml_validation('my_type', '/path/to/my_type.xsd')
         | 
| 71 | 
            -
                     | 
| 73 | 
            +
                    begin
         | 
| 74 | 
            +
                      validate_against_xml_schema(result) if options[:xml_validation]
         | 
| 75 | 
            +
                    rescue => e
         | 
| 76 | 
            +
                      log_msg(result, :error, "Error validating XML files: #{e.message} @ #{e.backtrace.first}")
         | 
| 77 | 
            +
                    end
         | 
| 72 78 |  | 
| 73 79 | 
             
                    process_results(result)
         | 
| 74 80 |  | 
| @@ -129,9 +135,15 @@ module Libis | |
| 129 135 | 
             
                        # Do nothing - probably Nokogiri chrashed during validation. Could have many causes
         | 
| 130 136 | 
             
                        # (remote schema (firewall, network, link rot, ...), schema syntax error, corrupt XML,...)
         | 
| 131 137 | 
             
                        # so we log and continue.
         | 
| 132 | 
            -
                        log_msg(result, :warn, | 
| 138 | 
            +
                        log_msg(result, :warn,
         | 
| 139 | 
            +
                                "Error during XML validation of file #{file} against #{File.basename(xsd_file)}: #{e.message}")
         | 
| 133 140 | 
             
                      end
         | 
| 134 141 | 
             
                    end
         | 
| 142 | 
            +
                  rescue => e
         | 
| 143 | 
            +
                    # Not much we can do. probably Nokogiri chrashed opening the XML file. What caused this?
         | 
| 144 | 
            +
                    # (XML not parsable, false XML identification, ???)
         | 
| 145 | 
            +
                    # so we log and continue.
         | 
| 146 | 
            +
                    log_msg(result, :warn, "Error paring XML file #{file}: #{e.message} @ #{e.backtrace.first}")
         | 
| 135 147 | 
             
                  end
         | 
| 136 148 |  | 
| 137 149 | 
             
                  def process_results(result)
         | 
| @@ -171,7 +183,7 @@ module Libis | |
| 171 183 | 
             
                    file_result[:alternatives] = []
         | 
| 172 184 | 
             
                    format_matches.keys.each do |mime, puid|
         | 
| 173 185 | 
             
                      next if file_result[:mimetype] == mime && puid.nil?
         | 
| 174 | 
            -
             | 
| 186 | 
            +
                      selection = output.select {|x| x[:mimetype] == mime && x[:puid] == puid}
         | 
| 175 187 | 
             
                      file_result[:alternatives] << get_best_result(selection)
         | 
| 176 188 | 
             
                    end
         | 
| 177 189 | 
             
                    file_result[:alternatives] = file_result[:alternatives].sort_by {|x| x[:score]}.reverse
         | 
    
        data/lib/libis/format/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: libis-format
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.9. | 
| 4 | 
            +
              version: 0.9.36
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Kris Dekeyser
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2017-09- | 
| 11 | 
            +
            date: 2017-09-27 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: bundler
         |