gravatarify 2.2.2 → 3.0.0
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.
- data/Gemfile +4 -0
- data/Gemfile.lock +20 -0
- data/LICENSE +1 -1
- data/README.md +19 -18
- data/Rakefile +3 -91
- data/gravatarify.gemspec +29 -0
- data/lib/gravatarify.rb +68 -14
- data/lib/gravatarify/base.rb +1 -48
- data/lib/gravatarify/helper.rb +43 -30
- data/lib/gravatarify/version.rb +4 -0
- data/test/unit/gravatarify_subdomain_test.rb +4 -4
- metadata +34 -31
- data/init.rb +0 -1
- data/lib/gravatarify/railtie.rb +0 -14
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
gravatarify (2.2.4)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
activesupport (3.0.9)
|
10
|
+
rr (1.0.2)
|
11
|
+
shoulda (2.11.3)
|
12
|
+
|
13
|
+
PLATFORMS
|
14
|
+
ruby
|
15
|
+
|
16
|
+
DEPENDENCIES
|
17
|
+
activesupport (>= 3.0.0)
|
18
|
+
gravatarify!
|
19
|
+
rr (>= 0.10.5)
|
20
|
+
shoulda (>= 2.10.2)
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -2,37 +2,38 @@ Gravatarify
|
|
2
2
|
===========
|
3
3
|
|
4
4
|
Hassle-free construction of those pesky gravatar.com urls, with out-of-the-box support for
|
5
|
-
Rails, Haml and _your favorite framework_. It's not that there aren't any alternatives [out](http://github.com/mdeering/gravitar_image_tag),
|
5
|
+
Rails 3, Haml and _your favorite framework_. It's not that there aren't any alternatives [out](http://github.com/mdeering/gravitar_image_tag),
|
6
6
|
[there](http://github.com/chrislloyd/gravtastic), but none seem to support stuff like `Proc`s
|
7
7
|
for the default picture url, or the multiple host names supported by gravatar.com (great when
|
8
8
|
displaying lots of avatars).
|
9
9
|
|
10
10
|
- **Source**: <http://github.com/lwe/gravatarify>
|
11
11
|
- **Docs**: <http://rdoc.info/projects/lwe/gravatarify>
|
12
|
-
- **Gem**: <http://
|
12
|
+
- **Gem**: <http://rubygems.org/gems/gravatarify>
|
13
13
|
|
14
|
-
**UPGRADE NOTES:** Version
|
15
|
-
|
16
|
-
|
17
|
-
Furthermore the `gravatarify` method for ActiveRecord and DataMapper no longer exists,
|
18
|
-
see "Upgrading from 1.x" for more.
|
14
|
+
**UPGRADE NOTES:** Version 3.x is out of box only compatible with Rails 3, yet the helpers
|
15
|
+
should still work in Rails 2.x, so try to add `include Gravatarify::Helper` to your `ApplicationHelper`
|
16
|
+
in Rails 2.x
|
19
17
|
|
20
18
|
Ready, Set, Go!
|
21
19
|
---------------
|
22
20
|
|
23
|
-
**READY**
|
21
|
+
**READY** Add gravatarify to your `Gemfile`
|
24
22
|
|
25
|
-
|
23
|
+
gem 'gravatarify', '~> 3.0.0'
|
26
24
|
|
27
|
-
or
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
25
|
+
**SET** Guess, you are all set :) when using HAML or Sinatra you might to add:
|
26
|
+
|
27
|
+
# e.g. for Sinatra
|
28
|
+
helpers Gravatarify::Helper
|
29
|
+
|
30
|
+
# or include for Haml
|
31
|
+
Haml::Helpers.send(:include, Gravatarify::Helper)
|
32
|
+
|
33
|
+
# NOTE: basically just include the Gravatarify::Helper module
|
34
|
+
|
34
35
|
|
35
|
-
**GO** Use it! When using Rails
|
36
|
+
**GO** Use it! When using Rails then just give it an email and it will return the gravatar url:
|
36
37
|
|
37
38
|
# creates an 20x20 pixel <img/> tag in your Rails ERB views:
|
38
39
|
<%= gravatar_tag @user.email, :size => 20 %>
|
@@ -53,7 +54,7 @@ Using the view helpers
|
|
53
54
|
----------------------
|
54
55
|
|
55
56
|
Probably one of the easiest ways to add support for gravatar images is with the included view helpers.
|
56
|
-
When using Rails
|
57
|
+
When using Rails these should be automatically available, if not do something like:
|
57
58
|
|
58
59
|
# e.g. for Sinatra
|
59
60
|
helpers Gravatarify::Helper
|
data/Rakefile
CHANGED
@@ -1,11 +1,8 @@
|
|
1
|
-
require '
|
1
|
+
require 'bundler'
|
2
2
|
require 'rake/testtask'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
desc 'Default: run unit tests.'
|
8
|
-
task :default => :test
|
4
|
+
include Rake::DSL
|
5
|
+
Bundler::GemHelper.install_tasks
|
9
6
|
|
10
7
|
desc 'Test the gravatarify plugin.'
|
11
8
|
Rake::TestTask.new(:test) do |t|
|
@@ -13,88 +10,3 @@ Rake::TestTask.new(:test) do |t|
|
|
13
10
|
t.pattern = 'test/**/*_test.rb'
|
14
11
|
t.verbose = true
|
15
12
|
end
|
16
|
-
|
17
|
-
begin
|
18
|
-
require 'yard'
|
19
|
-
desc 'Generate documentation for gravatarify. (requires yard)'
|
20
|
-
YARD::Rake::YardocTask.new(:doc) do |t|
|
21
|
-
t.files = ['lib/**/*.rb']
|
22
|
-
t.options = [
|
23
|
-
"--readme", "README.md",
|
24
|
-
"--title", "gravatarify (v#{Gravatarify::VERSION}) API Documentation"
|
25
|
-
]
|
26
|
-
end
|
27
|
-
rescue LoadError
|
28
|
-
puts "yard is required to build documentation: gem install yard"
|
29
|
-
end
|
30
|
-
|
31
|
-
begin
|
32
|
-
require 'jeweler'
|
33
|
-
Jeweler::Tasks.new do |gemspec|
|
34
|
-
gemspec.version = Gravatarify::VERSION
|
35
|
-
gemspec.name = "gravatarify"
|
36
|
-
gemspec.summary = "Awesome gravatar support for Ruby (and Rails)."
|
37
|
-
description = <<-DESC
|
38
|
-
Awesome gravatar support for Ruby (and Rails) -
|
39
|
-
with unique options like Proc's for default images,
|
40
|
-
support for gravatar.com's multiple host names, ability to
|
41
|
-
define reusable styles and much more...
|
42
|
-
DESC
|
43
|
-
gemspec.description = description.strip
|
44
|
-
gemspec.email = "lukas.westermann@gmail.com"
|
45
|
-
gemspec.homepage = "http://github.com/lwe/gravatarify"
|
46
|
-
gemspec.authors = ["Lukas Westermann"]
|
47
|
-
gemspec.licenses = %w{LICENSE}
|
48
|
-
gemspec.extra_rdoc_files = %w{README.md}
|
49
|
-
|
50
|
-
gemspec.add_development_dependency('shoulda', '>= 2.10.2')
|
51
|
-
gemspec.add_development_dependency('rr', '>= 0.10.5')
|
52
|
-
gemspec.add_development_dependency('activesupport', '>= 2.3.5')
|
53
|
-
|
54
|
-
gemspec.files.reject! { |file| file =~ /\.gemspec$/ }
|
55
|
-
end
|
56
|
-
Jeweler::GemcutterTasks.new
|
57
|
-
rescue LoadError
|
58
|
-
puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
59
|
-
end
|
60
|
-
|
61
|
-
desc 'Clean all generated files (.yardoc and doc/*)'
|
62
|
-
task :clean do |t|
|
63
|
-
FileUtils.rm_rf "doc"
|
64
|
-
FileUtils.rm_rf "pkg"
|
65
|
-
FileUtils.rm_rf ".yardoc"
|
66
|
-
Dir['**/*.rbc'].each { |f| File.unlink(f) }
|
67
|
-
end
|
68
|
-
|
69
|
-
namespace :metrics do
|
70
|
-
desc 'Report all metrics, i.e. stats and code coverage.'
|
71
|
-
task :all => [:stats, :coverage]
|
72
|
-
|
73
|
-
desc 'Report code statistics for library and tests to shell.'
|
74
|
-
task :stats do |t|
|
75
|
-
require 'code_statistics'
|
76
|
-
dirs = {
|
77
|
-
'Libraries' => 'lib',
|
78
|
-
'Unit tests' => 'test/unit'
|
79
|
-
}.map { |name,dir| [name, File.join(File.dirname(__FILE__), dir)] }
|
80
|
-
CodeStatistics.new(*dirs).to_s
|
81
|
-
end
|
82
|
-
|
83
|
-
desc 'Report code coverage to HTML (doc/coverage) and shell (requires rcov).'
|
84
|
-
task :coverage do |t|
|
85
|
-
rm_f "doc/coverage"
|
86
|
-
mkdir_p "doc/coverage"
|
87
|
-
rcov = %(rcov -Ilib:test --exclude '\/gems\/' -o doc/coverage -T test/unit/*_test.rb )
|
88
|
-
system rcov
|
89
|
-
end
|
90
|
-
|
91
|
-
desc 'Report the fishy smell of bad code (requires reek)'
|
92
|
-
task :smelly do |t|
|
93
|
-
puts
|
94
|
-
puts "* * * NOTE: reek currently reports several false positives,"
|
95
|
-
puts " eventhough it's probably good to check once in a while!"
|
96
|
-
puts
|
97
|
-
reek = %(reek -s lib)
|
98
|
-
system reek
|
99
|
-
end
|
100
|
-
end
|
data/gravatarify.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "gravatarify/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "gravatarify"
|
7
|
+
s.version = Gravatarify::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.summary = "Awesome gravatar support for Ruby (and Rails)."
|
10
|
+
s.description = "Ruby (and Rails) Gravatar helpers with unique options like Proc's for default images, support for gravatar.com's multiple host names, ability to define reusable styles and much more..."
|
11
|
+
|
12
|
+
s.required_ruby_version = ">= 1.8.7"
|
13
|
+
s.required_rubygems_version = ">= 1.3.6"
|
14
|
+
|
15
|
+
s.authors = ["Lukas Westermann"]
|
16
|
+
s.email = ["lukas.westermann@gmail.com"]
|
17
|
+
s.homepage = "http://github.com/lwe/gravatarify"
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
21
|
+
s.require_path = 'lib'
|
22
|
+
|
23
|
+
s.license = 'MIT'
|
24
|
+
|
25
|
+
s.add_development_dependency 'shoulda', '>= 2.10.2'
|
26
|
+
s.add_development_dependency 'rr', '>= 0.10.5'
|
27
|
+
s.add_development_dependency 'activesupport', '>= 3.0.0'
|
28
|
+
end
|
29
|
+
|
data/lib/gravatarify.rb
CHANGED
@@ -1,18 +1,72 @@
|
|
1
|
-
require 'gravatarify/
|
2
|
-
require 'gravatarify/utils'
|
3
|
-
require 'gravatarify/helper'
|
1
|
+
require 'gravatarify/version'
|
4
2
|
|
3
|
+
# Provides support for adding gravatar images in ruby (and rails)
|
4
|
+
# applications.
|
5
5
|
module Gravatarify
|
6
|
-
|
7
|
-
|
6
|
+
autoload :Base, 'gravatarify/base'
|
7
|
+
autoload :Helper, 'gravatarify/helper'
|
8
|
+
autoload :Utils, 'gravatarify/utils'
|
9
|
+
|
10
|
+
class << self
|
11
|
+
|
12
|
+
# Global options which are merged on every call to
|
13
|
+
# +gravatar_url+, this is useful to e.g. define a default image.
|
14
|
+
#
|
15
|
+
# When using Rails defining default options is best done in an
|
16
|
+
# initializer +config/initializers/gravatarify.rb+ (or similar).
|
17
|
+
#
|
18
|
+
# Usage examples:
|
19
|
+
#
|
20
|
+
# # set the default image using a Proc
|
21
|
+
# Gravatarify.options[:default] = Proc.new { |*args| "http://example.com/avatar-#{args.first[:size] || 80}.jpg" }
|
22
|
+
#
|
23
|
+
# # or set a custom default rating
|
24
|
+
# Gravatarify.options[:rating] = :R
|
25
|
+
#
|
26
|
+
# # or disable adding an extension
|
27
|
+
# Gravatarify.options[:filetype] = false
|
28
|
+
#
|
29
|
+
def options; @options ||= { :filetype => :jpg } end
|
30
|
+
|
31
|
+
# Allows to define some styles, makes it simpler to call by name, instead of always giving a size etc.
|
32
|
+
#
|
33
|
+
# Gravatarify.styles[:mini] => { :size => 30, :default => "http://example.com/gravatar-mini.jpg" }
|
34
|
+
#
|
35
|
+
# # in the views, it will then use the stuff defined by styles[:mini]:
|
36
|
+
# <%= gravatar_tag @user, :mini %>
|
37
|
+
#
|
38
|
+
def styles; @styles ||= {} end
|
39
|
+
|
40
|
+
# Globally overide subdomains used to build gravatar urls, normally
|
41
|
+
# +gravatarify+ picks from either +0.gravatar.com+, +1.gravatar.com+,
|
42
|
+
# +2.gravatar.com+ or +www.gravatar.com+ when building hosts, to use a custom
|
43
|
+
# set of subdomains (or none!) do something like:
|
44
|
+
#
|
45
|
+
# Gravatarify.subdomains = %w{ 0 www } # only use 0.gravatar.com and www.gravatar.com
|
46
|
+
#
|
47
|
+
def subdomains=(subdomains) @subdomains = [*subdomains] end
|
48
|
+
|
49
|
+
# Get subdomain for supplied string or returns +www+ if none is
|
50
|
+
# defined.
|
51
|
+
def subdomain(str) #:nodoc:
|
52
|
+
@subdomains ||= []
|
53
|
+
unless @subdomains.empty?
|
54
|
+
subdomain = @subdomains[str.hash % @subdomains.size]
|
55
|
+
subdomain + "." if subdomain
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# Is running rails and at least rails 3.x
|
60
|
+
def rails?
|
61
|
+
defined?(::Rails) && ::Rails.version.to_i >= 3
|
62
|
+
end
|
63
|
+
|
64
|
+
# Loads `Gravatarify::Helper` as view helper via `ActionController::Base.helper`
|
65
|
+
def setup_rails!
|
66
|
+
ActiveSupport.on_load(:action_controller) { ActionController::Base.helper(Gravatarify::Helper) }
|
67
|
+
end
|
68
|
+
end
|
8
69
|
end
|
9
70
|
|
10
|
-
|
11
|
-
|
12
|
-
ActiveSupport.on_load(:action_view) { include Gravatarify::Helper }
|
13
|
-
elsif defined?(ActionView)
|
14
|
-
# hook into rails 2.x
|
15
|
-
ActionView::Base.send(:include, Gravatarify::Helper) if defined?(ActionView)
|
16
|
-
end
|
17
|
-
# try to include it in HAML too, no matter what :)
|
18
|
-
Haml::Helpers.send(:include, Gravatarify::Helper) if defined?(Haml)
|
71
|
+
# Try to init rails3
|
72
|
+
Gravatarify.setup_rails! if Gravatarify.rails?
|
data/lib/gravatarify/base.rb
CHANGED
@@ -4,54 +4,7 @@ require 'cgi'
|
|
4
4
|
module Gravatarify
|
5
5
|
# Hash of :ultra_long_option_name => :abbr_opt
|
6
6
|
GRAVATAR_ABBREV_OPTIONS = { 'default' => :d, :default => :d, 'rating' => :r, :rating => :r, 'size' => :s, :size => :s }
|
7
|
-
|
8
|
-
class << self
|
9
7
|
|
10
|
-
# Global options which are merged on every call to
|
11
|
-
# +gravatar_url+, this is useful to e.g. define a default image.
|
12
|
-
#
|
13
|
-
# When using Rails defining default options is best done in an
|
14
|
-
# initializer +config/initializers/gravatarify.rb+ (or similar).
|
15
|
-
#
|
16
|
-
# Usage examples:
|
17
|
-
#
|
18
|
-
# # set the default image using a Proc
|
19
|
-
# Gravatarify.options[:default] = Proc.new { |*args| "http://example.com/avatar-#{args.first[:size] || 80}.jpg" }
|
20
|
-
#
|
21
|
-
# # or set a custom default rating
|
22
|
-
# Gravatarify.options[:rating] = :R
|
23
|
-
#
|
24
|
-
# # or disable adding an extension
|
25
|
-
# Gravatarify.options[:filetype] = false
|
26
|
-
#
|
27
|
-
def options; @options ||= { :filetype => :jpg } end
|
28
|
-
|
29
|
-
# Allows to define some styles, makes it simpler to call by name, instead of always giving a size etc.
|
30
|
-
#
|
31
|
-
# Gravatarify.styles[:mini] => { :size => 30, :default => "http://example.com/gravatar-mini.jpg" }
|
32
|
-
#
|
33
|
-
# # in the views, it will then use the stuff defined by styles[:mini]:
|
34
|
-
# <%= gravatar_tag @user, :mini %>
|
35
|
-
#
|
36
|
-
def styles; @styles ||= {} end
|
37
|
-
|
38
|
-
# Globally overide subdomains used to build gravatar urls, normally
|
39
|
-
# +gravatarify+ picks from either +0.gravatar.com+, +1.gravatar.com+,
|
40
|
-
# +2.gravatar.com+ or +www.gravatar.com+ when building hosts, to use a custom
|
41
|
-
# set of subdomains (or none!) do something like:
|
42
|
-
#
|
43
|
-
# Gravatarify.subdomains = %w{ 0 www } # only use 0.gravatar.com and www.gravatar.com
|
44
|
-
#
|
45
|
-
def subdomains=(subdomains) @subdomains = [*subdomains] end
|
46
|
-
|
47
|
-
# Get subdomain for supplied string or returns +www+ if none is
|
48
|
-
# defined.
|
49
|
-
def subdomain(str) #:nodoc:
|
50
|
-
@subdomains ||= %w{ 0 1 2 www }
|
51
|
-
(@subdomains.empty? ? nil : @subdomains[str.hash % @subdomains.size]) || 'www'
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
8
|
# Provides core support to build gravatar urls based on supplied e-mail strings.
|
56
9
|
module Base
|
57
10
|
|
@@ -114,7 +67,7 @@ module Gravatarify
|
|
114
67
|
# @return [String] Protocol and hostname (like <tt>http://www.gravatar.com</tt>), without trailing slash.
|
115
68
|
def self.gravatar_host(context, str_hash, secure = false)
|
116
69
|
use_ssl_host = secure.is_a?(Proc) ? secure.call(context) : secure
|
117
|
-
use_ssl_host ? "https://secure.gravatar.com" : "http://#{Gravatarify.subdomain(str_hash)}
|
70
|
+
use_ssl_host ? "https://secure.gravatar.com" : "http://#{Gravatarify.subdomain(str_hash)}gravatar.com"
|
118
71
|
end
|
119
72
|
|
120
73
|
# Builds a query string from all passed in options.
|
data/lib/gravatarify/helper.rb
CHANGED
@@ -1,37 +1,50 @@
|
|
1
|
-
module Gravatarify
|
2
|
-
|
3
|
-
|
4
|
-
# Helper method for HAML to return a neat hash to be used as attributes in an image tag.
|
1
|
+
module Gravatarify
|
2
|
+
|
3
|
+
# Provides the two available helpers: `gravatar_attrs` and `gravatar_tag`.
|
5
4
|
#
|
6
|
-
#
|
5
|
+
# The helper should be loaded as helper for your specific view framework:
|
7
6
|
#
|
8
|
-
#
|
7
|
+
# # e.g. for Sinatra
|
8
|
+
# helpers Gravatarify::Helper
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# # or include for Haml
|
11
|
+
# Haml::Helpers.send(:include, Gravatarify::Helper)
|
11
12
|
#
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
13
|
+
module Helper
|
14
|
+
include Gravatarify::Base
|
15
|
+
|
16
|
+
# Helper method for HAML to return a neat hash to be used as attributes in an image tag.
|
17
|
+
#
|
18
|
+
# Now it's as simple as doing something like:
|
19
|
+
#
|
20
|
+
# %img{ gravatar_attrs(@user.mail, :size => 20) }/
|
21
|
+
#
|
22
|
+
# This is also the base method for +gravatar_tag+.
|
23
|
+
#
|
24
|
+
# @param [String, #email, #mail, #gravatar_url] email a string or an object used
|
25
|
+
# to generate to gravatar url for.
|
26
|
+
# @param [Symbol, Hash] *params other gravatar or html options for building the resulting
|
27
|
+
# hash.
|
28
|
+
# @return [Hash] all html attributes required to build an +img+ tag.
|
29
|
+
def gravatar_attrs(email, *params)
|
30
|
+
url_options = Gravatarify::Utils.merge_gravatar_options(*params)
|
31
|
+
options = url_options[:html] || {}
|
32
|
+
options[:src] = gravatar_url(email, false, url_options)
|
33
|
+
options[:width] = options[:height] = (url_options[:size] || 80) # customize size
|
34
|
+
{ :alt => '' }.merge!(options) # to ensure validity merge with :alt => ''!
|
35
|
+
end
|
24
36
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
37
|
+
# Takes care of creating an <tt><img/></tt>-tag based on a gravatar url, it no longer
|
38
|
+
# makes use of any Rails helper, so is totally useable in any other library.
|
39
|
+
#
|
40
|
+
# @param [String, #email, #mail, #gravatar_url] email a string or an object used
|
41
|
+
# to generate the gravatar url from
|
42
|
+
# @param [Symbol, Hash] *params other gravatar or html options for building the resulting
|
43
|
+
# image tag.
|
44
|
+
# @return [String] a complete and hopefully valid +img+ tag.
|
45
|
+
def gravatar_tag(email, *params)
|
46
|
+
html_attrs = gravatar_attrs(email, *params).map { |key,value| "#{key}=\"#{CGI.escapeHTML(value.to_s)}\"" }.sort.join(" ")
|
47
|
+
Gravatarify::Utils.make_html_safe_if_available("<img #{html_attrs} />");
|
48
|
+
end
|
36
49
|
end
|
37
50
|
end
|
@@ -21,10 +21,10 @@ class GravatarifySubdomainTest < Test::Unit::TestCase
|
|
21
21
|
assert_equal "http://www.gravatar.com/avatar/d4489907918035d0bc6ff3f6c76e760d.jpg", gravatar_url('support@initech.com')
|
22
22
|
end
|
23
23
|
|
24
|
-
should "still work as expected if passed in `nil` and return urls
|
25
|
-
Gravatarify.subdomains =
|
26
|
-
assert_equal "http://
|
27
|
-
assert_equal "http://
|
24
|
+
should "still work as expected if passed in `nil` and return urls without subdomain (default)" do
|
25
|
+
Gravatarify.subdomains = []
|
26
|
+
assert_equal "http://gravatar.com/avatar/4979dd9653e759c78a81d4997f56bae2.jpg", gravatar_url('info@initech.com')
|
27
|
+
assert_equal "http://gravatar.com/avatar/d4489907918035d0bc6ff3f6c76e760d.jpg", gravatar_url('support@initech.com')
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gravatarify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 7
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
|
-
-
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version:
|
7
|
+
- 3
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 3.0.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lukas Westermann
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-07-06 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -58,37 +58,36 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
hash:
|
61
|
+
hash: 7
|
62
62
|
segments:
|
63
|
-
- 2
|
64
63
|
- 3
|
65
|
-
-
|
66
|
-
|
64
|
+
- 0
|
65
|
+
- 0
|
66
|
+
version: 3.0.0
|
67
67
|
type: :development
|
68
68
|
version_requirements: *id003
|
69
|
-
description:
|
70
|
-
|
71
|
-
|
72
|
-
support for gravatar.com's multiple host names, ability to
|
73
|
-
define reusable styles and much more...
|
74
|
-
email: lukas.westermann@gmail.com
|
69
|
+
description: Ruby (and Rails) Gravatar helpers with unique options like Proc's for default images, support for gravatar.com's multiple host names, ability to define reusable styles and much more...
|
70
|
+
email:
|
71
|
+
- lukas.westermann@gmail.com
|
75
72
|
executables: []
|
76
73
|
|
77
74
|
extensions: []
|
78
75
|
|
79
|
-
extra_rdoc_files:
|
80
|
-
|
76
|
+
extra_rdoc_files: []
|
77
|
+
|
81
78
|
files:
|
82
79
|
- .gitignore
|
80
|
+
- Gemfile
|
81
|
+
- Gemfile.lock
|
83
82
|
- LICENSE
|
84
83
|
- README.md
|
85
84
|
- Rakefile
|
86
|
-
-
|
85
|
+
- gravatarify.gemspec
|
87
86
|
- lib/gravatarify.rb
|
88
87
|
- lib/gravatarify/base.rb
|
89
88
|
- lib/gravatarify/helper.rb
|
90
|
-
- lib/gravatarify/railtie.rb
|
91
89
|
- lib/gravatarify/utils.rb
|
90
|
+
- lib/gravatarify/version.rb
|
92
91
|
- test/benchmark/benchmark.rb
|
93
92
|
- test/test_helper.rb
|
94
93
|
- test/unit/gravatarify_base_test.rb
|
@@ -98,10 +97,10 @@ files:
|
|
98
97
|
has_rdoc: true
|
99
98
|
homepage: http://github.com/lwe/gravatarify
|
100
99
|
licenses:
|
101
|
-
-
|
100
|
+
- MIT
|
102
101
|
post_install_message:
|
103
|
-
rdoc_options:
|
104
|
-
|
102
|
+
rdoc_options: []
|
103
|
+
|
105
104
|
require_paths:
|
106
105
|
- lib
|
107
106
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -109,23 +108,27 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
109
108
|
requirements:
|
110
109
|
- - ">="
|
111
110
|
- !ruby/object:Gem::Version
|
112
|
-
hash:
|
111
|
+
hash: 57
|
113
112
|
segments:
|
114
|
-
-
|
115
|
-
|
113
|
+
- 1
|
114
|
+
- 8
|
115
|
+
- 7
|
116
|
+
version: 1.8.7
|
116
117
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
118
|
none: false
|
118
119
|
requirements:
|
119
120
|
- - ">="
|
120
121
|
- !ruby/object:Gem::Version
|
121
|
-
hash:
|
122
|
+
hash: 23
|
122
123
|
segments:
|
123
|
-
-
|
124
|
-
|
124
|
+
- 1
|
125
|
+
- 3
|
126
|
+
- 6
|
127
|
+
version: 1.3.6
|
125
128
|
requirements: []
|
126
129
|
|
127
130
|
rubyforge_project:
|
128
|
-
rubygems_version: 1.
|
131
|
+
rubygems_version: 1.4.1
|
129
132
|
signing_key:
|
130
133
|
specification_version: 3
|
131
134
|
summary: Awesome gravatar support for Ruby (and Rails).
|
data/init.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
require 'gravatarify'
|
data/lib/gravatarify/railtie.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'gravatarify'
|
2
|
-
require 'rails'
|
3
|
-
|
4
|
-
module Gravatarify
|
5
|
-
class Railtie < Rails::Railtie
|
6
|
-
initialize 'gravatarify.extend.action_view' do
|
7
|
-
Rails.logger.error "[Gravatarify::Railtie] initialize('gravatarify.extend.action_view')"
|
8
|
-
ActiveSupport.on_load(:action_view) do
|
9
|
-
Rails.logger.error "[Gravatarify::Railtie] ActiveSupport.on_load(:action_view), #{self.class}"
|
10
|
-
include Gravatarify::Helper
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|