simple_gravatar 0.0.1 → 0.1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 5cca89c2f2ec22dac400765a53ff9f6d3ec540c4
4
+ data.tar.gz: 0dd79461fa7651a1753948cd282931a645007400
5
+ SHA512:
6
+ metadata.gz: 2d2eb610618a1b8b9748419ca8cbb7daa0ea12103a6e3109af214884cb0127c643b3c0dd2e1863705dbbe28f91cb4b86bb842e2a471caf21ec93a64b1bf13d1c
7
+ data.tar.gz: 7cc0b00ea8eb1ce399b442b1f5d9f2b74d6f7c44f21b364e5d001cac0ba1b618a40e416e75f4f623d52059b2f8cc3300a306c1e3b5e33ef36d22389d410a2d1e
data/.gitignore CHANGED
@@ -1,4 +1,6 @@
1
1
  *.gem
2
2
  .bundle
3
+ .DS_Store
3
4
  Gemfile.lock
4
5
  pkg/*
6
+ coverage/*
data/.travis.yml CHANGED
@@ -1,5 +1,6 @@
1
- language: ruby
1
+ ---
2
2
  rvm:
3
3
  - 1.9.3
4
- - rbx-19mode
5
-
4
+ - 2.0.0
5
+ - 2.1.0
6
+ - ruby-head
data/Gemfile CHANGED
@@ -1,4 +1,3 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in simple_gravatar.gemspec
4
3
  gemspec
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # SimpleGravatar [![Build Status](https://travis-ci.org/patriciomacadden/simple_gravatar.png)](https://travis-ci.org/patriciomacadden/simple_gravatar) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/patriciomacadden/simple_gravatar)
1
+ # SimpleGravatar [![Build Status](http://img.shields.io/travis/patriciomacadden/simple_gravatar.svg)](https://travis-ci.org/patriciomacadden/simple_gravatar) [![Code Climate](http://img.shields.io/codeclimate/github/patriciomacadden/simple_gravatar.svg)](https://codeclimate.com/github/patriciomacadden/simple_gravatar) [![Coverage Status](http://img.shields.io/coveralls/patriciomacadden/simple_gravatar.svg)](https://coveralls.io/r/patriciomacadden/simple_gravatar) [![Dependency Status](http://img.shields.io/gemnasium/patriciomacadden/simple_gravatar.svg)](https://gemnasium.com/patriciomacadden/simple_gravatar) [![Gem Version](http://img.shields.io/gem/v/simple_gravatar.svg)](http://badge.fury.io/rb/simple_gravatar)
2
2
 
3
- ### Add gravatars to your ruby project as simple as possible.
3
+ Add gravatars to your ruby project as simple as possible.
4
4
 
5
5
  ## Installation
6
6
 
@@ -10,14 +10,51 @@ Add it to your Gemfile and run the `bundle` command:
10
10
  gem 'simple_gravatar'
11
11
  ```
12
12
 
13
- ## Getting started
13
+ ## Usage
14
14
 
15
- In rails, you can add gravatars just using the `gravatar_url` helper method:
15
+ Include de module where you want to use it:
16
+
17
+ ```ruby
18
+ class UserDecorator
19
+ include SimpleGravatar
20
+
21
+ def initialize(user)
22
+ @user = user
23
+ end
24
+
25
+ def gravatar
26
+ gravatar_url @user.email
27
+ end
28
+ end
29
+ ```
30
+
31
+ ### Using in rails
32
+
33
+ Include the module in `ActionView::Base`, let's say, in
34
+ `config/initializers/simple_gravatar.rb`:
35
+
36
+ ```ruby
37
+ ActionView::Base.send(:include, SimpleGravatar) if defined? ActionView::Base
38
+ ```
39
+
40
+ and use it anywhere in your views:
16
41
 
17
42
  ```ruby
18
43
  <%= image_tag gravatar_url('patriciomacadden@gmail.com') %>
19
44
  ```
20
45
 
46
+ ### Using in sinatra
47
+
48
+ Include the module as a helper:
49
+
50
+ ```
51
+ helpers SimpleGravatar
52
+
53
+ get '/' do
54
+ gravatar_url 'patriciomacadden@gmail.com'
55
+ end
56
+ ```
57
+
21
58
  ## Available options
22
59
 
23
60
  All available options are the specified by [Gravatar API documentation](http://en.gravatar.com/site/implement/images/).
@@ -29,3 +66,7 @@ All available options are the specified by [Gravatar API documentation](http://e
29
66
  3. Commit your changes (`git commit -am "Added some magic"`)
30
67
  4. Push to the branch (`git push origin my_awesome_branch`)
31
68
  5. Send pull request
69
+
70
+ ## License
71
+
72
+ See the [LICENSE](https://github.com/patriciomacadden/simple_gravatar/blob/master/LICENSE).
@@ -1,5 +1,3 @@
1
- require 'simple_gravatar/version'
2
-
3
1
  module SimpleGravatar
4
2
  DEFAULT_OPTIONS = {
5
3
  default: nil,
@@ -10,7 +8,7 @@ module SimpleGravatar
10
8
  }
11
9
 
12
10
  def gravatar_url(email, options = {})
13
- options = options.reverse_merge(DEFAULT_OPTIONS)
11
+ options = DEFAULT_OPTIONS.merge options
14
12
  secure = options[:secure]
15
13
  options.delete(:secure)
16
14
 
@@ -18,7 +16,7 @@ module SimpleGravatar
18
16
  options.delete(:forcedefault)
19
17
  end
20
18
 
21
- gravatar_id = Digest::MD5.hexdigest(email.downcase)
19
+ gravatar_id = Digest::MD5.hexdigest email.downcase
22
20
 
23
21
  params = options.collect { |k, v| "#{k}=#{v}" }.join('&')
24
22
 
@@ -31,5 +29,3 @@ module SimpleGravatar
31
29
  "#{url}/#{gravatar_id}.png?#{params}"
32
30
  end
33
31
  end
34
-
35
- ActionView::Base.send(:include, SimpleGravatar) if defined? ActionView::Base
@@ -1,10 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
- require 'simple_gravatar/version'
4
3
 
5
4
  Gem::Specification.new do |s|
6
5
  s.name = 'simple_gravatar'
7
- s.version = SimpleGravatar::VERSION
6
+ s.version = '0.1.0'
8
7
  s.authors = ['Patricio Mac Adden']
9
8
  s.email = ['patriciomacadden@gmail.com']
10
9
  s.homepage = 'https://github.com/patriciomacadden/simple_gravatar'
@@ -18,9 +17,8 @@ Gem::Specification.new do |s|
18
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
18
  s.require_paths = ['lib']
20
19
 
21
- # specify any dependencies here; for example:
22
- # s.add_development_dependency "rspec"
23
- # s.add_runtime_dependency "rest-client"
24
- s.add_dependency 'railties'
25
- s.add_dependency 'activesupport'
20
+ s.add_development_dependency 'bundler', '~> 1.5.0'
21
+ s.add_development_dependency 'coveralls'
22
+ s.add_development_dependency 'rake'
23
+ s.add_development_dependency 'minitest'
26
24
  end
@@ -0,0 +1,8 @@
1
+ require 'bundler/setup'
2
+
3
+ require 'coveralls'
4
+ Coveralls.wear!
5
+
6
+ require 'minitest/autorun'
7
+
8
+ require 'simple_gravatar'
@@ -1,16 +1,9 @@
1
- require 'spec_helper'
1
+ require 'minitest_helper'
2
2
 
3
3
  include SimpleGravatar
4
4
 
5
5
  describe SimpleGravatar do
6
- describe SimpleGravatar::VERSION do
7
- it 'should be defined' do
8
- SimpleGravatar::VERSION.wont_be_nil
9
- end
10
- end
11
-
12
6
  describe :gravatar_url do
13
-
14
7
  let(:email) { 'some_email@gmail.com' }
15
8
 
16
9
  it 'should digest the email' do
metadata CHANGED
@@ -1,38 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_gravatar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.1.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Patricio Mac Adden
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-11-28 00:00:00.000000000 Z
11
+ date: 2014-04-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: railties
16
- requirement: &70362587214280 !ruby/object:Gem::Requirement
17
- none: false
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
18
16
  requirements:
19
- - - ! '>='
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.5.0
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 1.5.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: coveralls
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
20
39
  - !ruby/object:Gem::Version
21
40
  version: '0'
22
- type: :runtime
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
23
49
  prerelease: false
24
- version_requirements: *70362587214280
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
25
55
  - !ruby/object:Gem::Dependency
26
- name: activesupport
27
- requirement: &70362587212580 !ruby/object:Gem::Requirement
28
- none: false
56
+ name: minitest
57
+ requirement: !ruby/object:Gem::Requirement
29
58
  requirements:
30
- - - ! '>='
59
+ - - ">="
31
60
  - !ruby/object:Gem::Version
32
61
  version: '0'
33
- type: :runtime
62
+ type: :development
34
63
  prerelease: false
35
- version_requirements: *70362587212580
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
36
69
  description: Add gravatars to your ruby project as simple as possible.
37
70
  email:
38
71
  - patriciomacadden@gmail.com
@@ -40,41 +73,39 @@ executables: []
40
73
  extensions: []
41
74
  extra_rdoc_files: []
42
75
  files:
43
- - .gitignore
44
- - .travis.yml
76
+ - ".gitignore"
77
+ - ".travis.yml"
45
78
  - Gemfile
46
79
  - LICENSE
47
80
  - README.md
48
81
  - Rakefile
49
82
  - lib/simple_gravatar.rb
50
- - lib/simple_gravatar/version.rb
51
83
  - simple_gravatar.gemspec
52
- - spec/spec_helper.rb
53
- - spec/unit/simple_gravatar_spec.rb
84
+ - spec/minitest_helper.rb
85
+ - spec/simple_gravatar_spec.rb
54
86
  homepage: https://github.com/patriciomacadden/simple_gravatar
55
87
  licenses: []
88
+ metadata: {}
56
89
  post_install_message:
57
90
  rdoc_options: []
58
91
  require_paths:
59
92
  - lib
60
93
  required_ruby_version: !ruby/object:Gem::Requirement
61
- none: false
62
94
  requirements:
63
- - - ! '>='
95
+ - - ">="
64
96
  - !ruby/object:Gem::Version
65
97
  version: '0'
66
98
  required_rubygems_version: !ruby/object:Gem::Requirement
67
- none: false
68
99
  requirements:
69
- - - ! '>='
100
+ - - ">="
70
101
  - !ruby/object:Gem::Version
71
102
  version: '0'
72
103
  requirements: []
73
104
  rubyforge_project: simple_gravatar
74
- rubygems_version: 1.8.17
105
+ rubygems_version: 2.2.2
75
106
  signing_key:
76
- specification_version: 3
107
+ specification_version: 4
77
108
  summary: Add gravatars to your ruby project as simple as possible.
78
109
  test_files:
79
- - spec/spec_helper.rb
80
- - spec/unit/simple_gravatar_spec.rb
110
+ - spec/minitest_helper.rb
111
+ - spec/simple_gravatar_spec.rb
@@ -1,3 +0,0 @@
1
- module SimpleGravatar
2
- VERSION = '0.0.1'
3
- end
data/spec/spec_helper.rb DELETED
@@ -1,6 +0,0 @@
1
- require 'rubygems'
2
-
3
- require 'active_support/all'
4
- require 'minitest/autorun'
5
-
6
- require 'simple_gravatar'