Faces: Standardized Multi-Avatar Framework
Faces 1.0 is a complete rewrite and is not compatible with any previous release.
Faces is a framework that standardizes the implementation of using multiple avatar providers within web applications. Any developer can create a strategies for an avatar provider to be used in conjunction with Faces.
In order to use Faces in your applications, you will need to leverage one or more strategies. These strategies are generally released individually as RubyGems.
Each Faces strategy is Rack Middleware. For example, to use the built-in Default strategy I might do this:
require 'sinatra' require 'faces' class MyApplication < Sinatra::Base use Rack::Session::Cookie use Faces::Strategies::Default, User, 'http://example.com/default_avatar.png' end
Faces is built for multi-provider avatar implementations however, and therefore you may wish to define multiple strategies. For this, the built-in
Faces::Builder class gives you a simple way to specify multiple strategies.
The following is an example you might put in a Rails initializer at
Rails.application.config.middleware.use Faces::Builder do provider :default, User, 'http://example.com/default_avatar.png' provider :gravatar, User, 'email' end
You should look to the documentation for each provider you use for specific initialization requirements.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install faces