Project

faces

0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Avatars made super simple.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Faces: Standardized Multi-Avatar Framework

Gem Version CI Build Status Code Climate Coverage Status

Faces 1.0 is a complete rewrite and is not compatible with any previous release.

Introduction

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.

This library is heavily inspired by OmniAuth in its implementation, as is this README. Big kudos to Intridea for creating such an awesome library.

## Usage

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 config/initializers/faces.rb:

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.

Installation

Add this line to your application's Gemfile:

gem 'faces'

And then execute:

$ bundle

Or install it yourself as:

$ gem install faces