ve_gravatar_image_tag 1.3.1 → 1.3.2
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a2d6bf4437f198502a3fa2d06a5a3176a741c82e8f862181e21f9cc6f4c084e2
|
|
4
|
+
data.tar.gz: 4036a9c8ba21b432d6419344d613b707e455b9895b430b3a5483cf5e561d5fa4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 56a7a6c093ad6313b9bd72ac6659ec3856485f421256d4ea98f616825b56cd53596b27498430d245e85e28f61ef566c49043cc92e4065bc8453aedca2650367b
|
|
7
|
+
data.tar.gz: 15c3af4e74f3547e8912204a781a6e69044d62574d06054c2629094e4ee6c4e4d79ba7f88e49b3e9d33297e71873f4a6054239bd64dc58211d397b9ff0e4845c
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module
|
|
1
|
+
module VeGravatarImageTag
|
|
2
2
|
|
|
3
3
|
class << self
|
|
4
4
|
attr_accessor :configuration
|
|
@@ -22,7 +22,7 @@ module GravatarImageTag
|
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
def self.included(base)
|
|
25
|
-
|
|
25
|
+
VeGravatarImageTag.configure { |c| nil }
|
|
26
26
|
base.extend ClassMethods
|
|
27
27
|
base.send :include, InstanceMethods
|
|
28
28
|
end
|
|
@@ -30,31 +30,31 @@ module GravatarImageTag
|
|
|
30
30
|
module ClassMethods
|
|
31
31
|
def default_gravatar_filetype=(value)
|
|
32
32
|
warn "DEPRECATION WARNING: configuration of filetype= through this method is deprecated! Use the block configuration instead. http://github.com/mdeering/gravatar_image_tag"
|
|
33
|
-
|
|
33
|
+
VeGravatarImageTag.configure do |c|
|
|
34
34
|
c.filetype = value
|
|
35
35
|
end
|
|
36
36
|
end
|
|
37
37
|
def default_gravatar_image=(value)
|
|
38
38
|
warn "DEPRECATION WARNING: configuration of default_gravatar_image= through this method is deprecated! Use the block configuration instead. http://github.com/mdeering/gravatar_image_tag"
|
|
39
|
-
|
|
39
|
+
VeGravatarImageTag.configure do |c|
|
|
40
40
|
c.default_image = value
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
def default_gravatar_rating=(value)
|
|
44
44
|
warn "DEPRECATION WARNING: configuration of default_gravatar_rating= through this method is deprecated! Use the block configuration instead. http://github.com/mdeering/gravatar_image_tag"
|
|
45
|
-
|
|
45
|
+
VeGravatarImageTag.configure do |c|
|
|
46
46
|
c.rating = value
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
def default_gravatar_size=(value)
|
|
50
50
|
warn "DEPRECATION WARNING: configuration of default_gravatar_size= through this method is deprecated! Use the block configuration instead. http://github.com/mdeering/gravatar_image_tag"
|
|
51
|
-
|
|
51
|
+
VeGravatarImageTag.configure do |c|
|
|
52
52
|
c.size = value
|
|
53
53
|
end
|
|
54
54
|
end
|
|
55
55
|
def secure_gravatar=(value)
|
|
56
56
|
warn "DEPRECATION WARNING: configuration of secure_gravatar= through this method is deprecated! Use the block configuration instead. http://github.com/mdeering/gravatar_image_tag"
|
|
57
|
-
|
|
57
|
+
VeGravatarImageTag.configure do |c|
|
|
58
58
|
c.secure = value
|
|
59
59
|
end
|
|
60
60
|
end
|
|
@@ -65,8 +65,8 @@ module GravatarImageTag
|
|
|
65
65
|
gravatar_overrides = options.delete(:gravatar)
|
|
66
66
|
options[:src] = gravatar_image_url(email, gravatar_overrides)
|
|
67
67
|
options[:alt] ||= 'Gravatar'
|
|
68
|
-
if
|
|
69
|
-
size =
|
|
68
|
+
if VeGravatarImageTag.configuration.include_size_attributes
|
|
69
|
+
size = VeGravatarImageTag::gravatar_options(gravatar_overrides)[:size] || 80
|
|
70
70
|
options[:height] = options[:width] = size.to_s
|
|
71
71
|
end
|
|
72
72
|
|
|
@@ -77,7 +77,7 @@ module GravatarImageTag
|
|
|
77
77
|
|
|
78
78
|
def gravatar_image_url(email, gravatar_overrides = {})
|
|
79
79
|
email = email.strip.downcase if email.is_a? String
|
|
80
|
-
|
|
80
|
+
VeGravatarImageTag::gravatar_url(email, gravatar_overrides)
|
|
81
81
|
end
|
|
82
82
|
end
|
|
83
83
|
|
|
@@ -93,11 +93,11 @@ module GravatarImageTag
|
|
|
93
93
|
|
|
94
94
|
def self.gravatar_options(overrides = {})
|
|
95
95
|
{
|
|
96
|
-
:default =>
|
|
97
|
-
:filetype =>
|
|
98
|
-
:rating =>
|
|
99
|
-
:secure =>
|
|
100
|
-
:size =>
|
|
96
|
+
:default => VeGravatarImageTag.configuration.default_image,
|
|
97
|
+
:filetype => VeGravatarImageTag.configuration.filetype,
|
|
98
|
+
:rating => VeGravatarImageTag.configuration.rating,
|
|
99
|
+
:secure => VeGravatarImageTag.configuration.secure,
|
|
100
|
+
:size => VeGravatarImageTag.configuration.size
|
|
101
101
|
}.merge(overrides || {}).delete_if { |key, value| value.nil? }
|
|
102
102
|
end
|
|
103
103
|
|
|
@@ -123,4 +123,4 @@ module GravatarImageTag
|
|
|
123
123
|
|
|
124
124
|
end
|
|
125
125
|
|
|
126
|
-
ActionView::Base.send(:include,
|
|
126
|
+
ActionView::Base.send(:include, VeGravatarImageTag) if defined?(ActionView::Base)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
require File.dirname(__FILE__) + '/test_helper'
|
|
2
2
|
|
|
3
|
-
require '
|
|
3
|
+
require 've_gravatar_image_tag'
|
|
4
4
|
|
|
5
|
-
ActionView::Base.send(:include,
|
|
5
|
+
ActionView::Base.send(:include, VeGravatarImageTag)
|
|
6
6
|
|
|
7
|
-
describe
|
|
7
|
+
describe VeGravatarImageTag do
|
|
8
8
|
|
|
9
9
|
email = 'mdeering@mdeering.com'
|
|
10
10
|
md5 = '4da9ad2bd4a2d1ce3c428e32c423588a'
|
|
@@ -46,11 +46,11 @@ describe GravatarImageTag do
|
|
|
46
46
|
it "should give a deprication warning for assigning to #{singleton_variable} and passthrough to set the new variable" do
|
|
47
47
|
expect(ActionView::Base).to receive(:warn)
|
|
48
48
|
ActionView::Base.send("#{singleton_variable}=", value)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
49
|
+
VeGravatarImageTag.configuration.default_image == value if singleton_variable == :default_gravatar_image
|
|
50
|
+
VeGravatarImageTag.configuration.filetype == value if singleton_variable == :default_gravatar_filetype
|
|
51
|
+
VeGravatarImageTag.configuration.rating == value if singleton_variable == :default_gravatar_rating
|
|
52
|
+
VeGravatarImageTag.configuration.size == value if singleton_variable == :default_gravatar_size
|
|
53
|
+
VeGravatarImageTag.configuration.secure == value if singleton_variable == :secure_gravatar
|
|
54
54
|
end
|
|
55
55
|
end
|
|
56
56
|
|
|
@@ -78,31 +78,31 @@ describe GravatarImageTag do
|
|
|
78
78
|
end
|
|
79
79
|
|
|
80
80
|
it 'should set the image tags height and width to avoid the page going all jiggy (technical term) when loading a page with lots of Gravatars' do
|
|
81
|
-
|
|
81
|
+
VeGravatarImageTag.configure { |c| c.size = 30 }
|
|
82
82
|
expect(!!view.gravatar_image_tag(email).match(/height="30"/)).to be_truthy
|
|
83
83
|
expect(!!view.gravatar_image_tag(email).match(/width="30"/)).to be_truthy
|
|
84
84
|
end
|
|
85
85
|
|
|
86
86
|
it 'should set the image tags height and width attributes to 80px (gravatars default) if no size is given.' do
|
|
87
|
-
|
|
87
|
+
VeGravatarImageTag.configure { |c| c.size = nil }
|
|
88
88
|
expect(!!view.gravatar_image_tag(email).match(/height="80"/)).to be_truthy
|
|
89
89
|
expect(!!view.gravatar_image_tag(email).match(/width="80"/)).to be_truthy
|
|
90
90
|
end
|
|
91
91
|
|
|
92
92
|
it 'should set the image tags height and width attributes from the overrides on the size' do
|
|
93
|
-
|
|
93
|
+
VeGravatarImageTag.configure { |c| c.size = 120 }
|
|
94
94
|
expect(!!view.gravatar_image_tag(email, gravatar: { size: 45 }).match(/height="45"/)).to be_truthy
|
|
95
95
|
expect(!!view.gravatar_image_tag(email, gravatar: { size: 75 }).match(/width="75"/)).to be_truthy
|
|
96
96
|
end
|
|
97
97
|
|
|
98
98
|
it 'should not include the height and width attributes on the image tag if it is turned off in the configuration' do
|
|
99
|
-
|
|
99
|
+
VeGravatarImageTag.configure { |c| c.include_size_attributes = false }
|
|
100
100
|
expect(!!view.gravatar_image_tag(email).match(/height=/)).to be_falsey
|
|
101
101
|
expect(!!view.gravatar_image_tag(email).match(/width=/)).to be_falsey
|
|
102
102
|
end
|
|
103
103
|
|
|
104
|
-
it '
|
|
105
|
-
expect {
|
|
104
|
+
it 'VeGravatarImageTag#gravitar_id should not error out when email is nil' do
|
|
105
|
+
expect { VeGravatarImageTag::gravatar_id(nil) }.to_not raise_error
|
|
106
106
|
end
|
|
107
107
|
|
|
108
108
|
it 'should normalize the email to Gravatar standards (http://en.gravatar.com/site/implement/hash/)' do
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ve_gravatar_image_tag
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Deering
|
|
@@ -119,9 +119,9 @@ files:
|
|
|
119
119
|
- MIT-LICENSE
|
|
120
120
|
- README.textile
|
|
121
121
|
- Rakefile
|
|
122
|
-
- lib/
|
|
123
|
-
- spec/gravatar_image_tag_spec.rb
|
|
122
|
+
- lib/ve_gravatar_image_tag.rb
|
|
124
123
|
- spec/test_helper.rb
|
|
124
|
+
- spec/ve_gravatar_image_tag_spec.rb
|
|
125
125
|
homepage: http://github.com/versioneye/gravatar_image_tag
|
|
126
126
|
licenses: []
|
|
127
127
|
metadata: {}
|