shrine-color 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.tool-versions +1 -0
- data/.travis.yml +15 -4
- data/Gemfile.lock +11 -5
- data/README.md +6 -10
- data/shrine-color.gemspec +3 -3
- data/spec/shrine/color_spec.rb +3 -3
- metadata +13 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e550ac006c2a7ac816625aeaef866cdc67419e578a4b70907efb51142dff23e
|
4
|
+
data.tar.gz: b57648c6b7eeb721334dd7f53d1df3a3c2f0d926e04da30baaf94b9c86104e1d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9160ea73134a5b8d344feb8678553328b94ccf8bb835bd123ef86e3085897409378301dc669a2cbd57a60d7e0750e58ba147c43f6c26aedfbe32b5ae7b66e915
|
7
|
+
data.tar.gz: 233ea4d3fef53c2ef0ec8d600f2609c0ff52811b96904b1131a69532de0c2ff3b1f1761d61bc899fd5e64c1ee51a6144e16f4769006f62cb0e9542cf84b49c25
|
data/.tool-versions
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby 2.6.5
|
data/.travis.yml
CHANGED
@@ -1,7 +1,18 @@
|
|
1
|
+
dist: bionic
|
1
2
|
language: ruby
|
2
3
|
rvm:
|
3
|
-
|
4
|
-
|
5
|
-
|
4
|
+
- 2.6
|
5
|
+
- 2.5
|
6
|
+
- 2.4
|
7
|
+
- 2.3
|
8
|
+
before_install:
|
9
|
+
- wget http://ftp.acc.umu.se/mirror/imagemagick.org/ftp/releases/ImageMagick-7.0.8-68.tar.gz -O ImageMagick.tar.gz
|
10
|
+
- tar -xf ImageMagick.tar.gz
|
11
|
+
- ls ImageMagick*
|
12
|
+
- cd ImageMagick-7.0.8-68
|
13
|
+
- ./configure --prefix=/usr
|
14
|
+
- make
|
15
|
+
- sudo make install
|
16
|
+
- cd ..
|
6
17
|
before_script:
|
7
|
-
|
18
|
+
- convert -version
|
data/Gemfile.lock
CHANGED
@@ -1,18 +1,23 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
shrine-color (0.3.
|
4
|
+
shrine-color (0.3.1)
|
5
5
|
jnylen-colorscore (~> 0.1, >= 0.1.3)
|
6
|
-
shrine (
|
6
|
+
shrine (>= 2.0, <= 4.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
+
addressable (2.7.0)
|
12
|
+
public_suffix (>= 2.0.2, < 5.0)
|
11
13
|
color (1.8)
|
14
|
+
content_disposition (1.0.0)
|
12
15
|
diff-lcs (1.2.5)
|
13
|
-
down (4.
|
16
|
+
down (4.8.1)
|
17
|
+
addressable (~> 2.5)
|
14
18
|
jnylen-colorscore (0.1.3)
|
15
19
|
color
|
20
|
+
public_suffix (4.0.1)
|
16
21
|
rake (11.2.2)
|
17
22
|
rspec (3.5.0)
|
18
23
|
rspec-core (~> 3.5.0)
|
@@ -27,7 +32,8 @@ GEM
|
|
27
32
|
diff-lcs (>= 1.2.0, < 2.0)
|
28
33
|
rspec-support (~> 3.5.0)
|
29
34
|
rspec-support (3.5.0)
|
30
|
-
shrine (2.
|
35
|
+
shrine (2.19.3)
|
36
|
+
content_disposition (~> 1.0)
|
31
37
|
down (~> 4.1)
|
32
38
|
|
33
39
|
PLATFORMS
|
@@ -40,4 +46,4 @@ DEPENDENCIES
|
|
40
46
|
shrine-color!
|
41
47
|
|
42
48
|
BUNDLED WITH
|
43
|
-
1.
|
49
|
+
1.17.2
|
data/README.md
CHANGED
@@ -1,21 +1,17 @@
|
|
1
|
-
Shrine Color
|
2
|
-
=================
|
1
|
+
# Shrine Color
|
3
2
|
|
4
3
|
Get the dominant color of an image using colorscore (updated version by me). This can be used as a background color while an image is loading or search by color.
|
5
4
|
|
6
5
|
This is based on carrierwave-color by Sunny Ripert (sunny).
|
7
6
|
|
8
|
-
NOTE: The palettes/dominiant_color grabbed from images may differ between imagemagick versions
|
7
|
+
**NOTE: The palettes/dominiant_color grabbed from images may differ between imagemagick versions.**
|
9
8
|
|
10
|
-
Requirements
|
11
|
-
------------
|
9
|
+
## Requirements
|
12
10
|
|
13
11
|
This gem requires imagemagick (convert) and grabs colors via a command line.
|
14
12
|
So mini_magick, etc. isn't required.
|
15
13
|
|
16
|
-
|
17
|
-
Installation
|
18
|
-
------------
|
14
|
+
## Installation
|
19
15
|
|
20
16
|
Add this line to your application's Gemfile:
|
21
17
|
|
@@ -29,8 +25,7 @@ And then call:
|
|
29
25
|
$ bundle
|
30
26
|
```
|
31
27
|
|
32
|
-
Add the plugin to your uploader
|
33
|
-
--------------------------------
|
28
|
+
## Add the plugin to your uploader
|
34
29
|
|
35
30
|
In your uploader, include the module and call the processor:
|
36
31
|
|
@@ -55,6 +50,7 @@ end
|
|
55
50
|
```
|
56
51
|
|
57
52
|
You can now use the code below to get a color:
|
53
|
+
|
58
54
|
```ruby
|
59
55
|
## Dominant color
|
60
56
|
photo.image[:small].metadata["dominant_color"]
|
data/shrine-color.gemspec
CHANGED
@@ -3,9 +3,9 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = "shrine-color"
|
6
|
-
spec.version = "0.3.
|
6
|
+
spec.version = "0.3.1"
|
7
7
|
spec.authors = ["Joakim Nylen"]
|
8
|
-
spec.email = ["
|
8
|
+
spec.email = ["rubygems@joakim.nylen.nu"]
|
9
9
|
spec.summary = "Return the dominant color of an image in Shrine."
|
10
10
|
spec.description = "Return the dominant color of an image in Shrine."
|
11
11
|
spec.homepage = "https://github.com/jnylen/shrine-color"
|
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.files = `git ls-files -z`.split("\x0")
|
15
15
|
spec.require_paths = ["lib"]
|
16
16
|
|
17
|
-
spec.add_dependency "shrine", "
|
17
|
+
spec.add_dependency "shrine", ">= 2.0", "<= 4.0"
|
18
18
|
spec.add_dependency "jnylen-colorscore", "~> 0.1", ">= 0.1.3"
|
19
19
|
|
20
20
|
spec.add_development_dependency "bundler", "~> 1.12"
|
data/spec/shrine/color_spec.rb
CHANGED
@@ -12,7 +12,7 @@ describe Shrine::Plugins::Color do
|
|
12
12
|
it "extracts dominant_color from files via add_metadata" do
|
13
13
|
@uploader.class.add_metadata(:dominant_color) { |io, context| dominant_color(io.path) }
|
14
14
|
uploaded_file = @uploader.upload(File.open("spec/fixtures/bora.jpg"))
|
15
|
-
expect(uploaded_file.metadata.fetch("dominant_color")).to eq("#
|
15
|
+
expect(uploaded_file.metadata.fetch("dominant_color")).to eq("#75537c")
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
@@ -32,13 +32,13 @@ describe Shrine::Plugins::Color do
|
|
32
32
|
it "extracts 3 palette_colors from files with default hexes via add_metadata" do
|
33
33
|
@uploader.class.add_metadata(:palette_color) { |io, context| palette_color(io.path, 3) }
|
34
34
|
uploaded_file = @uploader.upload(File.open("spec/fixtures/bora.jpg"))
|
35
|
-
expect(uploaded_file.metadata.fetch("palette_color")).to eq(["#333399", "#
|
35
|
+
expect(uploaded_file.metadata.fetch("palette_color")).to eq(["#333399", "#663399", "#993399"])
|
36
36
|
end
|
37
37
|
|
38
38
|
it "extracts 3 palette_colors from files with custom hexes via add_metadata" do
|
39
39
|
@uploader.class.add_metadata(:palette_color) { |io, context| palette_color(io.path, 3, ['ff0000', '00ff00', '0000ff']) }
|
40
40
|
uploaded_file = @uploader.upload(File.open("spec/fixtures/bora.jpg"))
|
41
|
-
expect(uploaded_file.metadata.fetch("palette_color")).to eq(["#0000ff", "#
|
41
|
+
expect(uploaded_file.metadata.fetch("palette_color")).to eq(["#0000ff", "#ff0000"])
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shrine-color
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joakim Nylen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: shrine
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2.0'
|
20
|
+
- - "<="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '4.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '2.0'
|
30
|
+
- - "<="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '4.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: jnylen-colorscore
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,12 +94,13 @@ dependencies:
|
|
88
94
|
version: '3.0'
|
89
95
|
description: Return the dominant color of an image in Shrine.
|
90
96
|
email:
|
91
|
-
-
|
97
|
+
- rubygems@joakim.nylen.nu
|
92
98
|
executables: []
|
93
99
|
extensions: []
|
94
100
|
extra_rdoc_files: []
|
95
101
|
files:
|
96
102
|
- ".gitignore"
|
103
|
+
- ".tool-versions"
|
97
104
|
- ".travis.yml"
|
98
105
|
- Gemfile
|
99
106
|
- Gemfile.lock
|
@@ -124,8 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
131
|
- !ruby/object:Gem::Version
|
125
132
|
version: '0'
|
126
133
|
requirements: []
|
127
|
-
|
128
|
-
rubygems_version: 2.7.7
|
134
|
+
rubygems_version: 3.0.3
|
129
135
|
signing_key:
|
130
136
|
specification_version: 4
|
131
137
|
summary: Return the dominant color of an image in Shrine.
|