gravatar-ultimate 1.0.3 → 2.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.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +10 -6
  3. data/Gemfile.lock +46 -15
  4. data/README.rdoc +8 -21
  5. data/environments/rails-3.1/config/environments/development.rb +2 -1
  6. data/gemfiles/{rails-3.1.3 → rails-3.1} +1 -1
  7. data/gemfiles/{rails-2.3.14 → rails-3.2} +1 -1
  8. data/gemfiles/rails-4.0 +5 -0
  9. data/gemfiles/rails-4.0.lock +123 -0
  10. data/gravatar-ultimate.gemspec +4 -2
  11. data/lib/gravatar.rb +10 -1
  12. data/lib/gravatar/version.rb +1 -1
  13. data/spec/lib/gravatar/cache_spec.rb +4 -4
  14. data/spec/lib/gravatar_spec.rb +9 -1
  15. data/spec/spec_helper.rb +16 -3
  16. metadata +124 -170
  17. data/environments/rails-2.3/README +0 -243
  18. data/environments/rails-2.3/Rakefile +0 -10
  19. data/environments/rails-2.3/app/controllers/application_controller.rb +0 -10
  20. data/environments/rails-2.3/app/helpers/application_helper.rb +0 -3
  21. data/environments/rails-2.3/config/boot.rb +0 -114
  22. data/environments/rails-2.3/config/database.yml +0 -22
  23. data/environments/rails-2.3/config/environment.rb +0 -43
  24. data/environments/rails-2.3/config/environments/development.rb +0 -17
  25. data/environments/rails-2.3/config/environments/production.rb +0 -28
  26. data/environments/rails-2.3/config/environments/test.rb +0 -28
  27. data/environments/rails-2.3/config/initializers/backtrace_silencers.rb +0 -7
  28. data/environments/rails-2.3/config/initializers/cookie_verification_secret.rb +0 -7
  29. data/environments/rails-2.3/config/initializers/inflections.rb +0 -10
  30. data/environments/rails-2.3/config/initializers/mime_types.rb +0 -5
  31. data/environments/rails-2.3/config/initializers/new_rails_defaults.rb +0 -21
  32. data/environments/rails-2.3/config/initializers/session_store.rb +0 -15
  33. data/environments/rails-2.3/config/locales/en.yml +0 -5
  34. data/environments/rails-2.3/config/routes.rb +0 -43
  35. data/environments/rails-2.3/db/seeds.rb +0 -7
  36. data/environments/rails-2.3/doc/README_FOR_APP +0 -2
  37. data/environments/rails-2.3/public/404.html +0 -30
  38. data/environments/rails-2.3/public/422.html +0 -30
  39. data/environments/rails-2.3/public/500.html +0 -30
  40. data/environments/rails-2.3/public/favicon.ico +0 -0
  41. data/environments/rails-2.3/public/images/rails.png +0 -0
  42. data/environments/rails-2.3/public/index.html +0 -275
  43. data/environments/rails-2.3/public/javascripts/application.js +0 -2
  44. data/environments/rails-2.3/public/javascripts/controls.js +0 -963
  45. data/environments/rails-2.3/public/javascripts/dragdrop.js +0 -973
  46. data/environments/rails-2.3/public/javascripts/effects.js +0 -1128
  47. data/environments/rails-2.3/public/javascripts/prototype.js +0 -4320
  48. data/environments/rails-2.3/public/robots.txt +0 -5
  49. data/environments/rails-2.3/script/about +0 -4
  50. data/environments/rails-2.3/script/console +0 -3
  51. data/environments/rails-2.3/script/dbconsole +0 -3
  52. data/environments/rails-2.3/script/destroy +0 -3
  53. data/environments/rails-2.3/script/generate +0 -3
  54. data/environments/rails-2.3/script/performance/benchmarker +0 -3
  55. data/environments/rails-2.3/script/performance/profiler +0 -3
  56. data/environments/rails-2.3/script/plugin +0 -3
  57. data/environments/rails-2.3/script/runner +0 -3
  58. data/environments/rails-2.3/script/server +0 -3
  59. data/environments/rails-2.3/test/performance/browsing_test.rb +0 -9
  60. data/environments/rails-2.3/test/test_helper.rb +0 -38
  61. data/gemfiles/rails-2.3.14.lock +0 -55
  62. data/gemfiles/rails-3.1.3.lock +0 -110
  63. data/lib/gravatar_ultimate.rb +0 -1
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 39e02de9e566df68c95997a4b50dfedf40c4c2c7
4
+ data.tar.gz: cecdf8f73ad1f5bc3d8091b9c345ae921dd7789f
5
+ SHA512:
6
+ metadata.gz: 16fb4076d360969187a1a6105523c50f6291dab536bf8a5c588b10cb375e167060d78d002d371c5655a635af2cd0962eead3c43ae0f129c17e7354b02204ecfa
7
+ data.tar.gz: cf58afdc5590a06dc756b7b8c9f39b766d25ff0fae4de85110c72021ca1feae3a0c63ff755216c7a570c6b0ab1154155307ca5caeb6d5a77744819238a25bc10
@@ -1,16 +1,20 @@
1
1
  rvm:
