jsmestad-frankie 0.4.2 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile ADDED
@@ -0,0 +1,81 @@
1
+ h1. Frankie
2
+
3
+ h2. Sinatra Meets Facebook(er)
4
+
5
+ Frankie is a Facebooker wrapper for Sinatra (http://www.sinatrarb.com)
6
+
7
+ 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.
8
+
9
+ Frankie is based on merb_facebooker by Chris Van Pelt.
10
+
11
+ h2. Sample Application
12
+
13
+ require 'rubygems'
14
+ require 'frankie'
15
+
16
+ module MyApp < Sinatra::Base
17
+ register Sinatra::Frankie
18
+
19
+ configure do
20
+ set_option :sessions, true
21
+ load_facebook_config File.dirname(__FILE_) + "/config/facebooker.yml", Sinatra::Application.environment
22
+ end
23
+
24
+ ## facebooker helpers
25
+ before do
26
+ ensure_authenticated_to_facebook
27
+ ensure_application_is_installed_by_facebook_user
28
+ end
29
+
30
+
31
+ ## the site
32
+ get '/' do
33
+ body "Hello #{session[:facebook_session].user.name} and welcome to frankie!"
34
+ end
35
+ end
36
+
37
+
38
+ h2. Using Frankie
39
+
40
+ * Install the frankie gem (which will install both Sinatra and Facebooker if you do not already have them)
41
+ sudo gem install frankie
42
+
43
+ * Create the application directories for your new app
44
+ mkdir myapp
45
+ cd myapp
46
+ mkdir config
47
+
48
+ * Put your facebooker.yml file into the /lib/<application_name>/config directory, and set the values to your information. Here is a simple example of the file:
49
+
50
+ development:
51
+ api_key: apikeyhere
52
+ secret_key: secretkeyhere
53
+ canvas_page_name: yourcanvashere
54
+ callback_url: http://localhost:4567
55
+ test:
56
+ api_key: apikeyhere
57
+ secret_key: secretkeyhere
58
+ canvas_page_name: yourcanvashere
59
+ callback_url: http://localhost:4567
60
+ production:
61
+ api_key: apikeyhere
62
+ secret_key: secretkeyhere
63
+ canvas_page_name: yourcanvashere
64
+ callback_url: http://yourrealserver.com
65
+
66
+
67
+ * 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 <host> <remote_port> <local_port> like this:
68
+
69
+ tunnel app.myhost.com 10000 4567
70
+
71
+ You will also need to make sure your server's /etc/ssh/sshd_config contains the following line:
72
+
73
+ GatewayPorts clientspecified
74
+
75
+ Thanks to the many people like Evan Weaver, Blake Mizerany, and whoever else that have provided the code used in this tunneling script.
76
+
77
+ * Create your application, based on the sample above, and then run it:
78
+ ruby sample.rb
79
+
80
+ * Test your app by going to http://apps.facebook.com/yourappname
81
+
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.2
1
+ 0.5.0
data/frankie.gemspec CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{frankie}
5
- s.version = "0.4.2"
5
+ s.version = "0.5.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Ron Evans", "Justin Smestad"]
9
- s.date = %q{2009-06-25}
9
+ s.date = %q{2009-06-26}
10
10
  s.default_executable = %q{tunnel}
11
11
  s.email = %q{justin.smestad@gmail.com}
12
12
  s.executables = ["tunnel"]
13
13
  s.extra_rdoc_files = [
14
14
  "LICENSE",
15
- "README.rdoc"
15
+ "README.textile"
16
16
  ]
