pngcheck 0.2.7-arm64-darwin → 0.3.0-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d65f5e6b11536b4fcc897f32878a1c3df560192389ee61e5ac366aacdc673879
4
- data.tar.gz: fcf3f8dada57664a18cefd38eac6dbebb31b2fe6f2882bc56fe3605f4c1191ed
3
+ metadata.gz: cebe37acaa680f30281dacbf8e2534f38b3bd9150bab7a2b0180d5d4f56a51aa
4
+ data.tar.gz: ba6ceda0a09406561f7b3ca26dc6d968b9bbda57c37489210c30ab088536f1a4
5
5
  SHA512:
6
- metadata.gz: 96e5b0510914be6809247931f96b7a3162e297dfe54c769ac780bcca6f8691e0d9173bcb36bcb8aca0d75ccada61268e14dcfbdafb45aef3296226cb0004905b
7
- data.tar.gz: c6413f56b46f81aeb0dc86d32c92b75c4eb0224e9cd268abfa9a2fa41be60ec490f2bcb73664ede246a09e4a2c7b25d74fa679f0c9f7e3745e66032f15b2aed3
6
+ metadata.gz: a460da4aaeb16007280afe9231abefeade55e7f319a4c26c30e7f57345d26d6a62f646bb040ad7d37f1ef2f67d498bab72553ac1addce4cc79f91146c1b197f9
7
+ data.tar.gz: c736f8a571cdc8b91015747e763d10875e7a5220c0d6a97593997ddc86123ba6d152fb9d807db45c3d366db9be46eae4b43de374d70c6ddfd771b9e7b85c284b
data/.cross_rubies CHANGED
@@ -2,6 +2,7 @@ x64-mingw32
2
2
  x86_64-linux
3
3
  x86_64-linux-musl
4
4
  aarch64-linux
5
+ aarch64-linux-musl
5
6
  x86_64-darwin
6
7
  arm64-darwin
7
8
  x64-mingw-ucrt
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/bin/rspec ADDED
@@ -0,0 +1,29 @@
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/ext/layout.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- PNGCHECK_ARCH = "pngcheck-3.0.3.tar.gz"
4
- PNGCHECK_URI = "http://www.libpng.org/pub/png/src/#{PNGCHECK_ARCH}"
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
@@ -17,8 +17,8 @@ module PngCheck
17
17
 
18
18
  def files_to_load_all
19
19
  @files << {
20
- url: "file:#{ROOT}/#{PNGCHECK_LOCAL}", # "http://www.libpng.org/pub/png/src/pngcheck-3.0.3.tar.gz"
21
- sha256: "c36a4491634af751f7798ea421321642f9590faa032eccb0dd5fb4533609dee6", # rubocop:disable Layout/LineLength
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", "3.0.3")
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
@@ -75,6 +75,10 @@ module PngCheck
75
75
  end
76
76
  end
77
77
 
78
+ def tmp_path
79
+ "tmp/#{@host}/ports"
80
+ end
81
+
78
82
  def checkpoint
79
83
  File.join(@target, "#{name}-#{version}-#{host}.installed")
80
84
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PngCheck
4
- VERSION = "0.2.7"
4
+ VERSION = "0.3.0"
5
5
  end
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; end
16
+ class CorruptPngError < StandardError
17
+ def initialize(msg, sts = STATUS_MAJOR_ERROR)
18
+ super(msg)
19
+ @status = sts
20
+ end
11
21
 
12
- class EmptyPngError < StandardError
13
- def initialize(msg = EMPTY_IMAGE)
14
- super
22
+ def status
23
+ @status
15
24
  end
16
25
  end
17
26
 
18
- STATUS_OK = 0
19
- STATUS_WARNING = 1 # an error in some circumstances but not in all
20
- STATUS_MINOR_ERROR = 3 # minor spec errors (e.g., out-of-range values)
21
- STATUS_MAJOR_ERROR = 4 # file corruption, invalid chunk length/layout, etc.
22
- STATUS_CRITICAL_ERROR = 5 # unexpected EOF or other file(system) error
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 info unless status == STATUS_OK
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 info unless status == STATUS_OK
79
+ raise CorruptPngError.new(info, status) unless status == STATUS_OK
71
80
 
72
81
  true
73
82
  end
metadata CHANGED
@@ -1,15 +1,35 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pngcheck
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.3.0
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-09-26 00:00:00.000000000 Z
11
+ date: 2022-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.3'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.3.22
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.3'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.3.22
13
33
  - !ruby/object:Gem::Dependency
14
34
  name: ffi
15
35
  requirement: !ruby/object:Gem::Requirement
@@ -25,33 +45,33 @@ dependencies:
25
45
  - !ruby/object:Gem::Version
26
46
  version: '1.0'
27
47
  - !ruby/object:Gem::Dependency
28
- name: libpng-ruby
48
+ name: rake
29
49
  requirement: !ruby/object:Gem::Requirement
30
50
  requirements:
31
51
  - - "~>"
32
52
  - !ruby/object:Gem::Version
33
- version: '0.6'
34
- type: :development
53
+ version: '13.0'
54
+ type: :runtime
35
55
  prerelease: false
36
56
  version_requirements: !ruby/object:Gem::Requirement
37
57
  requirements:
38
58
  - - "~>"
39
59
  - !ruby/object:Gem::Version
40
- version: '0.6'
60
+ version: '13.0'
41
61
  - !ruby/object:Gem::Dependency
42
- name: rake
62
+ name: libpng-ruby
43
63
  requirement: !ruby/object:Gem::Requirement
44
64
  requirements:
45
65
  - - "~>"
46
66
  - !ruby/object:Gem::Version
47
- version: '13.0'
67
+ version: '0.6'
48
68
  type: :development
49
69
  prerelease: false
50
70
  version_requirements: !ruby/object:Gem::Requirement
51
71
  requirements:
52
72
  - - "~>"
53
73
  - !ruby/object:Gem::Version
54
- version: '13.0'
74
+ version: '0.6'
55
75
  - !ruby/object:Gem::Dependency
56
76
  name: rspec
57
77
  requirement: !ruby/object:Gem::Requirement
@@ -85,6 +105,7 @@ email:
85
105
  - open.source@ribose.com
86
106
  executables:
87
107
  - console
108
+ - rspec
88
109
  - setup
89
110
  extensions: []
90
111
  extra_rdoc_files: []
@@ -98,6 +119,7 @@ files:
98
119
  - README.adoc
99
120
  - Rakefile
100
121
  - bin/console
122
+ - bin/rspec
101
123
  - bin/setup
102
124
  - ext/Makefile
103
125
  - ext/extconf.rb