pngcheck 0.2.8 → 0.3.1
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/README.adoc +2 -0
 - data/ext/layout.rb +3 -2
 - data/ext/pngcheck-3.0.4.tar.gz +0 -0
 - data/lib/pngcheck/recipe.rb +3 -3
 - data/lib/pngcheck/version.rb +1 -1
 - data/lib/pngcheck.rb +20 -11
 - metadata +4 -10
 - data/bin/console +0 -15
 - data/bin/rspec +0 -29
 - data/bin/setup +0 -8
 - data/ext/pngcheck-3.0.3.tar.gz +0 -0
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: '09edc8320b2c09d38d9d7936ac49e71e4acb8385b3154f452d74f60e00999693'
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b626e168407f629d396cc07be2e182a0b4e4970e48d9c803fdcabc01126a7470
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: a6321ee31d50a8be3d08289cc4a754446a90d33575e3b87a4af203c247372baac2eea77a3db33876c0292a69eef2c5966b79c6d2b641e2f08c5b4aaccca5f3ee
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 1777d07c2786118e5b442d8c5f01f969f7281471ef6cd865ccb4c55f391074c464e934d5f298c2e23ec163d1d2de56c3242ac1830d92c41b2b86d742bb1c08fe
         
     | 
    
        data/README.adoc
    CHANGED
    
    | 
         @@ -113,6 +113,8 @@ Where: 
     | 
|
| 
       113 
113 
     | 
    
         
             
            * `valid` is `true` if the buffer is correct image
         
     | 
| 
       114 
114 
     | 
    
         
             
            * otherwise an exception is raised. Possible exception types are `PngCheck::EmptyPngError`, `PngCheck::CorruptPngError`
         
     | 
| 
       115 
115 
     | 
    
         | 
| 
      
 116 
     | 
    
         
            +
            Both exception classes have additional status attribute that is set to one of STATUX_XXX codes described above. We believe that
         
     | 
| 
      
 117 
     | 
    
         
            +
            exceptions with STATUS_WARNING can be ignored in the majority of applications.
         
     | 
| 
       116 
118 
     | 
    
         | 
| 
       117 
119 
     | 
    
         
             
            ==== Pre-validation with libpng-ruby
         
     | 
| 
       118 
120 
     | 
    
         | 
    
        data/ext/layout.rb
    CHANGED
    
    | 
         @@ -1,5 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
      
 3 
     | 
    
         
            +
            PNGCHECK_VER = "3.0.4"
         
     | 
| 
      
 4 
     | 
    
         
            +
            PNGCHECK_ARCH = "pngcheck-#{PNGCHECK_VER}.tar.gz"
         
     | 
| 
      
 5 
     | 
    
         
            +
            PNGCHECK_URI = "https://github.com/metanorma/pngcheck/archive/refs/tags/metanorma-v#{PNGCHECK_VER}.tar.gz"
         
     | 
| 
       5 
6 
     | 
    
         
             
            PNGCHECK_LOCAL = "ext/#{PNGCHECK_ARCH}"
         
     | 
| 
         Binary file 
     | 
    
        data/lib/pngcheck/recipe.rb
    CHANGED
    
    | 
         @@ -17,8 +17,8 @@ module PngCheck 
     | 
|
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
                def files_to_load_all
         
     | 
| 
       19 
19 
     | 
    
         
             
                  @files << {
         
     | 
| 
       20 
     | 
    
         
            -
                    url: "file:#{ROOT}/#{PNGCHECK_LOCAL}", 
     | 
| 
       21 
     | 
    
         
            -
                    sha256: " 
     | 
| 
      
 20 
     | 
    
         
            +
                    url: "file:#{ROOT}/#{PNGCHECK_LOCAL}",
         
     | 
| 
      
 21 
     | 
    
         
            +
                    sha256: "f8ff6033dc0008a90a468213a96ac5d72476b1e59378e267341fcf3734ebb2b3", # rubocop:disable Layout/LineLength
         
     | 
| 
       22 
22 
     | 
    
         
             
                  }
         
     | 
| 
       23 
23 
     | 
    
         
             
                end
         
     | 
| 
       24 
24 
     | 
    
         | 
| 
         @@ -33,7 +33,7 @@ module PngCheck 
     | 
|
| 
       33 
33 
     | 
    
         
             
                end
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
                def initialize
         
     | 
