public
Fork of deadprogrammer/frankie
Description: Easy creation of Facebook applications in Ruby using plugin for Sinatra web framework that integrates with Facebooker gem.
Homepage: http://www.deadprogrammersociety.com
Clone URL: git://github.com/bmizerany/frankie.git
frankie / README
100644 66 lines (52 sloc) 2.153 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Frankie (http://facethesinatra.com) is a plugin for the Sinatra web framework (http://sinatrarb.com/) that allows you to easily create a Facebook application by using the Facebooker gem.
 
Written by Ron Evans (http://www.deadprogrammersociety.com)
 
Based on merb_facebooker (http://github.com/vanpelt/merb_facebooker) by Chris Van Pelt, which was based on
the Rails classes in Facebooker (http://facebooker.rubyforge.org/) by Mike Mangino, Shane Vitarana, & Chad Fowler
 
Thanks, everyone!
 
Here is a very simple example application:
-------
require "rubygems"
require "sinatra"
 
load_facebook_config "./config/facebooker.yml", Sinatra::Options.environment
 
# Facebooker helpers
before_attend :ensure_authenticated_to_facebook
before_attend :ensure_application_is_installed_by_facebook_user
 
## the site
get '/' do
  body "<h1>Hello #{session[:facebook_session].user.name} and welcome to frankie!</h1>"
end
-------
 
How to use frankie
- install the sinatra and facebooker gems
sudo gem install sinatra
sudo gem install facebooker
 
- Create the application directories for your new app, and grab the frankie plugin
mkdir myapp
cd myapp
mkdir config
mkdir vendor
cd vendor
git clone git://github.com/deadprogrammer/frankie.git
 
- Put your facebooker.yml file into the /myapp/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.
 
- Create your application, based on the sample above, and then run it:
ruby sample.rb
 
- Test your app by going to http://apps.facebook.com/yourappname
 
Have fun!