ruby_identicon 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 864f1543ca10712e1e4db984ce599ef5a49b23ae
4
- data.tar.gz: 3009ca72274f11cfaa090fa275c9e64783d218fc
3
+ metadata.gz: a90de8454924cf7a6f3c771e462d891370b7e5a9
4
+ data.tar.gz: d96b2735908688e1694121bf624bcb6516159a34
5
5
  SHA512:
6
- metadata.gz: 68aa48240830d7c2df66e9244aff4da2042aebf65eebbb755da1f5a7d3ea0335a2f9297b6b6795c213e478c256b8db3bbdaecb3e0e8d87c382e4b9a93b229599
7
- data.tar.gz: dda0a4b288e810f63eab0728c7574d79b0fd082337a8a843065a5d45193da8259abc717ff1998fe7a5feafabb7a34cfa8c22892698681855bc883b86a21b849b
6
+ metadata.gz: cd7f108d3c58c407fef0f947f709c6cba9b510b7971e9f33cfdd2e547a6a3feacdb98e60af44cacf1064e5dd8470592a5f40fca039f8e1adc8f5a6f81fcfaea5
7
+ data.tar.gz: 12b34f2b8a9ee03721add7fe5546f68045ef0f5c90fb9dbf5a715c3c59794d9482bb2f32cf75aa04ed06aae7cb565d4ac0f92792f40e87ee8a6f2a3a3d51f74a
@@ -2,5 +2,9 @@ language: ruby
2
2
  rvm:
3
3
  - 1.9.3
4
4
  - 2.0.0
5
+ - 2.1.6
6
+ - 2.2.3
7
+ before_install:
8
+ - gem install bundler
5
9
  notifications:
6
10
  email: false
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
- base64 = RubyIdenticon.create_base64("RubyIdenticon")
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. xffffffff for white)
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module RubyIdenticon
2
- VERSION = '0.0.4'
2
+ VERSION = '0.0.5'
3
3
  end
@@ -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", "~> 2.14"
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.0"
39
+ spec.add_dependency "chunky_png", "~> 1.3.5"
40
40
  end
@@ -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 be_true
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 be_true
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 be_true
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 be_true
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).force_encoding('UTF-8')).to eq blob
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
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: 2015-03-03 00:00:00.000000000 Z
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: '2.14'
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: '2.14'
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.0
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.0
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.4.3
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