Permalink
Browse files

Convert Frankie into a gem to work with Sinatra 0.2.0

  • Loading branch information...
1 parent 47911c1 commit d53ba0cfc5ace5d9d1bce13435befd49a1fc05e6 Ron Evans committed Apr 13, 2008
Showing with 299 additions and 155 deletions.
  1. BIN .DS_Store
  2. +3 −0 .gitignore
  3. +1 −0 CHANGELOG
  4. +20 −0 LICENSE
  5. +7 −0 Manifest
  6. +69 −0 README.rdoc
  7. +29 −0 Rakefile
  8. +160 −155 lib/frankie.rb
  9. +6 −0 test/frankie_test.rb
  10. +4 −0 test/helper.rb
View
BIN .DS_Store
Binary file not shown.
View
@@ -0,0 +1,3 @@
+doc
+pkg
+*.log
View
@@ -0,0 +1 @@
+v0.2.0. Converted codebase to become Ruby Gem
View
20 LICENSE
@@ -0,0 +1,20 @@
+Copyright (c) 2008 Ron Evans
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
@@ -0,0 +1,7 @@
+CHANGELOG
+lib/frankie.rb
+LICENSE
+Manifest
+Rakefile
+README.rdoc
+test/frankie_test.rb
View
@@ -0,0 +1,69 @@
+= Frankie
+
+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 'frankie'
+
+ configure do
+ set_option :sessions, true
+ load_facebook_config "./config/facebooker.yml", Sinatra.env
+ end
+
+ ## facebooker helpers
+ before do
+ ensure_authenticated_to_facebook
+ ensure_application_is_installed_by_facebook_user
+ end
+
+ ## the site
+ get '/' do
+ body "<h1>Hello #{session['facebook_session'].user.name} and welcome to frankie!</h1>"
+ end
+
+
+= How to use 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 /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. A more advanced and cooler approach uses a tunneling script like this one: http://pastie.caboo.se/178903
+
+- 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!
View
@@ -0,0 +1,29 @@
+require 'rubygems'
+require 'rake/testtask'
+require 'rake/rdoctask'
+require 'echoe'
+
+task :default => :test
+
+Rake::RDocTask.new do |rd|
+ rd.main = "README.rdoc"
+ rd.rdoc_files += ["README.rdoc"]
+ rd.rdoc_files += Dir.glob("lib/**/*.rb")
+ rd.rdoc_dir = 'doc'
+end
+
+Rake::TestTask.new do |t|
+ ENV['SINATRA_ENV'] = 'test'
+ t.pattern = File.dirname(__FILE__) + "/test/*_test.rb"
+end
+
+Echoe.new("frankie") do |p|
+ p.author = "Ron Evans"
+ p.summary = "Easy creation of Facebook applications in Ruby using plugin for Sinatra web framework that integrates with Facebooker gem."
+ p.url = "http://facethesinatra.com/"
+# p.docs_host = "sinatrarb.com:/var/www/blakemizerany.com/public/docs/"
+ p.dependencies = ["sinatra >=0.2.0", "facebooker >=0.9.5"]
+ p.install_message = "*** Frankie was installed ***"
+ p.include_rakefile = true
+end
+
Oops, something went wrong.

0 comments on commit d53ba0c

Please sign in to comment.