ruby_identicon 0.0.4 → 0.0.5
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 +4 -4
- data/.travis.yml +4 -0
- data/README.md +6 -2
- data/lib/ruby_identicon.rb +2 -2
- data/lib/ruby_identicon/version.rb +1 -1
- data/ruby_identicon.gemspec +2 -2
- data/spec/ruby_identicon_spec.rb +5 -5
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a90de8454924cf7a6f3c771e462d891370b7e5a9
|
4
|
+
data.tar.gz: d96b2735908688e1694121bf624bcb6516159a34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd7f108d3c58c407fef0f947f709c6cba9b510b7971e9f33cfdd2e547a6a3feacdb98e60af44cacf1064e5dd8470592a5f40fca039f8e1adc8f5a6f81fcfaea5
|
7
|
+
data.tar.gz: 12b34f2b8a9ee03721add7fe5546f68045ef0f5c90fb9dbf5a715c3c59794d9482bb2f32cf75aa04ed06aae7cb565d4ac0f92792f40e87ee8a6f2a3a3d51f74a
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -42,13 +42,17 @@ Creating an identicon and returning a binary string
|
|
42
42
|
|
43
43
|
Creating an identicon and returns in base64 format
|
44
44
|
|
45
|
-
|
45
|
+
base64_identicon = RubyIdenticon.create_base64("RubyIdenticon")
|
46
|
+
|
47
|
+
nb// to render this in html pass the base64 code into your view
|
48
|
+
|
49
|
+
raw "<img src='data:image/png;base64,#{base64_identicon}'>"
|
46
50
|
|
47
51
|
## Customising the identicon
|
48
52
|
|
49
53
|
The identicon can be customised by passing additional options
|
50
54
|
|
51
|
-
background_color: (Integer, default 0) the background color of the identicon in rgba notation (e.g.
|
55
|
+
background_color: (Integer, default 0) the background color of the identicon in rgba notation (e.g. 0xffffffff for white)
|
52
56
|
border_size: (Integer, default 35) the size in pixels to leave as an empty border around the identicon image
|
53
57
|
grid_size: (Integer, default 7) the number of rows and columns in the identicon, minimum 4, maximum 9
|
54
58
|
square_size: (Integer, default 50) the size in pixels of each square that makes up the identicon
|
data/lib/ruby_identicon.rb
CHANGED
@@ -120,11 +120,11 @@ module RubyIdenticon
|
|
120
120
|
y = options[:border_size] + (sqy * options[:square_size])
|
121
121
|
|
122
122
|
# left hand side
|
123
|
-
png.rect(x, y, x + options[:square_size], y + options[:square_size], color, color)
|
123
|
+
png.rect(x, y, x + options[:square_size] - 1, y + options[:square_size] - 1, color, color)
|
124
124
|
|
125
125
|
# mirror right hand side
|
126
126
|
x = options[:border_size] + ((options[:grid_size] - 1 - sqx) * options[:square_size])
|
127
|
-
png.rect(x, y, x + options[:square_size], y + options[:square_size], color, color)
|
127
|
+
png.rect(x, y, x + options[:square_size] - 1, y + options[:square_size] - 1, color, color)
|
128
128
|
end
|
129
129
|
|
130
130
|
hash >>= 1
|
data/ruby_identicon.gemspec
CHANGED
@@ -33,8 +33,8 @@ Gem::Specification.new do |spec|
|
|
33
33
|
|
34
34
|
spec.add_development_dependency "bundler", "~> 1.5"
|
35
35
|
spec.add_development_dependency "rake"
|
36
|
-
spec.add_development_dependency "rspec", "~>
|
36
|
+
spec.add_development_dependency "rspec", "~> 3.4.0"
|
37
37
|
spec.add_development_dependency "yard", "~> 0.8.7"
|
38
38
|
|
39
|
-
spec.add_dependency "chunky_png", "~> 1.3.
|
39
|
+
spec.add_dependency "chunky_png", "~> 1.3.5"
|
40
40
|
end
|
data/spec/ruby_identicon_spec.rb
CHANGED
@@ -35,27 +35,27 @@ describe RubyIdenticon do
|
|
35
35
|
it 'creates a png image file' do
|
36
36
|
blob = RubyIdenticon.create('RubyIdenticon')
|
37
37
|
result = File.open('tmp/ruby_identicon.png', 'wb') { |f| f.write(blob) }
|
38
|
-
expect(result).to
|
38
|
+
expect(result).to be_truthy
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'creates a png image file of grid size 5, square size 70 and grey background' do
|
42
42
|
blob = RubyIdenticon.create('RubyIdenticon', grid_size: 5, square_size: 70, background_color: 0xf0f0f0ff, key: '1234567890123456')
|
43
43
|
result = File.open('tmp/ruby_identicon_gs5_white.png', 'wb') { |f| f.write(blob) }
|
44
|
-
expect(result).to
|
44
|
+
expect(result).to be_truthy
|
45
45
|
end
|
46
46
|
|
47
47
|
it 'creates 10 png image files' do
|
48
48
|
10.times do |count|
|
49
49
|
blob = RubyIdenticon.create("RubyIdenticon_#{count}")
|
50
50
|
result = File.open("tmp/ruby_identicon_#{count}.png", 'wb') { |f| f.write(blob) }
|
51
|
-
expect(result).to
|
51
|
+
expect(result).to be_truthy
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
55
55
|
# file creation tests
|
56
56
|
it 'creates a png image file via create_and_save' do
|
57
57
|
result = RubyIdenticon.create_and_save('RubyIdenticon is fun', 'tmp/test_identicon.png')
|
58
|
-
expect(result).to
|
58
|
+
expect(result).to be_truthy
|
59
59
|
end
|
60
60
|
|
61
61
|
it 'does not create a png image file via create_and_save with an invalid filename' do
|
@@ -70,6 +70,6 @@ describe RubyIdenticon do
|
|
70
70
|
it 'creates base64 version of the image' do
|
71
71
|
blob = RubyIdenticon.create('RubyIdenticon')
|
72
72
|
base64 = RubyIdenticon.create_base64('RubyIdenticon')
|
73
|
-
expect(Base64.decode64(base64)
|
73
|
+
expect(Base64.decode64(base64)).to eq blob
|
74
74
|
end
|
75
75
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_identicon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Branson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 3.4.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 3.4.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: yard
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 1.3.
|
75
|
+
version: 1.3.5
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 1.3.
|
82
|
+
version: 1.3.5
|
83
83
|
description: |2
|
84
84
|
A Ruby implementation of go-identicon by Damian Gryski
|
85
85
|
|
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
130
130
|
version: '0'
|
131
131
|
requirements: []
|
132
132
|
rubyforge_project:
|
133
|
-
rubygems_version: 2.
|
133
|
+
rubygems_version: 2.5.1
|
134
134
|
signing_key:
|
135
135
|
specification_version: 4
|
136
136
|
summary: A Ruby Gem for creating GitHub like identicons
|