rodiff 1.0.0-x64-mingw32

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ded84ae670486e359a9d3ce03c51f32b8ece69ea72a4ee682de578ff3088bc11
4
+ data.tar.gz: 66c1eb2fcd7c35b94f10aad3a564ebce8c35cedc4c1ddff3f782782936a832d1
5
+ SHA512:
6
+ metadata.gz: 532d1b5783f3282c246452b753791e1f8c515c02ec1dfd378d0cc1b55a202f82fad4aee8dd9958098203791e3a1ba00be8218b5f88fcb2fb497f6efdd6b35adf
7
+ data.tar.gz: b5e8e9b52d7cb75cc06e6a13744b56a6e913a8ba86af16d3ae83b9f953a29467e3b092ab23b95fd0cab12b9115aa4e66a8dd2ff5a41cf92b2ed80bec32e05913
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Ryan Chang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,25 @@
1
+ rodiff may redistribute executables from the https://github.com/dmtrKovalenko/odiff project
2
+
3
+ The license for that software can be found at https://github.com/dmtrKovalenko/odiff/blob/main/LICENSE which is reproduced here for your convenience:
4
+
5
+ MIT License
6
+
7
+ Copyright (c) 2021 Dmitriy Kovalenko
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy
10
+ of this software and associated documentation files (the "Software"), to deal
11
+ in the Software without restriction, including without limitation the rights
12
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
+ copies of the Software, and to permit persons to whom the Software is
14
+ furnished to do so, subject to the following conditions:
15
+
16
+ The above copyright notice and this permission notice shall be included in all
17
+ copies or substantial portions of the Software.
18
+
19
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
25
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # rodiff
2
+
3
+ A ruby wrapper for [Odiff](https://github.com/dmtrKovalenko/odiff), an image comparison tool written in OCamel.
4
+
5
+
6
+ ## Motivation
7
+
8
+ A strong candidate against the veteran players on the internet like [pixelmatch](https://github.com/mapbox/pixelmatch) and [ImageMagick](https://github.com/ImageMagick/ImageMagick)
9
+
10
+ Impressive [benchmarks](https://github.com/dmtrKovalenko/odiff#benchmarks) from `Odiff`.
11
+
12
+
13
+ ## Getting Started
14
+
15
+ Install the gem and add to the application's Gemfile by executing:
16
+ ```sh
17
+ bundle add rodiff
18
+ ```
19
+
20
+ If bundler is not being used to manage dependencies, install the gem by executing:
21
+ ```sh
22
+ gem install rodiff
23
+ ```
24
+
25
+ This gem wraps the [standalone executable](https://github.com/dmtrKovalenko/odiff#from-binaries) of the `Odiff`. These executables are platform specific, there are separate gems per platform, but the suitable gem will automatically be selected for your machine.
26
+
27
+ Supported platforms are:
28
+ - arm64-darwin (macos-arm64)
29
+ - x64-mingw32 (windows-x64)
30
+ - x64-mingw-ucr (windows-x64)
31
+ - x86_64-darwin (macos-x64)
32
+ - x86_64-linux (linux-x64)
33
+
34
+ ### Using a local installation of `Odiff`
35
+
36
+ If you are not able to use the vendored standalone executables, a local installation of the `Odiff` executable can be configured by setting an environment variable named `ODIFF_INSTALL_DIR` to the directory path containing the executable.
37
+
38
+ For example, if you've installed `odiff` via npm which could be something like `/path/to/node_modules/bin/odiff`, then you should set your environment variable like so:
39
+
40
+ ``` sh
41
+ ODIFF_INSTALL_DIR=/path/to/node_modules/bin
42
+ ```
43
+
44
+ or, for relative paths like `./node_modules/.bin/odiff`:
45
+
46
+ ``` sh
47
+ ODIFF_INSTALL_DIR=node_modules/.bin
48
+ ```
49
+
50
+ ## Development
51
+
52
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
53
+
54
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
55
+
56
+ ## Troubleshooting
57
+
58
+ ### `ERROR: Cannot find the odiff executable` for supported platform
59
+
60
+ Some users are reporting this error even when running on one of the supported platforms:
61
+ - arm64-darwin
62
+ - x64-mingw32
63
+ - x64-mingw-ucrt
64
+ - x86_64-darwin
65
+ - x86_64-linux
66
+
67
+ #### Check Bundler PLATFORMS
68
+
69
+ A possible cause of this is that Bundler has not been told to include gems for your current platform. Please check your `Gemfile.lock` file to see whether your native platform is included in the `PLATFORMS` section. If necessary, run:
70
+
71
+ ``` sh
72
+ bundle lock --add-platform <platform-name>
73
+ ```
74
+
75
+ and re-bundle.
76
+
77
+
78
+ #### Check BUNDLE_FORCE_RUBY_PLATFORM
79
+
80
+ Another common cause of this is that bundler is configured to always use the "ruby" platform via the
81
+ `BUNDLE_FORCE_RUBY_PLATFORM` config parameter being set to `true`. Please remove this configuration:
82
+
83
+ ``` sh
84
+ bundle config unset force_ruby_platform
85
+ # or
86
+ bundle config set --local force_ruby_platform false
87
+ ```
88
+
89
+ and re-bundle.
90
+
91
+ See https://bundler.io/man/bundle-config.1.html for more information.
92
+
93
+ ## License
94
+
95
+ Rodiff is released under the [MIT License](https://opensource.org/licenses/MIT).
96
+ Odiff is released under the [MIT License](https://opensource.org/licenses/MIT).
data/exe/rodiff ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
5
+
6
+ require "rodiff/cli"
7
+
8
+ begin
9
+ verbose = ARGV.delete "--verbose"
10
+ command = [Rodiff::CLI.executable, *ARGV]
11
+ puts "rodiff: #{command.inspect}" if verbose
12
+
13
+ if Gem.win_platform?
14
+ # use system rather than exec as exec inexplicably fails to find the executable on Windows
15
+ # see related https://github.com/rubys/sprockets-esbuild/pull/4
16
+ system(*command, exception: true)
17
+ else
18
+ exec(*command)
19
+ end
20
+ rescue Rodiff::CLI::CommandError => e
21
+ warn("ERROR: #{e.message}")
22
+ exit 1
23
+ end
Binary file
data/lib/rodiff/cli.rb ADDED
@@ -0,0 +1,88 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rodiff/odiff"
4
+
5
+ module Rodiff
6
+ class CLI
7
+ DEFAULT_DIR = File.expand_path(File.join(__dir__, "..", "..", "exe"))
8
+
9
+ class CommandError < StandardError; end
10
+
11
+ class UnsupportedPlatform < CommandError
12
+ def initialize(platform)
13
+ super(
14
+ <<~MSG
15
+ odiff does not support the #{platform} platform
16
+ Please install odiff following instructions at https://github.com/dmtrKovalenko/odiff#installation
17
+ MSG
18
+ )
19
+ end
20
+ end
21
+
22
+ class ExecutableNotFound < CommandError
23
+ def initialize(platform, exe_path)
24
+ super(
25
+ <<~MSG
26
+ Cannot find the odiff executable for #{platform} in #{exe_path}
27
+
28
+ If you're using bundler, please make sure you're on the latest bundler version:
29
+
30
+ gem install bundler
31
+ bundle update --bundler
32
+
33
+ Then make sure your lock file includes this platform by running:
34
+
35
+ bundle lock --add-platform #{platform}
36
+ bundle install
37
+
38
+ See `bundle lock --help` output for details.
39
+
40
+ If you're still seeing this message after taking those steps, try running
41
+ `bundle config` and ensure `force_ruby_platform` isn't set to `true`. See
42
+ https://github.com/ryancyq/rodiff#check-bundle_force_ruby_platform
43
+ for more details.
44
+ MSG
45
+ )
46
+ end
47
+ end
48
+
49
+ class InstallDirectoryNotFound < CommandError
50
+ def initialize(install_dir)
51
+ super("ODIFF_INSTALL_DIR is set to #{install_dir}, but that directory does not exist.")
52
+ end
53
+ end
54
+
55
+ class << self
56
+ def platform
57
+ %i[cpu os].map { |m| Gem::Platform.local.public_send(m) }.join("-")
58
+ end
59
+
60
+ def supported_platform?(platform = nil)
61
+ return Gem::Platform.match_gem?(Gem::Platform.new(platform), "rodiff") unless platform.nil?
62
+
63
+ Rodiff::Odiff::PLATFORMS.keys.any? { |p| Gem::Platform.match_gem?(Gem::Platform.new(p), "rodiff") }
64
+ end
65
+
66
+ def executable(exe_path: DEFAULT_DIR)
67
+ if (odiff_install_dir = ENV.fetch("ODIFF_INSTALL_DIR", nil))
68
+ raise InstallDirectoryNotFound, odiff_install_dir unless File.directory?(odiff_install_dir)
69
+
70
+ warn "NOTE: using ODIFF_INSTALL_DIR to find odiff executable: #{odiff_install_dir}"
71
+ exe_path = odiff_install_dir
72
+ exe_file = File.expand_path(File.join(odiff_install_dir, "odiff"))
73
+ else
74
+ raise UnsupportedPlatform, platform unless supported_platform?
75
+
76
+ exe_files_of_platforms = File.expand_path(File.join(exe_path, "*", "odiff"))
77
+ exe_file = Dir.glob(exe_files_of_platforms).find do |f|
78
+ supported_platform?(File.basename(File.dirname(f)))
79
+ end
80
+ end
81
+
82
+ raise ExecutableNotFound.new(platform, exe_path) if exe_file.nil? || !File.exist?(exe_file)
83
+
84
+ exe_file
85
+ end
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rodiff
4
+ module Odiff
5
+ VERSION = "v3.1.1"
6
+
7
+ # rubygems platform name => upstream release filename
8
+ PLATFORMS = {
9
+ "arm64-darwin" => "odiff-macos-arm64.exe",
10
+ "x64-mingw32" => "odiff-windows-x64.exe",
11
+ "x64-mingw-ucrt" => "odiff-windows-x64.exe",
12
+ "x86_64-darwin" => "odiff-macos-x64.exe",
13
+ "x86_64-linux" => "odiff-linux-x64.exe"
14
+ }.freeze
15
+ end
16
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rodiff
4
+ VERSION = "1.0.0"
5
+ end
data/lib/rodiff.rb ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rodiff
4
+ end
5
+
6
+ require_relative "rodiff/version"
7
+ require_relative "rodiff/odiff"
8
+ require_relative "rodiff/cli"
metadata ADDED
@@ -0,0 +1,58 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rodiff
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: x64-mingw32
6
+ authors:
7
+ - Ryan Chang
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-09-08 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - ryancyq@gmail.com
16
+ executables:
17
+ - rodiff
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - LICENSE
22
+ - LICENSE-DEPENDENCIES
23
+ - README.md
24
+ - exe/rodiff
25
+ - exe/x64-mingw32/odiff
26
+ - lib/rodiff.rb
27
+ - lib/rodiff/cli.rb
28
+ - lib/rodiff/odiff.rb
29
+ - lib/rodiff/version.rb
30
+ homepage: https://github.com/ryancyq/rodiff
31
+ licenses:
32
+ - MIT
33
+ metadata:
34
+ rubygems_mfa_required: 'true'
35
+ allowed_push_host: https://rubygems.org
36
+ changelog_uri: https://github.com/ryancyq/rodiff/blob/main/CHANGELOG.md
37
+ homepage_uri: https://github.com/ryancyq/rodiff
38
+ post_install_message:
39
+ rdoc_options: []
40
+ require_paths:
41
+ - lib
42
+ required_ruby_version: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '2.7'
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: 3.2.0
52
+ requirements:
53
+ - odiff, v3.1.1
54
+ rubygems_version: 3.5.16
55
+ signing_key:
56
+ specification_version: 4
57
+ summary: A ruby wrapper for odiff
58
+ test_files: []