2
- - 1.8.7
3
- - 1.9.2
4
2
  - 1.9.3
3
+ - 2.0.0
5
4
  - jruby
6
- - rbx-18mode
7
- - ree
8
5
  - ruby-head
9
6
 
10
7
  gemfile:
11
8
  - Gemfile
12
- - gemfiles/rails-2.3.14
13
- - gemfiles/rails-3.1.3
9
+ - gemfiles/rails-3.1
10
+ - gemfiles/rails-3.2
11
+ - gemfiles/rails-4.0
14
12
 
15
13
  env:
16
14
  - DEBUG=1
15
+
16
+ matrix:
17
+ allow_failures:
18
+ - rvm: ruby-head
19
+ - rvm: jruby
20
+ - rvm: 1.9.3
@@ -1,33 +1,64 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- gravatar-ultimate (1.0.3)
4
+ gravatar-ultimate (2.0.0)
5
+ activesupport (>= 2.3.14)
6
+ rack
5
7
 
6
8
  GEM
7
9
  remote: http://rubygems.org/
8
10
  specs:
9
- activesupport (2.3.14)
10
- diff-lcs (1.1.3)
11
+ activesupport (4.0.1)
12
+ i18n (~> 0.6, >= 0.6.4)
13
+ minitest (~> 4.2)
14
+ multi_json (~> 1.3)
15
+ thread_safe (~> 0.1)
16
+ tzinfo (~> 0.3.37)
17
+ atomic (1.1.14)
18
+ coveralls (0.7.0)
19
+ multi_json (~> 1.3)
20
+ rest-client
21
+ simplecov (>= 0.7)
22
+ term-ansicolor
23
+ thor
24
+ diff-lcs (1.2.4)
11
25
  fakeweb (1.3.0)
12
- i18n (0.6.0)
13
- json (1.6.1)
26
+ i18n (0.6.5)
27
+ json (1.8.1)
28
+ mime-types (2.0)
29
+ minitest (4.7.5)
30
+ multi_json (1.8.2)
31
+ rack (1.5.2)
14
32
  rake (0.9.2.2)
15
- rdoc (3.11)
33
+ rdoc (3.12.2)
16
34
  json (~> 1.4)
17
- rspec (2.8.0)
18
- rspec-core (~> 2.8.0)
19
- rspec-expectations (~> 2.8.0)
20
- rspec-mocks (~> 2.8.0)
21
- rspec-core (2.8.0)
22
- rspec-expectations (2.8.0)
23
- diff-lcs (~> 1.1.2)
24
- rspec-mocks (2.8.0)
35
+ rest-client (1.6.7)
36
+ mime-types (>= 1.16)
37
+ rspec (2.14.1)
38
+ rspec-core (~> 2.14.0)
39
+ rspec-expectations (~> 2.14.0)
40
+ rspec-mocks (~> 2.14.0)
41
+ rspec-core (2.14.7)
42
+ rspec-expectations (2.14.3)
43
+ diff-lcs (>= 1.1.3, < 2.0)
44
+ rspec-mocks (2.14.4)
45
+ simplecov (0.7.1)
46
+ multi_json (~> 1.0)
47
+ simplecov-html (~> 0.7.1)
48
+ simplecov-html (0.7.1)
49
+ term-ansicolor (1.2.2)
50
+ tins (~> 0.8)
51
+ thor (0.18.1)
52
+ thread_safe (0.1.3)
53
+ atomic
54
+ tins (0.12.0)
55
+ tzinfo (0.3.38)
25
56
 
