Permalink
Browse files

Update frankie for Sinatra 0.2.2, plus add ssh tunnel script to project

  • Loading branch information...
1 parent 695790c commit e6ca960c79c1a5a58a9aa637b713d6311569fb26 Ron Evans committed Apr 22, 2008
Showing with 25 additions and 10 deletions.
  1. +2 −0 CHANGELOG
  2. +2 −0 Manifest
  3. +12 −0 bin/tunnel
  4. +9 −10 lib/frankie.rb
View
@@ -1 +1,3 @@
+v0.2.2. Updated to deal with session change in Sinatra, plus misc bug fixes with Facebooker integration
+
v0.2.0. Converted codebase to become Ruby Gem
View
@@ -1,7 +1,9 @@
+bin/tunnel
CHANGELOG
lib/frankie.rb
LICENSE
Manifest
Rakefile
README.rdoc
test/frankie_test.rb
+test/helper.rb
View
@@ -0,0 +1,12 @@
+#!/usr/bin/env ruby
+
+host, remote_port, local_port = ARGV
+raise 'You must specify at least a hostname - i.e. tunnel myhost.com' unless host
+remote_port ||= 10000
+local_port ||= 4567
+puts "Tunneling #{host}:#{remote_port} to 0.0.0.0:#{local_port}"
+begin
+ exec "autossh -M 48484 -nNT -g -R *:#{remote_port}:0.0.0.0:#{local_port} #{host}"
+rescue
+ raise "Tunnel failed to start. Do you have autossh installed?"
+end
View
@@ -53,15 +53,15 @@ def facebook_params
private
def session_already_secured?
- (@facebook_session = session['facebook_session']) && session['facebook_session'].secured?
+ (@facebook_session = session[:facebook_session]) && session[:facebook_session].secured?
end
def secure_with_token!
if params['auth_token']
@facebook_session = new_facebook_session
@facebook_session.auth_token = params['auth_token']
@facebook_session.secure!
- session['facebook_session'] = @facebook_session
+ session[:facebook_session] = @facebook_session
end
end
@@ -76,9 +76,8 @@ def secure_with_facebook_params!
end
def create_new_facebook_session_and_redirect!
- s = new_facebook_session
- session['facebook_session'] = s
- throw :halt, do_redirect(session['facebook_session'].login_url) unless @installation_required
+ session[:facebook_session] = new_facebook_session
+ throw :halt, do_redirect(session[:facebook_session].login_url) unless @installation_required
end
def new_facebook_session
@@ -89,7 +88,7 @@ def capture_facebook_friends_if_available!
return unless request_is_for_a_facebook_canvas?
if friends = facebook_params['friends']
facebook_session.user.friends = friends.map do |friend_uid|
- User.new(friend_uid, facebook_session)
+ Facebooker::User.new(friend_uid, facebook_session)
end
end
end
@@ -139,7 +138,7 @@ def facebook_parameter_conversions
def do_redirect(*args)
if request_is_for_a_facebook_canvas?
- fbml_redirect_tag(args[0])
+ fbml_redirect_tag(args)
else
redirect args[0]
end
@@ -150,8 +149,8 @@ def fbml_redirect_tag(url)
end
def request_is_for_a_facebook_canvas?
- return false if !params["fb_sig_in_canvas"]
- !params["fb_sig_in_canvas"].blank?
+ return false if params["fb_sig_in_canvas"].nil?
+ params["fb_sig_in_canvas"] == "1"
end
def application_is_installed?
@@ -170,7 +169,7 @@ def ensure_application_is_installed_by_facebook_user
end
def application_is_not_installed_by_facebook_user
- throw :halt, do_redirect(session['facebook_session'].install_url)
+ throw :halt, do_redirect(session[:facebook_session].install_url)
end
def set_fbml_format

0 comments on commit e6ca960

Please sign in to comment.