dhash-vips 0.1.1.3 → 0.1.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (7) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +10 -2
  3. data/common.rb +10 -0
  4. data/dhash-vips.gemspec +6 -17
  5. data/extconf.rb +14 -12
  6. data/lib/dhash-vips.rb +1 -1
  7. metadata +16 -115
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA256:
3
- metadata.gz: 413fea86d6b847774a983fc962d0c47780f8e58704a7e2656d224e7eccd089dd
4
- data.tar.gz: db8776fbcbb0945aac9ae50d251b04cf681b3c1e4f2f1623b4fcf96a37deaa56
2
+ SHA1:
3
+ metadata.gz: e1b98ca69a92ce7e640e4497399a906ec5a3cb53
4
+ data.tar.gz: 2d3dffbbd39df0448114bb1b4f7d59afb729c162
5
5
  SHA512:
6
- metadata.gz: e60093bb301e5b79d8b0653cacef7fb8ad66b87c1a3f6bbfe34df77272ef1fe3a95919371989476467304afdf3cb25a191ddeb6d74b4141dada5fbee1008d112
7
- data.tar.gz: 8b9fdbf1d4924307a0650fe81c9f66f631c807f5b18481fe207088e28153b496595b999b02d52f3179f55baf8cc4a9e7499eb86505964fb53f5b1adf70b831d8
6
+ metadata.gz: '081328a940448d63e396ba141f1d897c5367de1e923410dd67e8de9da8e811e83f035b1094ba2b7e81eb9ed9cf61a9c23cc1f88a19ba3cb822dabd63160f345b'
7
+ data.tar.gz: 59dbcdf54db72f70dc089b1b75c5574e3e06e41ec54ccfd04d270f7fd89d498a71346e62f97cf5c7aa807915f6a88bd542261243dbbdf19d4a72b9b85af9fb9e
data/Gemfile CHANGED
@@ -1,3 +1,11 @@
1
- source 'https://rubygems.org'
2
-
1
+ source "https://rubygems.org"
3
2
  gemspec
3
+
4
+ gem "byebug", "<11.1.0" # for Ruby 2.3
5
+ gem "rake"
6
+ gem "minitest"
7
+ gem "rmagick", "~>2.16"
8
+ gem "phamilie"
9
+ gem "dhash"
10
+ gem "get_process_mem"
11
+ gem "mll"
data/common.rb CHANGED
@@ -9,3 +9,13 @@ def download_and_keep image # returns path
9
9
  end unless File.exist?(path) && Digest::MD5.file(path) == File.basename(image, ".jpg")
10
10
  end
11
11
  end
12
+
13
+ def download_if_needed path
14
+ require "open-uri"
15
+ require "digest"
16
+ FileUtils.mkdir_p File.dirname path
17
+ open("https://storage.googleapis.com/dhash-vips.nakilon.pro/#{File.basename path}") do |link|
18
+ File.open(path, "wb"){ |file| IO.copy_stream link, file }
19
+ end unless File.exist?(path) && Digest::MD5.file(path) == File.basename(path, File.extname(path))
20
+ path
21
+ end
data/dhash-vips.gemspec CHANGED
@@ -1,28 +1,17 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = "dhash-vips"
3
- spec.version = "0.1.1.3"
3
+ spec.version = "0.1.1.4"
4
+ spec.summary = "dHash and IDHash perceptual image hashing/fingerprinting"
5
+ # spec.homepage = "https://github.com/nakilon/dhash-vips"
6
+
4
7
  spec.author = "Victor Maslov"
5
8
  spec.email = "nakilon@gmail.com"
6
- spec.summary = "dHash and IDHash perceptual image hashing/fingerprinting"
7
- spec.homepage = "https://github.com/nakilon/dhash-vips"
8
9
  spec.license = "MIT"
9
10
 
11
+ spec.add_dependency "ruby-vips", "~> 2.0", "!= 2.1.0", "!= 2.1.1"
12
+
10
13
  spec.require_path = "lib"
11
14
  spec.test_files = %w{ test.rb }
12
15
  spec.extensions = %w{ extconf.rb }
13
16
  spec.files = %w{ extconf.rb Gemfile LICENSE.txt common.rb dhash-vips.gemspec idhash.c lib/dhash-vips-post-install-test.rb lib/dhash-vips.rb }
14
-
15
- spec.add_dependency "ruby-vips", "~>2.0.16"
16
-
17
- spec.add_development_dependency "rake"
18
- spec.add_development_dependency "minitest"
19
-
20
- spec.add_development_dependency "rmagick", "~>2.16"
21
- spec.add_development_dependency "phamilie"
22
- spec.add_development_dependency "dhash"
23
-
24
- spec.add_development_dependency "get_process_mem"
25
-
26
- spec.add_development_dependency "mll"
27
- spec.add_development_dependency "byebug"
28
17
  end
data/extconf.rb CHANGED
@@ -1,12 +1,16 @@
1
1
  require "mkmf"
2
2
 
3
3
  File.write "Makefile", dummy_makefile(?.).join
