this branch is no longer actively developed, its here for historical purposes only.
Ruby
Switch branches/tags
Pull request Compare This branch is 20 commits ahead of deadprogram:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
lib
test
.DS_Store
.gitignore
CHANGELOG
LICENSE
Manifest
README.textile
Rakefile
VERSION
frankie.gemspec

README.textile

Frankie

Sinatra Meets Facebook(er)

Frankie is a Facebooker wrapper for Sinatra (http://www.sinatrarb.com)

Maintained by Justin Smestad (http://www.evalcode.com). This version is not backwards compatible with anything prior to Sinatra 0.9. Original version by Ron Evans has support for older versions of Sinatra and ‘classic-style’ applications.

Frankie is based on merb_facebooker by Chris Van Pelt.

Sample Application

require ‘rubygems’
require ‘frankie’

module MyApp < Sinatra::Base register Sinatra::Frankie configure do set_option :sessions, true load_facebook_config File.dirname(__FILE_) + “/config/facebooker.yml”, Sinatra::Application.environment end
  1. facebooker helpers
    before do
    ensure_authenticated_to_facebook
    ensure_application_is_installed_by_facebook_user
    end

## the site
get ‘/’ do
body “Hello #{session[:facebook_session].user.name} and welcome to frankie!”
end
end

Using Frankie

  • Install the frankie gem (which will install both Sinatra and Facebooker if you do not already have them)
    sudo gem install frankie
  • Create the application directories for your new app
    mkdir myapp
    cd myapp
    mkdir config
  • Put your facebooker.yml file into the /lib//config directory, and set the values to your information. Here is a simple example of the file:

development:
api_key: apikeyhere
secret_key: secretkeyhere
canvas_page_name: yourcanvashere
callback_url: http://localhost:4567
test:
api_key: apikeyhere
secret_key: secretkeyhere
canvas_page_name: yourcanvashere
callback_url: http://localhost:4567
production:
api_key: apikeyhere
secret_key: secretkeyhere
canvas_page_name: yourcanvashere
callback_url: http://yourrealserver.com

  • Make sure you have setup your Facebook application on the facebook site. Google “setup new facebook application” if you are unsure how to do this. I recommend starting with an IFrame application. A more advanced and cooler approach uses a tunneling script, which is included with Frankie. You do need to have “autossh” installed in order to use it, as well as a publicly addressable server. From a command prompt type tunnel like this:

tunnel app.myhost.com 10000 4567

You will also need to make sure your server’s /etc/ssh/sshd_config contains the following line:

GatewayPorts clientspecified

Thanks to the many people like Evan Weaver, Blake Mizerany, and whoever else that have provided the code used in this tunneling script.

  • Create your application, based on the sample above, and then run it:
    ruby sample.rb