| 
       36 
     | 
    
         
            -
                  super("pngcheck",  
     | 
| 
      
 36 
     | 
    
         
            +
                  super("pngcheck", PNGCHECK_VER)
         
     | 
| 
       37 
37 
     | 
    
         
             
                  files_to_load_all
         
     | 
| 
       38 
38 
     | 
    
         
             
                  files_to_load_cross
         
     | 
| 
       39 
39 
     | 
    
         
             
                  @target = ROOT.join(@target).to_s
         
     | 
    
        data/lib/pngcheck/version.rb
    CHANGED
    
    
    
        data/lib/pngcheck.rb
    CHANGED
    
    | 
         @@ -5,21 +5,30 @@ require "tempfile" 
     | 
|
| 
       5 
5 
     | 
    
         
             
            require_relative "pngcheck/version"
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            module PngCheck
         
     | 
| 
      
 8 
     | 
    
         
            +
              STATUS_OK = 0
         
     | 
| 
      
 9 
     | 
    
         
            +
              STATUS_WARNING = 1        # an error in some circumstances but not in all
         
     | 
| 
      
 10 
     | 
    
         
            +
              STATUS_MINOR_ERROR = 3    # minor spec errors (e.g., out-of-range values)
         
     | 
| 
      
 11 
     | 
    
         
            +
              STATUS_MAJOR_ERROR = 4    # file corruption, invalid chunk length/layout, etc.
         
     | 
| 
      
 12 
     | 
    
         
            +
              STATUS_CRITICAL_ERROR = 5 # unexpected EOF or other file(system) error
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
       8 
14 
     | 
    
         
             
              EMPTY_IMAGE = "Image is empty"
         
     | 
| 
       9 
15 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
              class CorruptPngError < StandardError 
     | 
| 
      
 16 
     | 
    
         
            +
              class CorruptPngError < StandardError
         
     | 
| 
      
 17 
     | 
    
         
            +
                def initialize(msg, sts = STATUS_MAJOR_ERROR)
         
     | 
| 
      
 18 
     | 
    
         
            +
                  super(msg)
         
     | 
| 
      
 19 
     | 
    
         
            +
                  @status = sts
         
     | 
| 
      
 20 
     | 
    
         
            +
                end
         
     | 
| 
       11 
21 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
                  super
         
     | 
| 
      
 22 
     | 
    
         
            +
                def status
         
     | 
| 
      
 23 
     | 
    
         
            +
                  @status
         
     | 
| 
       15 
24 
     | 
    
         
             
                end
         
     | 
| 
       16 
25 
     | 
    
         
             
              end
         
     | 
| 
       17 
26 
     | 
    
         | 
| 
       18 
     | 
    
         
            -
               
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
               
     | 
| 
      
 27 
     | 
    
         
            +
              class EmptyPngError < CorruptPngError
         
     | 
| 
      
 28 
     | 
    
         
            +
                def initialize(msg = EMPTY_IMAGE)
         
     | 
| 
      
 29 
     | 
    
         
            +
                  super(msg, STATUS_CRITICAL_ERROR)
         
     | 
| 
      
 30 
     | 
    
         
            +
                end
         
     | 
| 
      
 31 
     | 
    
         
            +
              end
         
     | 
| 
       23 
32 
     | 
    
         | 
| 
       24 
33 
     | 
    
         
             
              EXTRA_MESSAGE_SIZE = 1024
         
     | 
| 
       25 
34 
     | 
    
         | 
| 
         @@ -53,7 +62,7 @@ module PngCheck 
     | 
|
| 
       53 
62 
     | 
    
         
             
                def check_file(path)
         
     | 
| 
       54 
63 
     | 
    
         
             
                  status, info = analyze_file(path)
         
     | 
| 
       55 
64 
     | 
    
         
             
                  raise EmptyPngError.new if info.eql? EMPTY_IMAGE
         
     | 
| 
       56 
     | 
    
         
            -
                  raise CorruptPngError.new 
     | 
| 
      
 65 
     | 
    
         
            +
                  raise CorruptPngError.new(info, status) unless status == STATUS_OK
         
     | 
| 
       57 
66 
     | 
    
         | 
| 
       58 
67 
     | 
    
         
             
                  true
         
     | 
| 
       59 
68 
     | 
    
         
             
                end
         
     | 
| 
         @@ -67,7 +76,7 @@ module PngCheck 
     | 
|
| 
       67 
76 
     | 
    
         
             
                def check_buffer(data)
         
     | 
| 
       68 
77 
     | 
    
         
             
                  status, info = analyze_buffer(data)
         
     | 
| 
       69 
78 
     | 
    
         
             
                  raise EmptyPngError.new if info.eql? EMPTY_IMAGE
         
     | 
| 
       70 
     | 
    
         
            -
                  raise CorruptPngError.new 
     | 
| 
      
 79 
     | 
    
         
            +
                  raise CorruptPngError.new(info, status) unless status == STATUS_OK
         
     | 
| 
       71 
80 
     | 
    
         | 
| 
       72 
81 
     | 
    
         
             
                  true
         
     | 
| 
       73 
82 
     | 
    
         
             
                end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: pngcheck
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.3.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Ribose Inc.
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2022- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-10-14 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -117,10 +117,7 @@ dependencies: 
     | 
|
| 
       117 
117 
     | 
    
         
             
            description: 
         
     | 
| 
       118 
118 
     | 
    
         
             
            email:
         
     | 
| 
       119 
119 
     | 
    
         
             
            - open.source@ribose.com
         
     | 
| 
       120 
     | 
    
         
            -
            executables:
         
     | 
| 
       121 
     | 
    
         
            -
            - console
         
     | 
| 
       122 
     | 
    
         
            -
            - rspec
         
     | 
| 
       123 
     | 
    
         
            -
            - setup
         
     | 
| 
      
 120 
     | 
    
         
            +
            executables: []
         
     | 
| 
       124 
121 
     | 
    
         
             
            extensions:
         
     | 
| 
       125 
122 
     | 
    
         
             
            - ext/extconf.rb
         
     | 
| 
       126 
123 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
         @@ -133,13 +130,10 @@ files: 
     | 
|
| 
       133 
130 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
       134 
131 
     | 
    
         
             
            - README.adoc
         
     | 
| 
       135 
132 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       136 
     | 
    
         
            -
            - bin/console
         
     | 
| 
       137 
     | 
    
         
            -
            - bin/rspec
         
     | 
| 
       138 
     | 
    
         
            -
            - bin/setup
         
     | 
| 
       139 
133 
     | 
    
         
             
            - ext/Makefile
         
     | 
| 
       140 
134 
     | 
    
         
             
            - ext/extconf.rb
         
     | 
| 
       141 
135 
     | 
    
         
             
            - ext/layout.rb
         
     | 
| 
       142 
     | 
    
         
            -
            - ext/pngcheck-3.0. 
     | 
| 
      
 136 
     | 
    
         
            +
            - ext/pngcheck-3.0.4.tar.gz
         
     | 
| 
       143 
137 
     | 
    
         
             
            - ext/wrapper.c
         
     | 
| 
       144 
138 
     | 
    
         
             
            - lib/pngcheck.rb
         
     | 
| 
       145 
139 
     | 
    
         
             
            - lib/pngcheck/recipe.rb
         
     | 
    
        data/bin/console
    DELETED
    
    | 
         @@ -1,15 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #!/usr/bin/env ruby
         
     | 
| 
       2 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            require "bundler/setup"
         
     | 
| 
       5 
     | 
    
         
            -
            require "pngcheck"
         
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
            # You can add fixtures and/or initialization code here to make experimenting
         
     | 
| 
       8 
     | 
    
         
            -
            # with your gem easier. You can also use a different console, if you like.
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
            # (If you use this, don't forget to add pry to your Gemfile!)
         
     | 
| 
       11 
     | 
    
         
            -
            # require "pry"
         
     | 
| 
       12 
     | 
    
         
            -
            # Pry.start
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
       14 
     | 
    
         
            -
            require "irb"
         
     | 
| 
       15 
     | 
    
         
            -
            IRB.start(__FILE__)
         
     | 
    
        data/bin/rspec
    DELETED
    
    | 
         @@ -1,29 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            #!/usr/bin/env ruby
         
     | 
| 
       2 
     | 
    
         
            -
            # frozen_string_literal: true
         
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
            #
         
     | 
| 
       5 
     | 
    
         
            -
            # This file was generated by Bundler.
         
     | 
| 
       6 
     | 
    
         
            -
            #
         
     | 
| 
       7 
     | 
    
         
            -
            # The application 'rspec' is installed as part of a gem, and
         
     | 
| 
       8 
     | 
    
         
            -
            # this file is here to facilitate running it.
         
     | 
| 
       9 
     | 
    
         
            -
            #
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            require "pathname"
         
     | 
| 
       12 
     | 
    
         
            -
            ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
         
     | 
| 
       13 
     | 
    
         
            -
                                                       Pathname.new(__FILE__).realpath)
         
     | 
| 
       14 
     | 
    
         
            -
             
     | 
| 
       15 
     | 
    
         
            -
            bundle_binstub = File.expand_path("bundle", __dir__)
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
            if File.file?(bundle_binstub)
         
     | 
| 
       18 
     | 
    
         
            -
              if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
         
     | 
| 
       19 
     | 
    
         
            -
                load(bundle_binstub)
         
     | 
| 
       20 
     | 
    
         
            -
              else
         
     | 
| 
       21 
     | 
    
         
            -
                abort("Your `bin/bundle` was not generated by Bundler.
         
     | 
| 
       22 
     | 
    
         
            -
            Replace `bin/bundle` by running `bundle binstubs bundler --force`.")
         
     | 
| 
       23 
     | 
    
         
            -
              end
         
     | 
| 
       24 
     | 
    
         
            -
            end
         
     | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
            require "rubygems"
         
     | 
| 
       27 
     | 
    
         
            -
            require "bundler/setup"
         
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
            load Gem.bin_path("rspec-core", "rspec")
         
     | 
    
        data/bin/setup
    DELETED
    
    
    
        data/ext/pngcheck-3.0.3.tar.gz
    DELETED
    
    | 
         Binary file 
     |