4
- unless Gem::Platform.local.os == "darwin" && ENV["RBENV_ROOT"] && ENV["RBENV_VERSION"]
5
- else
6
- unless Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.3.8")
4
+
5
+ unless Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.3.8")
6
+ if ENV["RBENV_ROOT"] && ENV["RBENV_VERSION"]
7
7
  # https://github.com/rbenv/rbenv/issues/1199
8
8
  if found = Dir.glob("#{ENV["RBENV_ROOT"]}/sources/#{ENV["RBENV_VERSION"]}/ruby-*/").first
9
- append_cppflags "-I#{found}"
9
+ append_cppflags "-I#{Dir.glob("#{ENV["RBENV_ROOT"]}/sources/#{ENV["RBENV_VERSION"]}/ruby-*/").first}"
10
+ end
11
+ else
12
+ append_cppflags "-I/ruby/"
13
+ end
10
14
  append_cppflags "-DRUBY_EXPORT" unless Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.4")
11
15
  create_makefile "idhash"
12
16
  # Why this hack?
@@ -17,16 +21,14 @@ else
17
21
  test: all
18
22
  \t$(RUBY) -r./lib/dhash-vips.rb ./lib/dhash-vips-post-install-test.rb
19
23
  HEREDOC
20
- end
21
- end
22
24
  end
23
25
 
24
- # Cases to check:
25
- # 0. everything is ok
26
- # `rm -f idhash.o idhash.bundle idhash.so Makefile && ruby extconf.rb && make`
27
- # `bundle exec rake -rdhash-vips -e "p DHashVips::IDHash.method(:distance3).source_location"`
28
- # => # ["/Users/nakilon/_/dhash-vips/lib/dhash-vips.rb", 52] # or 42 with Ruby<2.4
29
- # => # ["/Users/nakilon/_/dhash-vips/lib/dhash-vips.rb", 32] # if LoadError
26
+ # How to test:
27
+ # $ ruby extconf.rb && make clean && make
28
+ # $ bundle exec rake -rdhash-vips -e "p DHashVips::IDHash.method(:distance3).source_location"
29
+ # # ["/Users/nakilon/_/dhash-vips/lib/dhash-vips.rb", 52] # or 42 with Ruby<2.4
30
+ # # ["/Users/nakilon/_/dhash-vips/lib/dhash-vips.rb", 32] # if LoadError
31
+ # Other cases to check:
30
32
  # 1. not macOS && rbenv
31
33
  # 2. fail during append_cppflags
32
34
  # 3. failed compilation
data/lib/dhash-vips.rb CHANGED
@@ -33,7 +33,7 @@ module DHashVips
33
33
  ((a ^ b) & (a | b) >> 128).to_s(2).count "1"
34
34
  end
35
35
  begin
36
- require_relative "../idhash.bundle"
36
+ require_relative "../idhash.#{Gem::Platform.local.os == "darwin" ? "bundle" : "o"}"
37
37
  rescue LoadError
38
38
  alias_method :distance3, :distance3_ruby
39
39
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dhash-vips
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.3
4
+ version: 0.1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Victor Maslov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-16 00:00:00.000000000 Z
11
+ date: 2022-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-vips
@@ -16,126 +16,26 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 2.0.16
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: 2.0.16
27
- - !ruby/object:Gem::Dependency
28
- name: rake
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: minitest
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
19
+ version: '2.0'
20
+ - - "!="
53
21
  - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rmagick
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
22
+ version: 2.1.0
23
+ - - "!="
60
24
  - !ruby/object:Gem::Version
61
- version: '2.16'
62
- type: :development
25
+ version: 2.1.1
26
+ type: :runtime
63
27
  prerelease: false
64
28
  version_requirements: !ruby/object:Gem::Requirement
65
29
  requirements:
66
30
  - - "~>"
67
31
  - !ruby/object:Gem::Version
68
- version: '2.16'
69
- - !ruby/object:Gem::Dependency
70
- name: phamilie
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: dhash
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: get_process_mem
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: mll
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: byebug
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
32
+ version: '2.0'
33
+ - - "!="
130
34
  - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
35
+ version: 2.1.0
36
+ - - "!="
137
37
  - !ruby/object:Gem::Version
138
- version: '0'
38
+ version: 2.1.1
139
39
  description:
140
40
  email: nakilon@gmail.com
141
41
  executables: []
@@ -152,7 +52,7 @@ files:
152
52
  - lib/dhash-vips-post-install-test.rb
153
53
  - lib/dhash-vips.rb
154
54
  - test.rb
155
- homepage: https://github.com/nakilon/dhash-vips
55
+ homepage:
156
56
  licenses:
157
57
  - MIT
158
58
  metadata: {}
@@ -171,7 +71,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
171
71
  - !ruby/object:Gem::Version
172
72
  version: '0'
173
73
  requirements: []
174
- rubygems_version: 3.1.2
74
+ rubyforge_project:
75
+ rubygems_version: 2.5.2.3
175
76
  signing_key:
176
77
  specification_version: 4
177
78
  summary: dHash and IDHash perceptual image hashing/fingerprinting