eukaliptus 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +44 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +56 -0
- data/Rakefile +16 -0
- data/eukaliptus.gemspec +23 -0
- data/lib/eukaliptus.rb +3 -0
- data/lib/eukaliptus/koala.rb +17 -0
- data/lib/eukaliptus/middleware.rb +66 -0
- data/lib/eukaliptus/railtie.rb +41 -0
- data/lib/eukaliptus/request.rb +13 -0
- data/lib/eukaliptus/version.rb +3 -0
- data/lib/eukaliptus/view_helpers/facebook_helpers.rb +173 -0
- data/lib/generators/eukaliptus/config_generator.rb +18 -0
- data/lib/generators/templates/facebook.yml +16 -0
- data/lib/tasks/facebook.rake +19 -0
- data/test/test_eukaliptus.rb +7 -0
- data/test/test_helper.rb +22 -0
- data/test/view_helpers/facebook_helpers_test.rb +10 -0
- metadata +88 -0
data/.gitignore
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
Gemfile.lock
|
2
|
+
|
3
|
+
# rcov generated
|
4
|
+
coverage
|
5
|
+
|
6
|
+
# rdoc generated
|
7
|
+
rdoc
|
8
|
+
|
9
|
+
# yard generated
|
10
|
+
doc
|
11
|
+
.yardoc
|
12
|
+
|
13
|
+
# bundler
|
14
|
+
.bundle
|
15
|
+
|
16
|
+
# jeweler generated
|
17
|
+
pkg
|
18
|
+
|
19
|
+
# Have editor/IDE/OS specific files you need to ignore? Consider using a global gitignore:
|
20
|
+
#
|
21
|
+
# * Create a file at ~/.gitignore
|
22
|
+
# * Include files you want ignored
|
23
|
+
# * Run: git config --global core.excludesfile ~/.gitignore
|
24
|
+
#
|
25
|
+
# After doing this, these files will be ignored in all your git projects,
|
26
|
+
# saving you from having to 'pollute' every project you touch with them
|
27
|
+
#
|
28
|
+
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
29
|
+
#
|
30
|
+
# For MacOS:
|
31
|
+
#
|
32
|
+
#.DS_Store
|
33
|
+
#
|
34
|
+
# For TextMate
|
35
|
+
#*.tmproj
|
36
|
+
#tmtags
|
37
|
+
#
|
38
|
+
# For emacs:
|
39
|
+
#*~
|
40
|
+
#\#*
|
41
|
+
#.\#*
|
42
|
+
#
|
43
|
+
# For vim:
|
44
|
+
#*.swp
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Season Advertising S.L., Victor Castell
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
= Eukaliptus
|
2
|
+
|
3
|
+
Eukaliptus is a set of helpers to help you build Facebook applications, fan pages tabs or integrate Facebook in your web site.
|
4
|
+
|
5
|
+
It generates the necessary JS code to perform requests to Eukaliptus Rack middleware that fixes cookies security problems related with running iframe applications inside facebook. It is also useful for Facebook connect apps.
|
6
|
+
|
7
|
+
With Eukaliptus and Koala it's very easy to build-up a rock solid Facebook connect application with JS authentication that works in all browsers in less that 5 minutes.
|
8
|
+
|
9
|
+
It will be a key component of our next product Eukaliptus Core.
|
10
|
+
|
11
|
+
We provide integration with two authentication methods out of the box, Koala Facebook library, see https://github.com/arsduo/koala and the combination of Omniauth + Devise.
|
12
|
+
|
13
|
+
== Installation (Rails)
|
14
|
+
|
15
|
+
Require it in your Gemfile
|
16
|
+
|
17
|
+
gem 'eukaliptus', :git => 'git://github.com/seasonlabs/eukaliptus.git'
|
18
|
+
|
19
|
+
Update your bundle
|
20
|
+
|
21
|
+
$ bundle install
|
22
|
+
|
23
|
+
Run the generator
|
24
|
+
|
25
|
+
$ rails generate eukaliptus:config
|
26
|
+
|
27
|
+
Go to http://www.facebook.com/developers/createapp.php and create a new Facebook app, configure it and then fill up the file config/facebook.yml with the details of you newly created app.
|
28
|
+
|
29
|
+
You are now ready to begin using Eukaliptus.
|
30
|
+
|
31
|
+
== Requirements
|
32
|
+
|
33
|
+
jQuery library for the front-end.
|
34
|
+
Your rails application must be using jQuery as it will be the default JS library for Rails from 3.1+.
|
35
|
+
|
36
|
+
== Getting started
|
37
|
+
|
38
|
+
Just behind the <body> tag in your application.html.erb write:
|
39
|
+
|
40
|
+
<%= fb_login %>
|
41
|
+
|
42
|
+
This generates the necessary JS code to perform request to Eukaliptus that fixes cookies security problems involved in running iframe applications in Safari and IE6+
|
43
|
+
|
44
|
+
Then you can place a link anywhere in your code that gives the user the chance to login with Facebook:
|
45
|
+
|
46
|
+
<%= link_to "Log in with Facebook", "#", :onclick => "login('/redirect/path');" %>
|
47
|
+
|
48
|
+
== Helpers
|
49
|
+
|
50
|
+
Al helpers are namespaced with fb_ prefix you can find the documentation in this file lib/eukaliptus/view_helpers/facebook_helpers.rb
|
51
|
+
|
52
|
+
== Copyright
|
53
|
+
|
54
|
+
Copyright (c) 2011 Season Advertising S.L. http://www.season.es
|
55
|
+
See LICENSE.txt for further details.
|
56
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'rake/testtask'
|
6
|
+
require 'rake/rdoctask'
|
7
|
+
|
8
|
+
task :default => :test
|
9
|
+
|
10
|
+
desc 'Test the typus plugin.'
|
11
|
+
Rake::TestTask.new(:test) do |t|
|
12
|
+
t.libs << 'lib'
|
13
|
+
t.libs << 'test'
|
14
|
+
t.pattern = 'test/**/*_test.rb'
|
15
|
+
t.verbose = true
|
16
|
+
end
|
data/eukaliptus.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "eukaliptus/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "eukaliptus"
|
7
|
+
s.version = Eukaliptus::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["season", "victorcoder"]
|
10
|
+
s.email = ["victorcoder@gmail.com"]
|
11
|
+
s.homepage = "http://github.com/seasonlabs/eukaliptus"
|
12
|
+
s.summary = %q{Eukaliptus Facebook API Helpers}
|
13
|
+
s.description = %q{Eukaliptus is a set of helpers and bug fixes for browsers to help you build Facebook iframe applications or user fan tabs.}
|
14
|
+
s.license = "MIT"
|
15
|
+
s.rubyforge_project = "eukaliptus"
|
16
|
+
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
|
22
|
+
s.add_dependency 'koala', '~> 1.0.0'
|
23
|
+
end
|
data/lib/eukaliptus.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# config/initializers/koala.rb
|
2
|
+
# Monkey-patch in Facebook config so Koala knows to
|
3
|
+
# automatically use Facebook settings from here if none are given
|
4
|
+
|
5
|
+
Koala::Facebook::OAuth.class_eval do
|
6
|
+
def initialize_with_default_settings(*args)
|
7
|
+
case args.size
|
8
|
+
when 0, 1
|
9
|
+
raise "application id and/or secret are not specified in the config" unless Facebook::APP_ID && Facebook::SECRET
|
10
|
+
initialize_without_default_settings(Facebook::APP_ID.to_s, Facebook::SECRET.to_s, args.first)
|
11
|
+
when 2, 3
|
12
|
+
initialize_without_default_settings(*args)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
alias_method_chain :initialize, :default_settings
|
17
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Eukaliptus
|
2
|
+
class Middleware
|
3
|
+
def initialize(app, options = {})
|
4
|
+
@app, @options = app, options
|
5
|
+
end
|
6
|
+
|
7
|
+
def call(env)
|
8
|
+
@request = Request.new(env)
|
9
|
+
|
10
|
+
# Catch and convert POST from facebook
|
11
|
+
if @request.facebook?
|
12
|
+
env["facebook.original_method"] = env["REQUEST_METHOD"]
|
13
|
+
env["REQUEST_METHOD"] = 'GET'
|
14
|
+
end
|
15
|
+
|
16
|
+
status, headers, body = @app.call(env)
|
17
|
+
@response = Rack::Response.new body, status, headers
|
18
|
+
|
19
|
+
# Fixes IE security bug
|
20
|
+
@response.header["P3P"] = 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"'
|
21
|
+
|
22
|
+
if env['PATH_INFO'] == '/cookie_fix'
|
23
|
+
cookie_fix(env)
|
24
|
+
else
|
25
|
+
@response.finish
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Get POST params and process it to build up the cookie for FB
|
30
|
+
# authentication. Then prepare the response for redirection and
|
31
|
+
# breaks the request workflow setting the cookie at the same time.
|
32
|
+
# This way Safari and other browsers with extra iframe security
|
33
|
+
# gets the cookie set too.
|
34
|
+
def cookie_fix(env)
|
35
|
+
params = @request.params
|
36
|
+
|
37
|
+
if params['_session_id']
|
38
|
+
session = ActiveSupport::JSON.decode(params['_session_id'])
|
39
|
+
|
40
|
+
unless (@request.cookies['fbs_' + Facebook::APP_ID.to_s].present?)
|
41
|
+
session = session.map { |key, value| key.to_s + "=" + value.to_s }.join("&")
|
42
|
+
@response.set_cookie('fbs_' + Facebook::APP_ID.to_s, session)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
@response.headers.delete "Content-Type"
|
47
|
+
@response.headers.delete "Content-Length"
|
48
|
+
@response.headers.delete "X-Cascade"
|
49
|
+
|
50
|
+
if defined?(OmniAuth) and defined?(Devise)
|
51
|
+
mappings = Devise.mappings[:user]
|
52
|
+
|
53
|
+
if mappings.controllers.has_key? :omniauth_callbacks
|
54
|
+
path = [mappings.path, 'auth', :facebook.to_s, 'callback'].join('/')
|
55
|
+
@response.redirect(path + "?redirect_to=#{params['redirect_to']}")
|
56
|
+
else
|
57
|
+
@response.redirect('/' + "?redirect_to=#{params['redirect_to']}")
|
58
|
+
end
|
59
|
+
else
|
60
|
+
@response.redirect((params['redirect_to'] ? params['redirect_to'] : '/'))
|
61
|
+
end
|
62
|
+
|
63
|
+
[302, @response.headers, ['Cookie Setted']]
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'rails'
|
2
|
+
require 'koala'
|
3
|
+
require 'eukaliptus/request'
|
4
|
+
require 'eukaliptus/middleware'
|
5
|
+
|
6
|
+
module Facebook
|
7
|
+
end
|
8
|
+
|
9
|
+
module Eukaliptus
|
10
|
+
class Railtie < Rails::Railtie
|
11
|
+
# Load rake tasks
|
12
|
+
rake_tasks do
|
13
|
+
load File.join(File.dirname(__FILE__), '../tasks/facebook.rake')
|
14
|
+
end
|
15
|
+
|
16
|
+
initializer "eukaliptus.middleware", :after => :after_initialize do |app|
|
17
|
+
#ActionView::Base.send :include, Helper
|
18
|
+
app.middleware.use Eukaliptus::Middleware
|
19
|
+
end
|
20
|
+
|
21
|
+
initializer "eukaliptus.koala" do |app|
|
22
|
+
config_file = Rails.root.join("config/facebook.yml")
|
23
|
+
|
24
|
+
if config_file.file?
|
25
|
+
CONFIG = YAML.load_file(config_file)[Rails.env]
|
26
|
+
Facebook::APP_ID = CONFIG['app_id']
|
27
|
+
Facebook::SECRET = CONFIG['secret_key']
|
28
|
+
Facebook::CANVAS = CONFIG['canvas']
|
29
|
+
end
|
30
|
+
|
31
|
+
require 'eukaliptus/koala'
|
32
|
+
end
|
33
|
+
|
34
|
+
initializer "eukaliptus.action_view" do |app|
|
35
|
+
ActiveSupport.on_load :action_view do
|
36
|
+
require 'eukaliptus/view_helpers/facebook_helpers'
|
37
|
+
include Eukaliptus::FacebookHelpers
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rack/request'
|
2
|
+
|
3
|
+
# Extend Rack::Request to add some helpers for FB
|
4
|
+
class Request < ::Rack::Request
|
5
|
+
def params
|
6
|
+
rack_input = env["rack.input"].read
|
7
|
+
@params ||= Rack::Utils.parse_query(rack_input, "&")
|
8
|
+
end
|
9
|
+
|
10
|
+
def facebook?
|
11
|
+
params["signed_request"].present?
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,173 @@
|
|
1
|
+
module Eukaliptus
|
2
|
+
module FacebookHelpers
|
3
|
+
# Renders the HTML + JS that enables the app to log in to Facebook using
|
4
|
+
# the Javascript method.
|
5
|
+
#
|
6
|
+
# Accepts the permissions that your application needs to work.
|
7
|
+
#
|
8
|
+
# Use it one time in your layout header or use it in several app places
|
9
|
+
# to ask the user for different permissions depending on the context, page, etc.
|
10
|
+
def fb_login(perms = %w{email publish_stream})
|
11
|
+
js = <<-DATA
|
12
|
+
<div id="fb-root"></div>
|
13
|
+
<script type="text/javascript">
|
14
|
+
window.fbAsyncInit = function() {
|
15
|
+
FB.init({
|
16
|
+
appId: '#{Facebook::APP_ID.to_s}',
|
17
|
+
status: true,
|
18
|
+
cookie: true,
|
19
|
+
xfbml: true
|
20
|
+
});
|
21
|
+
|
22
|
+
FB.Canvas.setAutoResize(100);
|
23
|
+
};
|
24
|
+
|
25
|
+
(function() {
|
26
|
+
var e = document.createElement('script'); e.async = true;
|
27
|
+
e.src = document.location.protocol +
|
28
|
+
'//connect.facebook.net/es_ES/all.js';
|
29
|
+
document.getElementById('fb-root').appendChild(e);
|
30
|
+
}());
|
31
|
+
|
32
|
+
var login = function(targetUrl, perms) {
|
33
|
+
if (perms == null) {
|
34
|
+
perms = "#{perms.join(',')}"
|
35
|
+
}
|
36
|
+
FB.login(function(response) {
|
37
|
+
if (response.session) {
|
38
|
+
fixSession(JSON.stringify(response.session), targetUrl);
|
39
|
+
} else {
|
40
|
+
//pending to do when not logged in
|
41
|
+
}
|
42
|
+
}, {perms: perms});
|
43
|
+
}
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
function fixSession(fbSession, targetUrl) {
|
48
|
+
$("body").prepend('<form id="fixSession"></form>');
|
49
|
+
|
50
|
+
var f = $('form')[0];
|
51
|
+
f.method = 'POST';
|
52
|
+
f.action = "/cookie_fix";
|
53
|
+
var m = document.createElement('input');
|
54
|
+
m.setAttribute('type', 'hidden');
|
55
|
+
m.setAttribute('name', '_session_id');
|
56
|
+
m.setAttribute('value', fbSession);
|
57
|
+
f.appendChild(m);
|
58
|
+
|
59
|
+
m = document.createElement('input');
|
60
|
+
m.setAttribute('type', 'hidden');
|
61
|
+
m.setAttribute('name', 'redirect_to');
|
62
|
+
m.setAttribute('value', targetUrl);
|
63
|
+
f.appendChild(m);
|
64
|
+
|
65
|
+
f.submit();
|
66
|
+
}
|
67
|
+
</script>
|
68
|
+
DATA
|
69
|
+
|
70
|
+
js.html_safe
|
71
|
+
end
|
72
|
+
|
73
|
+
# Function to create a new FB.ui dialog link
|
74
|
+
def fb_ui(name, options ={})
|
75
|
+
callback = options.delete(:callback)
|
76
|
+
callback.gsub!('"', "'")
|
77
|
+
|
78
|
+
data = "FB.ui(#{options.to_json.gsub('"', "'")}, #{callback});"
|
79
|
+
link_to(name, '#', :onclick => data.html_safe)
|
80
|
+
end
|
81
|
+
|
82
|
+
# Create a new wall post
|
83
|
+
# You can use it directly in your templates or call it from inside your helpers:
|
84
|
+
#
|
85
|
+
# module MyHelper
|
86
|
+
# def post_something_to_wall(something)
|
87
|
+
# fb_post_to_wall('Publish this great thing to wall!', :name => Something.name)
|
88
|
+
# end
|
89
|
+
# end
|
90
|
+
#
|
91
|
+
# The options are the same than in Facebook feed post passed as Hash
|
92
|
+
# see: http://developers.facebook.com/docs/reference/javascript/FB.ui/
|
93
|
+
#
|
94
|
+
# :callback
|
95
|
+
# JS callback function to do somethink with the data
|
96
|
+
def fb_post_to_wall(name = 'Post to wall', options = {})
|
97
|
+
options = {
|
98
|
+
:method => 'feed',
|
99
|
+
:callback => 'function(response) {}'
|
100
|
+
}.merge(options)
|
101
|
+
|
102
|
+
fb_ui name, options
|
103
|
+
end
|
104
|
+
|
105
|
+
# Options
|
106
|
+
#
|
107
|
+
# :id
|
108
|
+
# Required. The ID or username of the target user to add as a friend.
|
109
|
+
#
|
110
|
+
# :callback
|
111
|
+
# JS callback function to do somethink with the data
|
112
|
+
def fb_add_friend(name = 'Add as a friend', options = {})
|
113
|
+
options = {
|
114
|
+
:method => 'friends',
|
115
|
+
:callback => 'function(response) {}'
|
116
|
+
}.merge(options)
|
117
|
+
|
118
|
+
fb_ui name, options
|
119
|
+
end
|
120
|
+
|
121
|
+
# Options
|
122
|
+
#
|
123
|
+
# :message
|
124
|
+
# The request the receiving user will see. It appears as a question posed by the sending user.
|
125
|
+
# The maximum length is 255 characters.
|
126
|
+
#
|
127
|
+
# :to
|
128
|
+
# A user ID or username. Must be a friend of the sender.
|
129
|
+
# If this is specified, the user will not have a choice of recipients.
|
130
|
+
# If this is omitted, the user will see a friend selector and will be able to select a maximum of 50 recipients.
|
131
|
+
#
|
132
|
+
# :data
|
133
|
+
# Optional, additional data you may pass for tracking. This will be stored as part of the request objects created.
|
134
|
+
#
|
135
|
+
# :title
|
136
|
+
# Optional, the title for the friend selector dialog. Maximum length is 50 characters.
|
137
|
+
#
|
138
|
+
# :callback
|
139
|
+
# JS callback function to do somethink with the data
|
140
|
+
def fb_app_request(name = 'Invite to use this application', options = {})
|
141
|
+
options = {
|
142
|
+
:method => 'apprequests',
|
143
|
+
:message => 'Invite your friends to use your app!',
|
144
|
+
:callback => 'function(response) {}'
|
145
|
+
}.merge(options)
|
146
|
+
|
147
|
+
fb_ui name, options
|
148
|
+
end
|
149
|
+
|
150
|
+
# Options
|
151
|
+
#
|
152
|
+
# :credits_purchase
|
153
|
+
# Whether it is a Credits purchase dialog or not
|
154
|
+
#
|
155
|
+
# :order_info
|
156
|
+
# The internal key of the item you are selling.
|
157
|
+
# IT's required in case credits_purchase is false and should only be meaningful to you.
|
158
|
+
#
|
159
|
+
# :dev_purchase_params
|
160
|
+
# More developer parameters. For details, read http://developers.facebook.com/docs/creditsapi/
|
161
|
+
#
|
162
|
+
# :callback
|
163
|
+
# JS callback function to do somethink with the data
|
164
|
+
def fb_pay(name = 'Buy credits', options = {})
|
165
|
+
options = {
|
166
|
+
:method => 'pay',
|
167
|
+
:callback => 'function(response) {}'
|
168
|
+
}.merge(options)
|
169
|
+
|
170
|
+
fb_ui name, options
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Eukaliptus
|
2
|
+
module Generators
|
3
|
+
class ConfigGenerator < Rails::Generators::Base
|
4
|
+
|
5
|
+
source_root File.expand_path("../../templates", __FILE__)
|
6
|
+
|
7
|
+
desc <<-MSG
|
8
|
+
Description:
|
9
|
+
Creates configuration files and stores them in `config`.
|
10
|
+
|
11
|
+
MSG
|
12
|
+
|
13
|
+
def generate_config
|
14
|
+
template "facebook.yml", "config/facebook.yml"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
development: &FACEBOOK_BASE
|
2
|
+
api_key:
|
3
|
+
secret_key:
|
4
|
+
app_id:
|
5
|
+
host: http://localhost:3000
|
6
|
+
canvas: http://apps.facebook.com/
|
7
|
+
|
8
|
+
test:
|
9
|
+
<<: *FACEBOOK_BASE
|
10
|
+
|
11
|
+
production:
|
12
|
+
api_key:
|
13
|
+
secret_key:
|
14
|
+
app_id:
|
15
|
+
host:
|
16
|
+
canvas: http://apps.facebook.com/
|
@@ -0,0 +1,19 @@
|
|
1
|
+
namespace :facebook do
|
2
|
+
|
3
|
+
desc "List fake users"
|
4
|
+
task :list_fake_users => :environment do
|
5
|
+
puts connect_to_facebook.list
|
6
|
+
end
|
7
|
+
|
8
|
+
desc "Create fake user"
|
9
|
+
task :create_fake_user => :environment do
|
10
|
+
connect_to_facebook.create(true, 'publish_stream')
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
|
15
|
+
def connect_to_facebook
|
16
|
+
oauth = Koala::Facebook::OAuth.new
|
17
|
+
options = { :app_access_token => oauth.get_app_access_token, :app_id => Facebook::APP_ID}
|
18
|
+
Koala::Facebook::TestUsers.new(options)
|
19
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
|
11
|
+
require 'minitest/unit'
|
12
|
+
require 'minitest/spec'
|
13
|
+
|
14
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
15
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
16
|
+
require 'eukaliptus'
|
17
|
+
|
18
|
+
class MiniTest::Unit::TestCase
|
19
|
+
end
|
20
|
+
|
21
|
+
MiniTest::Unit.autorun
|
22
|
+
|
metadata
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: eukaliptus
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease:
|
5
|
+
version: 0.7.1
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- season
|
9
|
+
- victorcoder
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
|
14
|
+
date: 2011-06-11 00:00:00 +02:00
|
15
|
+
default_executable:
|
16
|
+
dependencies:
|
17
|
+
- !ruby/object:Gem::Dependency
|
18
|
+
name: koala
|
19
|
+
prerelease: false
|
20
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
21
|
+
none: false
|
22
|
+
requirements:
|
23
|
+
- - ~>
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: 1.0.0
|
26
|
+
type: :runtime
|
27
|
+
version_requirements: *id001
|
28
|
+
description: Eukaliptus is a set of helpers and bug fixes for browsers to help you build Facebook iframe applications or user fan tabs.
|
29
|
+
email:
|
30
|
+
- victorcoder@gmail.com
|
31
|
+
executables: []
|
32
|
+
|
33
|
+
extensions: []
|
34
|
+
|
35
|
+
extra_rdoc_files: []
|
36
|
+
|
37
|
+
files:
|
38
|
+
- .gitignore
|
39
|
+
- Gemfile
|
40
|
+
- LICENSE.txt
|
41
|
+
- README.rdoc
|
42
|
+
- Rakefile
|
43
|
+
- eukaliptus.gemspec
|
44
|
+
- lib/eukaliptus.rb
|
45
|
+
- lib/eukaliptus/koala.rb
|
46
|
+
- lib/eukaliptus/middleware.rb
|
47
|
+
- lib/eukaliptus/railtie.rb
|
48
|
+
- lib/eukaliptus/request.rb
|
49
|
+
- lib/eukaliptus/version.rb
|
50
|
+
- lib/eukaliptus/view_helpers/facebook_helpers.rb
|
51
|
+
- lib/generators/eukaliptus/config_generator.rb
|
52
|
+
- lib/generators/templates/facebook.yml
|
53
|
+
- lib/tasks/facebook.rake
|
54
|
+
- test/test_eukaliptus.rb
|
55
|
+
- test/test_helper.rb
|
56
|
+
- test/view_helpers/facebook_helpers_test.rb
|
57
|
+
has_rdoc: true
|
58
|
+
homepage: http://github.com/seasonlabs/eukaliptus
|
59
|
+
licenses:
|
60
|
+
- MIT
|
61
|
+
post_install_message:
|
62
|
+
rdoc_options: []
|
63
|
+
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
none: false
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: "0"
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: "0"
|
78
|
+
requirements: []
|
79
|
+
|
80
|
+
rubyforge_project: eukaliptus
|
81
|
+
rubygems_version: 1.6.1
|
82
|
+
signing_key:
|
83
|
+
specification_version: 3
|
84
|
+
summary: Eukaliptus Facebook API Helpers
|
85
|
+
test_files:
|
86
|
+
- test/test_eukaliptus.rb
|
87
|
+
- test/test_helper.rb
|
88
|
+
- test/view_helpers/facebook_helpers_test.rb
|