rails_dominant_colors 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +24 -0
- data/.rspec +3 -0
- data/.rubocop.yml +28 -0
- data/.travis.yml +6 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +58 -0
- data/LICENSE.txt +21 -0
- data/README.md +48 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/rails_dominant_colors/base.rb +137 -0
- data/lib/rails_dominant_colors/base64.rb +33 -0
- data/lib/rails_dominant_colors/path.rb +24 -0
- data/lib/rails_dominant_colors/url.rb +55 -0
- data/lib/rails_dominant_colors/version.rb +5 -0
- data/lib/rails_dominant_colors.rb +22 -0
- data/rails_dominant_colors.gemspec +38 -0
- metadata +149 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b3d29a8561ce7e4e3be8d53818c5957f1508f04ff890b4faa8c8b9c0753e5c5f
|
4
|
+
data.tar.gz: 7c4fb0ba739696b70076aacd6c9f00253bfdcb675a018da183aaac762228ae4b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 7320c72aa7112c3a1b4fda7da76f9fb5fd639155b3647b4b9ce7c5e9b4d2fd826da19cae61ffbb1bfcac2e3582a5bbe0c361b38a0cd5988061101392c5db6f76
|
7
|
+
data.tar.gz: f189a796a45c4f8653ec625e935fa7b78ec0d0e0536de81c6b5264a9ca3e754ec4725f1d0451699000b47302e74477b697ea2354a4e6b6e1e885986e3a3ccb44
|
data/.gitignore
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
|
+
/coverage/
|
5
|
+
/doc/
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/tmp/
|
9
|
+
|
10
|
+
# rspec failure tracking
|
11
|
+
.rspec_status
|
12
|
+
|
13
|
+
# IDE
|
14
|
+
/.idea
|
15
|
+
.idea/workspace.xml
|
16
|
+
.rakeTasks
|
17
|
+
.generators
|
18
|
+
|
19
|
+
# Gem
|
20
|
+
*.gem
|
21
|
+
|
22
|
+
# Logs
|
23
|
+
spec/dummy/log/*.log
|
24
|
+
spec/dummy/tmp/
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
Documentation:
|
2
|
+
Enabled: false
|
3
|
+
Metrics/LineLength:
|
4
|
+
IgnoredPatterns: ['(\A|\s)#']
|
5
|
+
Max: 120
|
6
|
+
Layout/EmptyLineAfterGuardClause:
|
7
|
+
Enabled: false
|
8
|
+
Layout/EmptyLinesAroundBlockBody:
|
9
|
+
Enabled: false
|
10
|
+
Metrics/MethodLength:
|
11
|
+
Max: 20
|
12
|
+
Metrics/BlockLength:
|
13
|
+
Max: 30
|
14
|
+
Metrics/AbcSize:
|
15
|
+
Max: 20
|
16
|
+
Metrics/CyclomaticComplexity:
|
17
|
+
Max: 20
|
18
|
+
Style/RegexpLiteral:
|
19
|
+
EnforcedStyle: percent_r
|
20
|
+
Naming/MethodParameterName:
|
21
|
+
AllowedNames:
|
22
|
+
- 'r'
|
23
|
+
- 'g'
|
24
|
+
- 'b'
|
25
|
+
- 'a'
|
26
|
+
- 'h'
|
27
|
+
- 's'
|
28
|
+
- 'l'
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rails_dominant_colors (0.1.0)
|
5
|
+
mini_magick (~> 4.10)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
coveralls (0.8.23)
|
11
|
+
json (>= 1.8, < 3)
|
12
|
+
simplecov (~> 0.16.1)
|
13
|
+
term-ansicolor (~> 1.3)
|
14
|
+
thor (>= 0.19.4, < 2.0)
|
15
|
+
tins (~> 1.6)
|
16
|
+
diff-lcs (1.3)
|
17
|
+
docile (1.3.2)
|
18
|
+
json (2.3.0)
|
19
|
+
mini_magick (4.10.1)
|
20
|
+
rake (13.0.1)
|
21
|
+
rspec (3.9.0)
|
22
|
+
rspec-core (~> 3.9.0)
|
23
|
+
rspec-expectations (~> 3.9.0)
|
24
|
+
rspec-mocks (~> 3.9.0)
|
25
|
+
rspec-core (3.9.1)
|
26
|
+
rspec-support (~> 3.9.1)
|
27
|
+
rspec-expectations (3.9.1)
|
28
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
+
rspec-support (~> 3.9.0)
|
30
|
+
rspec-mocks (3.9.1)
|
31
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
+
rspec-support (~> 3.9.0)
|
33
|
+
rspec-support (3.9.2)
|
34
|
+
simplecov (0.16.1)
|
35
|
+
docile (~> 1.1)
|
36
|
+
json (>= 1.8, < 3)
|
37
|
+
simplecov-html (~> 0.10.0)
|
38
|
+
simplecov-html (0.10.2)
|
39
|
+
sync (0.5.0)
|
40
|
+
term-ansicolor (1.7.1)
|
41
|
+
tins (~> 1.0)
|
42
|
+
thor (1.0.1)
|
43
|
+
tins (1.24.1)
|
44
|
+
sync
|
45
|
+
|
46
|
+
PLATFORMS
|
47
|
+
ruby
|
48
|
+
|
49
|
+
DEPENDENCIES
|
50
|
+
bundler (~> 2.0)
|
51
|
+
coveralls (~> 0.8)
|
52
|
+
rails_dominant_colors!
|
53
|
+
rake (~> 13.0)
|
54
|
+
rspec (~> 3.9)
|
55
|
+
simplecov (~> 0.16)
|
56
|
+
|
57
|
+
BUNDLED WITH
|
58
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 OpenGems
|
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
|
13
|
+
all 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
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# RailsDominantColors
|
2
|
+
|
3
|
+
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/rails_dominant_colors.svg)](https://badge.fury.io/rb/rails_dominant_colors)
|
5
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/79cdc15c16da15562c25/maintainability)](https://codeclimate.com/github/OpenGems/rails_dominant_colors/maintainability)
|
6
|
+
[![Build Status](https://travis-ci.org/OpenGems/rails_dominant_colors.svg?branch=master)](https://travis-ci.org/OpenGems/rails_dominant_colors)
|
7
|
+
[![security](https://hakiri.io/github/OpenGems/rails_dominant_colors/master.svg)](https://hakiri.io/github/OpenGems/rails_dominant_colors/master)
|
8
|
+
![Gem](https://img.shields.io/gem/dt/rails_dominant_colors)
|
9
|
+
[![Coverage Status](https://coveralls.io/repos/github/OpenGems/rails_dominant_colors/badge.svg?branch=master)](https://coveralls.io/github/OpenGems/rails_dominant_colors?branch=master)
|
10
|
+
|
11
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rails_dominant_colors`. To experiment with that code, run `bin/console` for an interactive prompt.
|
12
|
+
|
13
|
+
TODO: Delete this and the text above, and describe your gem
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'rails_dominant_colors'
|
21
|
+
```
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
$ bundle install
|
26
|
+
|
27
|
+
Or install it yourself as:
|
28
|
+
|
29
|
+
$ gem install rails_dominant_colors
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
TODO: Write usage instructions here
|
34
|
+
|
35
|
+
## Development
|
36
|
+
|
37
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
38
|
+
|
39
|
+
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 tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
40
|
+
|
41
|
+
## Contributing
|
42
|
+
|
43
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rails_dominant_colors.
|
44
|
+
|
45
|
+
|
46
|
+
## License
|
47
|
+
|
48
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'rails_dominant_colors'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'mini_magick'
|
4
|
+
|
5
|
+
module RailsDominantColors
|
6
|
+
class Base
|
7
|
+
InvalidBase64 = Class.new(StandardError)
|
8
|
+
FileNotFound = Class.new(StandardError)
|
9
|
+
UrlNotFound = Class.new(StandardError)
|
10
|
+
InvalidUrl = Class.new(StandardError)
|
11
|
+
NotAnImage = Class.new(StandardError)
|
12
|
+
EmptySource = Class.new(StandardError)
|
13
|
+
|
14
|
+
attr_reader(:source, :colors)
|
15
|
+
|
16
|
+
def initialize(source, opts = {})
|
17
|
+
@source = source
|
18
|
+
@colors = opts.fetch(:colors) { 5 }
|
19
|
+
end
|
20
|
+
|
21
|
+
def to_hex_alpha
|
22
|
+
@to_hex_alpha ||= sort_by_size.map { |x| x[:hex] }
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_hex
|
26
|
+
@to_hex ||= sort_by_size.map { |x| x[:hex][0..6] }
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_rgb_alpha
|
30
|
+
@to_rgb_alpha ||= sort_by_size.map { |x| [x[:r], x[:g], x[:b], x[:a]] }
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_rgb
|
34
|
+
@to_rgb ||= sort_by_size.map { |x| [x[:r], x[:g], x[:b]] }
|
35
|
+
end
|
36
|
+
|
37
|
+
def to_hsl_alpha
|
38
|
+
@to_hsl_alpha ||= sort_by_size.map { |x| rgb_to_hsl(x[:r], x[:g], x[:b], x[:a]) }
|
39
|
+
end
|
40
|
+
|
41
|
+
def to_hsl
|
42
|
+
@to_hsl ||= sort_by_size.map { |x| rgb_to_hsl(x[:r], x[:g], x[:b]) }
|
43
|
+
end
|
44
|
+
|
45
|
+
def to_pct
|
46
|
+
@to_pct ||= sort_by_size.map { |x| ((x[:size].to_f / total) * 100).round(2) }
|
47
|
+
end
|
48
|
+
|
49
|
+
private
|
50
|
+
|
51
|
+
def extensions
|
52
|
+
@extensions ||= {
|
53
|
+
'image/png': '.png',
|
54
|
+
'image/jpeg': '.jpg',
|
55
|
+
'image/jpg': '.jpg',
|
56
|
+
'image/gif': '.gif',
|
57
|
+
'image/bmp': '.bmp',
|
58
|
+
'image/tiff': '.tif'
|
59
|
+
}
|
60
|
+
end
|
61
|
+
|
62
|
+
def image
|
63
|
+
@image ||= ::MiniMagick::Image.open(source)
|
64
|
+
end
|
65
|
+
|
66
|
+
def execute
|
67
|
+
@execute ||= image.run_command(
|
68
|
+
'convert',
|
69
|
+
image.path,
|
70
|
+
'-format',
|
71
|
+
'%c',
|
72
|
+
'-colors',
|
73
|
+
colors,
|
74
|
+
'-depth',
|
75
|
+
8,
|
76
|
+
'-alpha',
|
77
|
+
'on',
|
78
|
+
'histogram:info:'
|
79
|
+
)
|
80
|
+
end
|
81
|
+
|
82
|
+
def sort_by_size
|
83
|
+
@sort_by_size ||= parse.sort_by { |x| x[:size] }.reverse
|
84
|
+
end
|
85
|
+
|
86
|
+
def total
|
87
|
+
@total ||= sort_by_size.map { |x| x[:size] }.reduce(:+)
|
88
|
+
end
|
89
|
+
|
90
|
+
def parse
|
91
|
+
@parse ||= execute.split("\n").map { |l| l.gsub(%r{\s}, '') }.map do |l|
|
92
|
+
match = l.match(
|
93
|
+
%r{(?<size>[0-9]+):\((?<r>[0-9]+),(?<g>[0-9]+),(?<b>[0-9]+)[,]*(?<a>[0-9]+)\)(?<hex>#[0-9A-F]+)}
|
94
|
+
)
|
95
|
+
format_color(match)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
def format_color(color)
|
100
|
+
{
|
101
|
+
size: color[:size].to_i,
|
102
|
+
r: color[:r].to_i,
|
103
|
+
g: color[:g].to_i,
|
104
|
+
b: color[:b].to_i,
|
105
|
+
a: (color[:a].to_f / 255).round(2),
|
106
|
+
hex: color[:hex]
|
107
|
+
}
|
108
|
+
end
|
109
|
+
|
110
|
+
# FIXME: refactor
|
111
|
+
def rgb_to_hsl(r, g, b, a = nil)
|
112
|
+
r /= 255.0
|
113
|
+
g /= 255.0
|
114
|
+
b /= 255.0
|
115
|
+
|
116
|
+
max = [r, g, b].max
|
117
|
+
min = [r, g, b].min
|
118
|
+
|
119
|
+
l = (max + min) / 2.0
|
120
|
+
|
121
|
+
if max == min
|
122
|
+
s = h = 0
|
123
|
+
else
|
124
|
+
d = max - min
|
125
|
+
s = l >= 0.5 ? d / (2.0 - max - min) : d / (max + min)
|
126
|
+
h = case max
|
127
|
+
when r then (g - b) / d + (g < b ? 6.0 : 0)
|
128
|
+
when g then (b - r) / d + 2.0
|
129
|
+
when b then (r - g) / d + 4.0
|
130
|
+
end
|
131
|
+
h /= 6.0
|
132
|
+
end
|
133
|
+
|
134
|
+
[(h * 360).round, (s * 100).round, (l * 100).round, a].compact
|
135
|
+
end
|
136
|
+
end
|
137
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'base64'
|
4
|
+
|
5
|
+
module RailsDominantColors
|
6
|
+
class Base64 < Base
|
7
|
+
def initialize(source, opts = {})
|
8
|
+
raise(EmptySource) if source.nil? || source.empty?
|
9
|
+
|
10
|
+
super(process(source), opts)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def process(source)
|
16
|
+
res = source.match(%r{data:(?<type>[-\w]+/[-\w+.]+)?;base64,(?<content>.*)})
|
17
|
+
raise(InvalidBase64) if res.nil?
|
18
|
+
|
19
|
+
content_type = res[:type].to_sym
|
20
|
+
extension = extensions[content_type]
|
21
|
+
raise(NotAnImage) if extension.nil?
|
22
|
+
|
23
|
+
tempfile(extension, ::Base64.decode64(res[:content]))
|
24
|
+
end
|
25
|
+
|
26
|
+
def tempfile(extension, body)
|
27
|
+
tempfile = Tempfile.open(['source', ".#{extension}"])
|
28
|
+
tempfile.write(body)
|
29
|
+
tempfile.close
|
30
|
+
tempfile.path
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RailsDominantColors
|
4
|
+
class Path < Base
|
5
|
+
def initialize(source, opts = {})
|
6
|
+
raise(EmptySource) if source.nil? || source.empty?
|
7
|
+
raise(FileNotFound) unless file_exist?(source)
|
8
|
+
raise(NotAnImage) unless file_is_image?(source)
|
9
|
+
|
10
|
+
super(source, opts)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def file_exist?(source)
|
16
|
+
File.exist?(source)
|
17
|
+
end
|
18
|
+
|
19
|
+
def file_is_image?(source)
|
20
|
+
extension = File.extname(source)
|
21
|
+
extensions.values.include?(extension)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'net/http'
|
4
|
+
|
5
|
+
module RailsDominantColors
|
6
|
+
class Url < Base
|
7
|
+
def initialize(source, opts = {})
|
8
|
+
raise(EmptySource) if source.nil? || source.empty?
|
9
|
+
|
10
|
+
super(process(source), opts)
|
11
|
+
end
|
12
|
+
|
13
|
+
def process(source)
|
14
|
+
raise(InvalidUrl) unless valid_url?(source)
|
15
|
+
|
16
|
+
ri = remote_image(source)
|
17
|
+
content_type = ri.content_type.to_sym
|
18
|
+
extension = extensions[content_type]
|
19
|
+
|
20
|
+
raise(NotAnImage) if extension.nil?
|
21
|
+
|
22
|
+
tempfile(extension, ri.body)
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def remote_image(url)
|
28
|
+
uri = uri(url)
|
29
|
+
req = Net::HTTP::Get.new(uri.to_s)
|
30
|
+
ssl = uri.scheme == 'https'
|
31
|
+
Net::HTTP.start(uri.host, uri.port, use_ssl: ssl) do |http|
|
32
|
+
http.request(req)
|
33
|
+
end
|
34
|
+
rescue StandardError
|
35
|
+
raise(UrlNotFound)
|
36
|
+
end
|
37
|
+
|
38
|
+
def valid_url?(url)
|
39
|
+
url =~ URI::DEFAULT_PARSER.make_regexp(%w[http https])
|
40
|
+
end
|
41
|
+
|
42
|
+
def uri(url)
|
43
|
+
URI.parse(url)
|
44
|
+
rescue StandardError
|
45
|
+
raise(InvalidUrl)
|
46
|
+
end
|
47
|
+
|
48
|
+
def tempfile(extension, body)
|
49
|
+
tempfile = Tempfile.open(['source', extension])
|
50
|
+
tempfile.write(body)
|
51
|
+
tempfile.close
|
52
|
+
tempfile.path
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails_dominant_colors/base'
|
4
|
+
require 'rails_dominant_colors/base64'
|
5
|
+
require 'rails_dominant_colors/path'
|
6
|
+
require 'rails_dominant_colors/url'
|
7
|
+
|
8
|
+
module RailsDominantColors
|
9
|
+
class << self
|
10
|
+
def base64(source, opts = {})
|
11
|
+
RailsDominantColors::Base64.new(source, opts)
|
12
|
+
end
|
13
|
+
|
14
|
+
def url(source, opts = {})
|
15
|
+
RailsDominantColors::Url.new(source, opts)
|
16
|
+
end
|
17
|
+
|
18
|
+
def path(source, opts = {})
|
19
|
+
RailsDominantColors::Path.new(source, opts)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative 'lib/rails_dominant_colors/version'
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = 'rails_dominant_colors'
|
7
|
+
spec.version = RailsDominantColors::VERSION
|
8
|
+
spec.authors = ['Boris BRESCIANI']
|
9
|
+
spec.email = ['boris2bresciani@gmail.com']
|
10
|
+
|
11
|
+
spec.summary = 'Extract the dominant color(s) from an image'
|
12
|
+
spec.description = <<~TEXT
|
13
|
+
Extract the dominant color(s) from an image (remote image, locally image, base64 image etc...)
|
14
|
+
Convert to HEX(A), RGB(A), HSL(a)'
|
15
|
+
TEXT
|
16
|
+
|
17
|
+
spec.homepage = 'https://github.com/OpenGems/rails_dominant_colors'
|
18
|
+
spec.license = 'MIT'
|
19
|
+
|
20
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
21
|
+
spec.metadata['source_code_uri'] = spec.homepage
|
22
|
+
|
23
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
24
|
+
`git ls-files -z`.split("\x0")
|
25
|
+
.reject { |f| f.match(%r{^(test|spec|features)/}) }
|
26
|
+
end
|
27
|
+
spec.bindir = 'exe'
|
28
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
|
+
spec.require_paths = ['lib']
|
30
|
+
|
31
|
+
spec.add_development_dependency 'bundler', '~> 2.0'
|
32
|
+
spec.add_development_dependency 'coveralls', '~> 0.8'
|
33
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
34
|
+
spec.add_development_dependency 'rspec', '~> 3.9'
|
35
|
+
spec.add_development_dependency 'simplecov', '~> 0.16'
|
36
|
+
|
37
|
+
spec.add_dependency 'mini_magick', '~> 4.10'
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,149 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails_dominant_colors
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Boris BRESCIANI
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-05-02 00:00:00.000000000 Z
|
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.0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: coveralls
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.8'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '13.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '13.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.9'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.9'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.16'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.16'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: mini_magick
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '4.10'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '4.10'
|
97
|
+
description: |
|
98
|
+
Extract the dominant color(s) from an image (remote image, locally image, base64 image etc...)
|
99
|
+
Convert to HEX(A), RGB(A), HSL(a)'
|
100
|
+
email:
|
101
|
+
- boris2bresciani@gmail.com
|
102
|
+
executables: []
|
103
|
+
extensions: []
|
104
|
+
extra_rdoc_files: []
|
105
|
+
files:
|
106
|
+
- ".gitignore"
|
107
|
+
- ".rspec"
|
108
|
+
- ".rubocop.yml"
|
109
|
+
- ".travis.yml"
|
110
|
+
- Gemfile
|
111
|
+
- Gemfile.lock
|
112
|
+
- LICENSE.txt
|
113
|
+
- README.md
|
114
|
+
- Rakefile
|
115
|
+
- bin/console
|
116
|
+
- bin/setup
|
117
|
+
- lib/rails_dominant_colors.rb
|
118
|
+
- lib/rails_dominant_colors/base.rb
|
119
|
+
- lib/rails_dominant_colors/base64.rb
|
120
|
+
- lib/rails_dominant_colors/path.rb
|
121
|
+
- lib/rails_dominant_colors/url.rb
|
122
|
+
- lib/rails_dominant_colors/version.rb
|
123
|
+
- rails_dominant_colors.gemspec
|
124
|
+
homepage: https://github.com/OpenGems/rails_dominant_colors
|
125
|
+
licenses:
|
126
|
+
- MIT
|
127
|
+
metadata:
|
128
|
+
homepage_uri: https://github.com/OpenGems/rails_dominant_colors
|
129
|
+
source_code_uri: https://github.com/OpenGems/rails_dominant_colors
|
130
|
+
post_install_message:
|
131
|
+
rdoc_options: []
|
132
|
+
require_paths:
|
133
|
+
- lib
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
requirements: []
|
145
|
+
rubygems_version: 3.1.2
|
146
|
+
signing_key:
|
147
|
+
specification_version: 4
|
148
|
+
summary: Extract the dominant color(s) from an image
|
149
|
+
test_files: []
|