26
57
  PLATFORMS
27
58
  ruby
28
59
 
29
60
  DEPENDENCIES
30
- activesupport (>= 2.3.14)
61
+ coveralls
31
62
  fakeweb (>= 1.2.8)
32
63
  gravatar-ultimate!
33
64
  i18n (~> 0.6.0)
@@ -1,4 +1,4 @@
1
- = gravatar-ultimate {<img src="https://secure.travis-ci.org/sinisterchipmunk/gravatar.png" />}[http://travis-ci.org/sinisterchipmunk/gravatar]
1
+ = gravatar-ultimate {<img src="https://secure.travis-ci.org/sinisterchipmunk/gravatar.png" />}[http://travis-ci.org/sinisterchipmunk/gravatar] {<img src="https://codeclimate.com/github/sinisterchipmunk/gravatar.png" />}[https://codeclimate.com/github/sinisterchipmunk/gravatar] {<img src="https://coveralls.io/repos/sinisterchipmunk/gravatar/badge.png" alt="Coverage Status" />}[https://coveralls.io/r/sinisterchipmunk/gravatar]
2
2
 
3
3
  The Ultimate Gravatar Gem!
4
4
 
@@ -6,35 +6,22 @@ This gem is used to interface with the entire Gravatar API: it's not just for ge
6
6
 
7
7
  == Installation
8
8
 
9
- gem install gravatar-ultimate
9
+ Only Ruby 2.0 is officially supported. Rails itself is optional, but if used,
10
+ only versions 3.1, 3.2, and 4.0+ are supported. For older versions of Ruby
11
+ and/or Rails, see v1.x of this gem.
10
12
 
11
- == Activate the gem...
13
+ In your Gemfile:
12
14
 
13
- As with any gem, you have to type a few lines to tell Ruby to actually *use* it. Here's how to do that...
14
-
15
- ==== ...in Ruby on Rails (v3.x)
16
-
17
- * Edit your Gemfile
18
- * Add this line:
19
- gem 'gravatar-ultimate'
20
-
21
- ==== ...in Ruby on Rails (v2.x)
22
-
23
- * Edit your config/environment.rb file
24
- * Add this line beneath "Rails::Initializer.run do |config|":
25
- config.gem 'gravatar-ultimate'
26
-
27
- ==== ...in vanilla Ruby
28
-
29
- require 'rubygems'
30
15
  gem 'gravatar-ultimate'
31
- require 'gravatar-ultimate'
32
16
 
33
17
  == Usage
18
+
34
19
  Using the gem is actually pretty simple. Let's say you want the Gravatar image URL for "generic@example.com":
20
+
35
21
  url = Gravatar.new("generic@example.com").image_url
36
22
 
37
23
  Cool, huh? Let's take it a step further and grab the actual image *data* so that we can render it on the screen:
24
+
38
25
  data = Gravatar.new("generic@example.com").image_data
39
26
 
40
27
  Fine, but how about the rest of the API as advertised at http://en.gravatar.com/site/implement/xmlrpc? Well, for
@@ -7,7 +7,8 @@ Rails31::Application.configure do
7
7
  config.cache_classes = false
8
8
 
9
9
  # Log error messages when you accidentally call methods on nil.
10
- config.whiny_nils = true
10
+ config.whiny_nils = true if Rails::VERSION::MAJOR < 4
11
+ config.eager_load = false
11
12
 
12
13
  # Show full error reports and disable caching
13
14
  config.consider_all_requests_local = true
@@ -1,5 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
  gemspec :path => '..'
3
3
 
4
- gem 'rails', '= 3.1.3'
4
+ gem 'rails', '~> 3.1'
5
5
  gem 'jruby-openssl', :platforms => :jruby
@@ -1,5 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
  gemspec :path => '..'
3
3
 
4
- gem 'rails', '= 2.3.14'
4
+ gem 'rails', '~> 3.2'
5
5
  gem 'jruby-openssl', :platforms => :jruby
@@ -0,0 +1,5 @@
1
+ source "http://rubygems.org"
2
+ gemspec :path => '..'
3
+
4
+ gem 'rails', '~> 4.0'
5
+ gem 'jruby-openssl', :platforms => :jruby
@@ -0,0 +1,123 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ gravatar-ultimate (2.0.0)
5
+ activesupport (>= 2.3.14)
6
+ rack
7
+
8
+ GEM
9
+ remote: http://rubygems.org/
10
+ specs:
11
+ actionmailer (4.0.1)
12
+ actionpack (= 4.0.1)
13
+ mail (~> 2.5.4)
14
+ actionpack (4.0.1)
15
+ activesupport (= 4.0.1)
16
+ builder (~> 3.1.0)
17
+ erubis (~> 2.7.0)
18
+ rack (~> 1.5.2)
19
+ rack-test (~> 0.6.2)
20
+ activemodel (4.0.1)
21
+ activesupport (= 4.0.1)
22
+ builder (~> 3.1.0)
23
+ activerecord (4.0.1)
24
+ activemodel (= 4.0.1)
25
+ activerecord-deprecated_finders (~> 1.0.2)
26
+ activesupport (= 4.0.1)
27
+ arel (~> 4.0.0)
28
+ activerecord-deprecated_finders (1.0.3)
29
+ activesupport (4.0.1)
30
+ i18n (~> 0.6, >= 0.6.4)
31
+ minitest (~> 4.2)
32
+ multi_json (~> 1.3)
33
+ thread_safe (~> 0.1)
34
+ tzinfo (~> 0.3.37)
35
+ arel (4.0.1)
36
+ atomic (1.1.14)
37
+ builder (3.1.4)
38
+ coveralls (0.7.0)
39
+ multi_json (~> 1.3)
40
+ rest-client
41
+ simplecov (>= 0.7)
42
+ term-ansicolor
43
+ thor
44
+ diff-lcs (1.2.4)
45
+ erubis (2.7.0)
46
+ fakeweb (1.3.0)
47
+ hike (1.2.3)
48
+ i18n (0.6.5)
49
+ json (1.8.1)
50
+ mail (2.5.4)
51
+ mime-types (~> 1.16)
52
+ treetop (~> 1.4.8)
53
+ mime-types (1.25)
54
+ minitest (4.7.5)
55
+ multi_json (1.8.2)
56
+ polyglot (0.3.3)
57
+ rack (1.5.2)
58
+ rack-test (0.6.2)
59
+ rack (>= 1.0)
60
+ rails (4.0.1)
61
+ actionmailer (= 4.0.1)
62
+ actionpack (= 4.0.1)
63
+ activerecord (= 4.0.1)
64
+ activesupport (= 4.0.1)
65
+ bundler (>= 1.3.0, < 2.0)
66
+ railties (= 4.0.1)
67
+ sprockets-rails (~> 2.0.0)
68
+ railties (4.0.1)
69
+ actionpack (= 4.0.1)
70
+ activesupport (= 4.0.1)
71
+ rake (>= 0.8.7)
72
+ thor (>= 0.18.1, < 2.0)
73
+ rake (0.9.2.2)
74
+ rdoc (3.12.2)
75
+ json (~> 1.4)
76
+ rest-client (1.6.7)
77
+ mime-types (>= 1.16)
78
+ rspec (2.14.1)
79
+ rspec-core (~> 2.14.0)
80
+ rspec-expectations (~> 2.14.0)
81
+ rspec-mocks (~> 2.14.0)
82
+ rspec-core (2.14.7)
83
+ rspec-expectations (2.14.3)
84
+ diff-lcs (>= 1.1.3, < 2.0)
85
+ rspec-mocks (2.14.4)
86
+ simplecov (0.7.1)
87
+ multi_json (~> 1.0)
88
+ simplecov-html (~> 0.7.1)
89
+ simplecov-html (0.7.1)
90
+ sprockets (2.10.0)
91
+ hike (~> 1.2)
92
+ multi_json (~> 1.0)
93
+ rack (~> 1.0)
94
+ tilt (~> 1.1, != 1.3.0)
95
+ sprockets-rails (2.0.1)
96
+ actionpack (>= 3.0)
97
+ activesupport (>= 3.0)
98
+ sprockets (~> 2.8)
99
+ term-ansicolor (1.2.2)
100
+ tins (~> 0.8)
101
+ thor (0.18.1)
102
+ thread_safe (0.1.3)
103
+ atomic
104
+ tilt (1.4.1)
105
+ tins (0.12.0)
106
+ treetop (1.4.15)
107
+ polyglot
108
+ polyglot (>= 0.3.1)
109
+ tzinfo (0.3.38)
110
+
111
+ PLATFORMS
112
+ ruby
113
+
114
+ DEPENDENCIES
115
+ coveralls
116
+ fakeweb (>= 1.2.8)
117
+ gravatar-ultimate!
118
+ i18n (~> 0.6.0)
119
+ jruby-openssl
120
+ rails (~> 4.0)
121
+ rake (~> 0.9.2.2)
122
+ rdoc (~> 3.11)
123
+ rspec (>= 1.3.0)
@@ -26,12 +26,14 @@ rather than just a URL to that data. This saves you the extra step of having to
26
26
  s.summary = %q{A gem for interfacing with the entire Gravatar API: not just images, but the XML-RPC API too!}
27
27
  s.test_files = `git ls-files -- spec/*`.split("\n")
28
28
  s.executables = `git ls-files -- bin/*`.split("\n")
29
+
30
+ s.add_dependency('activesupport', '>= 2.3.14')
31
+ s.add_dependency('rack')
29
32
 
30
- # s.add_runtime_dependency('sc-core-ext', ">= 1.2.0")
31
33
  s.add_development_dependency('rspec', ">= 1.3.0")
32
34
  s.add_development_dependency('fakeweb', ">= 1.2.8")
33
- s.add_development_dependency('activesupport', '>= 2.3.14')
34
35
  s.add_development_dependency('i18n', '~> 0.6.0')
35
36
  s.add_development_dependency('rake', '~> 0.9.2.2')
36
37
  s.add_development_dependency('rdoc', '~> 3.11')
38
+ s.add_development_dependency('coveralls')
37
39
  end
@@ -18,7 +18,7 @@ require File.expand_path("../gravatar/cache", __FILE__)
18
18
  class Gravatar
19
19
  API_METHODS = [
20
20
  :exists?, :addresses, :user_images, :save_data!, :save_image!, :save_url!, :use_image!, :use_user_image!,
21
- :remove_image!, :delete_user_image!, :test, :image_url, :image_data
21
+ :remove_image!, :delete_user_image!, :test, :image_url, :image_data, :signup_url
22
22
  ]
23
23
  autoload :TestCase, File.expand_path('gravatar/test_case', File.dirname(__FILE__))
24
24
 
@@ -207,6 +207,15 @@ class Gravatar
207
207
  "#{proto}://#{sub}.gravatar.com/avatar/#{email_hash}#{extension_for_image(options)}#{query_for_image(options)}"
208
208
  end
209
209
 
210
+ # Returns the URL for Gravatar's signup form, with the user's email pre-filled. Options include:
211
+ #
212
+ # :locale if non-nil, wil be used to prefix the URL. Example: :en
213
+ def signup_url(options = {})
214
+ locale_prefix = options[:locale] ? "#{options[:locale]}." : ''
215
+
216
+ "https://#{locale_prefix}gravatar.com/site/signup/#{CGI.escape(email)}"
217
+ end
218
+
210
219
  # Returns the image data for this user's gravatar image. This is the same as reading the data at #image_url. See
211
220
  # that method for more information.
212
221
  #
@@ -1,6 +1,6 @@
1
1
  class Gravatar
2
2
  module Version
3
- MAJOR, MINOR, TINY = 1, 0, 3
3
+ MAJOR, MINOR, TINY = 2, 0, 0
4
4
  STRING = [MAJOR, MINOR, TINY].join('.')
5
5
  end
6
6
 
@@ -61,7 +61,7 @@ describe Gravatar::Cache do
61
61
  before(:each) { subject.logger = StringIO.new("") }
62
62
 
63
63
  it "should recover" do
64
- proc { subject.call(:nothing) { raise "something bad happened" } }.should_not raise_error(RuntimeError)
64
+ proc { subject.call(:nothing) { raise "something bad happened" } }.should_not raise_error
65
65
  end
66
66
 
67
67
  it "should return the cached copy" do
@@ -72,19 +72,19 @@ describe Gravatar::Cache do
72
72
  before(:each) { subject.logger = Object.new }
73
73
 
74
74
  it "should log it if #error is available" do
75
- subject.logger.stub!(:error => nil)
75
+ subject.logger.stub(:error => nil)
76
76
  subject.logger.should_receive(:error).and_return(nil)
77
77
  subject.call(:nothing) { raise "something bad happened" }
78
78
  end
79
79
 
80
80
  it "should log it if #write is available" do
81
- subject.logger.stub!(:write => nil)
81
+ subject.logger.stub(:write => nil)
82
82
  subject.logger.should_receive(:write).and_return(nil)
83
83
  subject.call(:nothing) { raise "something bad happened" }
84
84
  end
85
85
 
86
86
  it "should re-raise the error if no other methods are available" do
87
- proc { subject.call(:nothing) { raise "something bad happened" } }.should raise_error(RuntimeError)
87
+ proc { subject.call(:nothing) { raise "something bad happened" } }.should raise_error
88
88
  end
89
89
  end
90
90
 
@@ -105,7 +105,7 @@ describe Gravatar do
105
105
  before { grav $credentials[:email] }
106
106
 
107
107
  it "should not raise an error" do
108
- proc { grav }.should_not raise_error(ArgumentError)
108
+ proc { grav }.should_not raise_error
109
109
  end
110
110
 
111
111
  it "should return email_hash" do
@@ -173,5 +173,13 @@ describe Gravatar do
173
173
  )
174
174
  combinations.should include(image_url(:ssl => true, :default => "identicon", :size => 80, :rating => :g))
175
175
  end
176
+
177
+ it "should return gravatar signup_url" do
178
+ signup_url.should == "https://gravatar.com/site/signup/gravatartest123%40gmail.com"
179
+ end
180
+
181
+ it "should return gravatar signup_url with locale" do
182
+ signup_url(:locale => :en).should == "https://en.gravatar.com/site/signup/gravatartest123%40gmail.com"
183
+ end
176
184
  end
177
185
  end
@@ -1,6 +1,9 @@
1
1
  require 'bundler'
2
2
  Bundler.setup
3
3
 
4
+ require 'coveralls'
5
+ Coveralls.wear!
6
+
4
7
  require File.expand_path('../environments/rails', File.dirname(__FILE__))
5
8
  require File.expand_path("../../lib/gravatar", __FILE__)
6
9
  require 'rspec'
@@ -11,9 +14,19 @@ def mock_image_data
11
14
  end
12
15
 
13
16
  require 'fakeweb'
14
- FakeWeb.allow_net_connect = false
15
- FakeWeb.register_uri(:get, "http://www.gravatar.com/avatar/ef23bdc1f1fb9e3f46843a00e5832d98", :response =>
16
- "HTTP/1.1 200 OK\nContent-Type: image/jpg\n\n" +mock_image_data)
17
+
18
+ RSpec.configure do |config|
19
+ config.before do
20
+ FakeWeb.allow_net_connect = false
21
+ FakeWeb.register_uri(:get, "http://www.gravatar.com/avatar/ef23bdc1f1fb9e3f46843a00e5832d98", :response =>
22
+ "HTTP/1.1 200 OK\nContent-Type: image/jpg\n\n" +mock_image_data)
23
+ end
24
+
25
+ config.after do
26
+ FakeWeb.allow_net_connect = true
27
+ end
28
+ end
29
+
17
30
 
18
31
  def new_cache
19
32
  ActiveSupport::Cache::MemoryStore.new