phashion 1.0.2 → 1.0.3
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.
- data/CHANGES.md +6 -0
- data/LICENSE +1 -1
- data/README.md +7 -1
- data/Rakefile +1 -19
- data/ext/phashion_ext/extconf.rb +1 -1
- data/ext/phashion_ext/pHash-0.9.3.tar.gz +0 -0
- data/lib/phashion.rb +2 -2
- data/phashion.gemspec +4 -49
- data/test/gif/Broccoli_Super_Food.gif +0 -0
- data/test/{86x86-0a1e.jpeg → jpg/86x86-0a1e.jpeg} +0 -0
- data/test/{86x86-83d6.jpeg → jpg/86x86-83d6.jpeg} +0 -0
- data/test/{86x86-a855.jpeg → jpg/86x86-a855.jpeg} +0 -0
- data/test/jpg/Broccoli_Super_Food.jpg +0 -0
- data/test/{avatar.jpg → jpg/avatar.jpg} +0 -0
- data/test/{b32aade8c590e2d776c24f35868f0c7a588f51e1.jpeg → jpg/b32aade8c590e2d776c24f35868f0c7a588f51e1.jpeg} +0 -0
- data/test/{df9cc82f5b32d7463f36620c61854fde9d939f7f.jpeg → jpg/df9cc82f5b32d7463f36620c61854fde9d939f7f.jpeg} +0 -0
- data/test/{e7397898a7e395c2524978a5e64de0efabf08290.jpeg → jpg/e7397898a7e395c2524978a5e64de0efabf08290.jpeg} +0 -0
- data/test/png/Broccoli_Super_Food.png +0 -0
- data/test/test_phashion.rb +12 -3
- metadata +30 -15
- data/ext/phashion_ext/pHash-0.9.0.tar.gz +0 -0
data/CHANGES.md
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -11,7 +11,7 @@ Installation
|
|
11
11
|
|
12
12
|
You install it just like any other Ruby gem:
|
13
13
|
|
14
|
-
gem install phashion
|
14
|
+
gem install phashion
|
15
15
|
|
16
16
|
Phashion is somewhat involved to install as it has a few dependencies. I've wrapped up those
|
17
17
|
dependencies into a custom tarball that is built locally just for this gem so you don't have to
|
@@ -20,6 +20,12 @@ do anything special. See the code in `ext/phashion_ext` for more details.
|
|
20
20
|
Because of this complexity, it is possible the gem install will fail on your platform. I've tested
|
21
21
|
it on Mac OSX 10.6 and Ubuntu 8.04 but please contact me if you have installation problems.
|
22
22
|
|
23
|
+
If you have an error upon install, like:
|
24
|
+
|
25
|
+
ld: library not found for -ljpeg
|
26
|
+
|
27
|
+
you need to install libjpeg. "brew install libjpeg" or "port install jpeg" on OSX.
|
28
|
+
|
23
29
|
Usage
|
24
30
|
---------
|
25
31
|
|
data/Rakefile
CHANGED
@@ -1,24 +1,6 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
3
|
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "phashion"
|
8
|
-
gem.summary = %Q{Simple wrapper around the pHash library}
|
9
|
-
gem.description = gem.summary
|
10
|
-
gem.email = "mperham@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/mperham/phashion"
|
12
|
-
gem.authors = ["Mike Perham"]
|
13
|
-
gem.add_development_dependency 'rake-compiler', '>= 0.7.0'
|
14
|
-
gem.version = '1.0.2'
|
15
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
-
end
|
17
|
-
Jeweler::GemcutterTasks.new
|
18
|
-
rescue LoadError
|
19
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
20
|
-
end
|
21
|
-
|
22
4
|
require 'rake/testtask'
|
23
5
|
Rake::TestTask.new(:test) do |test|
|
24
6
|
test.libs << 'lib' << 'test'
|
@@ -39,7 +21,7 @@ rescue LoadError
|
|
39
21
|
end
|
40
22
|
end
|
41
23
|
|
42
|
-
task :test
|
24
|
+
task :test
|
43
25
|
|
44
26
|
task :default => :test
|
45
27
|
|
data/ext/phashion_ext/extconf.rb
CHANGED
Binary file
|
data/lib/phashion.rb
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
# int ph_hamming_distance(ulong64 hasha, ulong64 hashb);
|
8
8
|
|
9
9
|
module Phashion
|
10
|
-
VERSION = '1.0.
|
10
|
+
VERSION = '1.0.3'
|
11
11
|
|
12
12
|
class Image
|
13
13
|
SETTINGS = {
|
@@ -27,7 +27,7 @@ module Phashion
|
|
27
27
|
@hash ||= Phashion.image_hash_for(@filename)
|
28
28
|
end
|
29
29
|
end
|
30
|
-
|
30
|
+
|
31
31
|
end
|
32
32
|
|
33
33
|
require 'phashion_ext'
|
data/phashion.gemspec
CHANGED
@@ -5,62 +5,17 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{phashion}
|
8
|
-
s.version = "1.0.
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.version = "1.0.3"
|
11
9
|
s.authors = ["Mike Perham"]
|
12
|
-
s.date = %q{2010-06-04}
|
13
10
|
s.description = %q{Simple wrapper around the pHash library}
|
14
11
|
s.email = %q{mperham@gmail.com}
|
15
12
|
s.extensions = ["ext/phashion_ext/extconf.rb"]
|
16
|
-
s.
|
17
|
-
"LICENSE",
|
18
|
-
"README.md"
|
19
|
-
]
|
20
|
-
s.files = [
|
21
|
-
".document",
|
22
|
-
".gitignore",
|
23
|
-
"CHANGES.md",
|
24
|
-
"LICENSE",
|
25
|
-
"README.md",
|
26
|
-
"Rakefile",
|
27
|
-
"TODO.md",
|
28
|
-
"ext/phashion_ext/extconf.rb",
|
29
|
-
"ext/phashion_ext/pHash-0.9.0.tar.gz",
|
30
|
-
"ext/phashion_ext/phashion_ext.c",
|
31
|
-
"lib/phashion.rb",
|
32
|
-
"phashion.gemspec",
|
33
|
-
"test/86x86-0a1e.jpeg",
|
34
|
-
"test/86x86-83d6.jpeg",
|
35
|
-
"test/86x86-a855.jpeg",
|
36
|
-
"test/avatar.jpg",
|
37
|
-
"test/b32aade8c590e2d776c24f35868f0c7a588f51e1.jpeg",
|
38
|
-
"test/df9cc82f5b32d7463f36620c61854fde9d939f7f.jpeg",
|
39
|
-
"test/e7397898a7e395c2524978a5e64de0efabf08290.jpeg",
|
40
|
-
"test/helper.rb",
|
41
|
-
"test/test_phashion.rb"
|
42
|
-
]
|
13
|
+
s.files = `git ls-files`.split("\n")
|
43
14
|
s.homepage = %q{http://github.com/mperham/phashion}
|
44
15
|
s.rdoc_options = ["--charset=UTF-8"]
|
45
16
|
s.require_paths = ["lib"]
|
46
|
-
s.rubygems_version = %q{1.3.6}
|
47
17
|
s.summary = %q{Simple wrapper around the pHash library}
|
48
|
-
s.test_files =
|
49
|
-
|
50
|
-
"test/test_phashion.rb"
|
51
|
-
]
|
52
|
-
|
53
|
-
if s.respond_to? :specification_version then
|
54
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
55
|
-
s.specification_version = 3
|
56
|
-
|
57
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
58
|
-
s.add_development_dependency(%q<rake-compiler>, [">= 0.7.0"])
|
59
|
-
else
|
60
|
-
s.add_dependency(%q<rake-compiler>, [">= 0.7.0"])
|
61
|
-
end
|
62
|
-
else
|
63
|
-
s.add_dependency(%q<rake-compiler>, [">= 0.7.0"])
|
64
|
-
end
|
18
|
+
s.test_files = `git ls-files test`.split("\n")
|
19
|
+
s.add_development_dependency(%q<rake-compiler>, [">= 0.7.0"])
|
65
20
|
end
|
66
21
|
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
Binary file
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
Binary file
|
data/test/test_phashion.rb
CHANGED
@@ -4,7 +4,7 @@ class TestPhashion < Test::Unit::TestCase
|
|
4
4
|
|
5
5
|
def test_duplicate_detection
|
6
6
|
files = %w(86x86-0a1e.jpeg 86x86-83d6.jpeg 86x86-a855.jpeg)
|
7
|
-
images = files.map {|f| Phashion::Image.new("#{File.dirname(__FILE__) + '/../test/'}#{f}")}
|
7
|
+
images = files.map {|f| Phashion::Image.new("#{File.dirname(__FILE__) + '/../test/jpg/'}#{f}")}
|
8
8
|
assert_duplicate images[0], images[1]
|
9
9
|
assert_duplicate images[1], images[2]
|
10
10
|
assert_duplicate images[0], images[2]
|
@@ -12,7 +12,7 @@ class TestPhashion < Test::Unit::TestCase
|
|
12
12
|
|
13
13
|
def test_duplicate_detection_2
|
14
14
|
files = %w(b32aade8c590e2d776c24f35868f0c7a588f51e1.jpeg df9cc82f5b32d7463f36620c61854fde9d939f7f.jpeg e7397898a7e395c2524978a5e64de0efabf08290.jpeg)
|
15
|
-
images = files.map {|f| Phashion::Image.new("#{File.dirname(__FILE__) + '/../test/'}#{f}")}
|
15
|
+
images = files.map {|f| Phashion::Image.new("#{File.dirname(__FILE__) + '/../test/jpg/'}#{f}")}
|
16
16
|
assert_duplicate images[0], images[1]
|
17
17
|
assert_duplicate images[1], images[2]
|
18
18
|
assert_duplicate images[0], images[2]
|
@@ -20,12 +20,21 @@ class TestPhashion < Test::Unit::TestCase
|
|
20
20
|
|
21
21
|
def test_not_duplicate
|
22
22
|
files = %w(86x86-0a1e.jpeg 86x86-83d6.jpeg 86x86-a855.jpeg avatar.jpg)
|
23
|
-
images = files.map {|f| Phashion::Image.new("#{File.dirname(__FILE__) + '/../test/'}#{f}")}
|
23
|
+
images = files.map {|f| Phashion::Image.new("#{File.dirname(__FILE__) + '/../test/jpg/'}#{f}")}
|
24
24
|
assert_not_duplicate images[0], images[3]
|
25
25
|
assert_not_duplicate images[1], images[3]
|
26
26
|
assert_not_duplicate images[2], images[3]
|
27
27
|
end
|
28
28
|
|
29
|
+
def test_multiple_types
|
30
|
+
jpg = Phashion::Image.new(File.dirname(__FILE__) + '/jpg/Broccoli_Super_Food.jpg')
|
31
|
+
png = Phashion::Image.new(File.dirname(__FILE__) + '/png/Broccoli_Super_Food.png')
|
32
|
+
gif = Phashion::Image.new(File.dirname(__FILE__) + '/gif/Broccoli_Super_Food.gif')
|
33
|
+
assert_duplicate jpg, png
|
34
|
+
assert_duplicate gif, png
|
35
|
+
assert_duplicate jpg, gif
|
36
|
+
end
|
37
|
+
|
29
38
|
private
|
30
39
|
|
31
40
|
def assert_duplicate(a, b)
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 3
|
9
|
+
version: 1.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Mike Perham
|
@@ -14,13 +14,14 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-01-28 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: rake-compiler
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
24
25
|
requirements:
|
25
26
|
- - ">="
|
26
27
|
- !ruby/object:Gem::Version
|
@@ -37,9 +38,8 @@ executables: []
|
|
37
38
|
|
38
39
|
extensions:
|
39
40
|
- ext/phashion_ext/extconf.rb
|
40
|
-
extra_rdoc_files:
|
41
|
-
|
42
|
-
- README.md
|
41
|
+
extra_rdoc_files: []
|
42
|
+
|
43
43
|
files:
|
44
44
|
- .document
|
45
45
|
- .gitignore
|
@@ -49,18 +49,21 @@ files:
|
|
49
49
|
- Rakefile
|
50
50
|
- TODO.md
|
51
51
|
- ext/phashion_ext/extconf.rb
|
52
|
-
- ext/phashion_ext/pHash-0.9.
|
52
|
+
- ext/phashion_ext/pHash-0.9.3.tar.gz
|
53
53
|
- ext/phashion_ext/phashion_ext.c
|
54
54
|
- lib/phashion.rb
|
55
55
|
- phashion.gemspec
|
56
|
-
- test/
|
57
|
-
- test/86x86-83d6.jpeg
|
58
|
-
- test/86x86-a855.jpeg
|
59
|
-
- test/avatar.jpg
|
60
|
-
- test/b32aade8c590e2d776c24f35868f0c7a588f51e1.jpeg
|
61
|
-
- test/df9cc82f5b32d7463f36620c61854fde9d939f7f.jpeg
|
62
|
-
- test/e7397898a7e395c2524978a5e64de0efabf08290.jpeg
|
56
|
+
- test/gif/Broccoli_Super_Food.gif
|
63
57
|
- test/helper.rb
|
58
|
+
- test/jpg/86x86-0a1e.jpeg
|
59
|
+
- test/jpg/86x86-83d6.jpeg
|
60
|
+
- test/jpg/86x86-a855.jpeg
|
61
|
+
- test/jpg/Broccoli_Super_Food.jpg
|
62
|
+
- test/jpg/avatar.jpg
|
63
|
+
- test/jpg/b32aade8c590e2d776c24f35868f0c7a588f51e1.jpeg
|
64
|
+
- test/jpg/df9cc82f5b32d7463f36620c61854fde9d939f7f.jpeg
|
65
|
+
- test/jpg/e7397898a7e395c2524978a5e64de0efabf08290.jpeg
|
66
|
+
- test/png/Broccoli_Super_Food.png
|
64
67
|
- test/test_phashion.rb
|
65
68
|
has_rdoc: true
|
66
69
|
homepage: http://github.com/mperham/phashion
|
@@ -72,6 +75,7 @@ rdoc_options:
|
|
72
75
|
require_paths:
|
73
76
|
- lib
|
74
77
|
required_ruby_version: !ruby/object:Gem::Requirement
|
78
|
+
none: false
|
75
79
|
requirements:
|
76
80
|
- - ">="
|
77
81
|
- !ruby/object:Gem::Version
|
@@ -79,6 +83,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
79
83
|
- 0
|
80
84
|
version: "0"
|
81
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
86
|
+
none: false
|
82
87
|
requirements:
|
83
88
|
- - ">="
|
84
89
|
- !ruby/object:Gem::Version
|
@@ -88,10 +93,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
93
|
requirements: []
|
89
94
|
|
90
95
|
rubyforge_project:
|
91
|
-
rubygems_version: 1.3.
|
96
|
+
rubygems_version: 1.3.7
|
92
97
|
signing_key:
|
93
98
|
specification_version: 3
|
94
99
|
summary: Simple wrapper around the pHash library
|
95
100
|
test_files:
|
101
|
+
- test/gif/Broccoli_Super_Food.gif
|
96
102
|
- test/helper.rb
|
103
|
+
- test/jpg/86x86-0a1e.jpeg
|
104
|
+
- test/jpg/86x86-83d6.jpeg
|
105
|
+
- test/jpg/86x86-a855.jpeg
|
106
|
+
- test/jpg/Broccoli_Super_Food.jpg
|
107
|
+
- test/jpg/avatar.jpg
|
108
|
+
- test/jpg/b32aade8c590e2d776c24f35868f0c7a588f51e1.jpeg
|
109
|
+
- test/jpg/df9cc82f5b32d7463f36620c61854fde9d939f7f.jpeg
|
110
|
+
- test/jpg/e7397898a7e395c2524978a5e64de0efabf08290.jpeg
|
111
|
+
- test/png/Broccoli_Super_Food.png
|
97
112
|
- test/test_phashion.rb
|
Binary file
|