17
17
  s.files = [
18
18
  ".DS_Store",
@@ -20,7 +20,7 @@ Gem::Specification.new do |s|
20
20
  "CHANGELOG",
21
21
  "LICENSE",
22
22
  "Manifest",
23
- "README.rdoc",
23
+ "README.textile",
24
24
  "Rakefile",
25
25
  "VERSION",
26
26
  "bin/tunnel",
data/lib/frankie.rb CHANGED
@@ -180,7 +180,10 @@ module Sinatra
180
180
  "http://apps.facebook.com/#{ENV['FACEBOOKER_RELATIVE_URL_ROOT']}/#{url}"
181
181
  end
182
182
  end
183
+
184
+ def self.registered(app)
185
+ app.register Loader
186
+ app.helpers Helpers
187
+ end
183
188
  end
184
- register Frankie::Loader
185
- helpers Frankie::Helpers
186
189
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsmestad-frankie
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ron Evans
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2009-06-25 00:00:00 -07:00
13
+ date: 2009-06-26 00:00:00 -07:00
14
14
  default_executable: tunnel
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -41,14 +41,14 @@ extensions: []
41
41
 
42
42
  extra_rdoc_files:
43
43
  - LICENSE
44
- - README.rdoc
44
+ - README.textile
45
45
  files:
46
46
  - .DS_Store
47
47
  - .gitignore
48
48
  - CHANGELOG
49
49
  - LICENSE
50
50
  - Manifest
51
- - README.rdoc
51
+ - README.textile
52
52
  - Rakefile
53
53
  - VERSION
54
54
  - bin/tunnel
data/README.rdoc DELETED
@@ -1,79 +0,0 @@
1
- = Frankie
2
-
3
- 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.
4
-
5
- Written by Ron Evans (http://www.deadprogrammersociety.com)
6
-
7
- Based on merb_facebooker (http://github.com/vanpelt/merb_facebooker) by Chris Van Pelt, which was based on
8
- the Rails classes in Facebooker (http://facebooker.rubyforge.org/) by Mike Mangino, Shane Vitarana, & Chad Fowler
9
-
10
- 2/20/2009 - Now updated to Sinatra 0.9 and facebooker thanks to mjfreshyfresh.
11
-
12
- Thanks, everyone!
13
-
14
- = Here is a very simple example application:
15
-
16
- require 'rubygems'
17
- require 'frankie'
18
-
19
- configure do
20
- set_option :sessions, true
21
- load_facebook_config "./config/facebooker.yml", Sinatra.env
22
- end
23
-
24
- ## facebooker helpers
25
- before do
26
- ensure_authenticated_to_facebook
27
- ensure_application_is_installed_by_facebook_user
28
- end
29
-
30
- ## the site
31
- get '/' do
32
- body "<h1>Hello #{session[:facebook_session].user.name} and welcome to frankie!</h1>"
33
- end
34
-
35
-
36
- = How to use frankie
37
- - Install the frankie gem (which will install both Sinatra and Facebooker if you do not already have them)
38
- sudo gem install frankie
39
-
40
- - Create the application directories for your new app
41
- mkdir myapp
42
- cd myapp
43
- mkdir config
44
-
45
- - 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:
46
-
47
- development:
48
- api_key: apikeyhere
49
- secret_key: secretkeyhere
50
- canvas_page_name: yourcanvashere
51
- callback_url: http://localhost:4567
52
- test:
53
- api_key: apikeyhere
54
- secret_key: secretkeyhere
55
- canvas_page_name: yourcanvashere
56
- callback_url: http://localhost:4567
57
- production:
58
- api_key: apikeyhere
59
- secret_key: secretkeyhere
60
- canvas_page_name: yourcanvashere
61
- callback_url: http://yourrealserver.com
62
-
63
-
64
- - 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 <host> <remote_port> <local_port> like this:
65
-
66
- tunnel app.myhost.com 10000 4567
67
-
68
- You will also need to make sure your server's /etc/ssh/sshd_config contains the following line:
69
-
70
- GatewayPorts clientspecified
71
-
72
- Thanks to the many people like Evan Weaver, Blake Mizerany, and whoever else that have provided the code used in this tunneling script.
73
-
74
- - Create your application, based on the sample above, and then run it:
75
- ruby sample.rb
76
-
77
- - Test your app by going to http://apps.facebook.com/yourappname
78
-
79
- Have fun!