Permalink
Browse files

Removed facebook (again)

  • Loading branch information...
1 parent 254cd19 commit 40bbd4fd073d2ab25535fa8f8c7049bf039e0d61 Dean Radcliffe committed Oct 27, 2010
View
29 app/controllers/application_controller.rb
@@ -4,8 +4,6 @@
class ApplicationController < ActionController::Base
helper :all
- # helper_attr :current_fbuser #attr_accessor and helper_method
-
before_filter :extend_session_and_request
def extend_session_and_request
@@ -30,30 +28,7 @@ def player_over_http
return u && u.playing_as
end
- # if this request is coming from facebook- its been seen while testing match_controller_fb_spec
- # that sometimes facebook_session is nil in test mode. We'll extend the definition for now to
- # also allow for hacked-on fb_sig_user as well
- def is_facebook?
- return false unless defined? facebook_session
- !! ( facebook_session || params[:fb_sig_user] )
- end
-
- # # if accessed over facebook, the player referenced
- def player_in_facebook
- fb_id = nil
- if defined? facebook_session
- fb_id = facebook_session ? facebook_session.user.id : params[:fb_sig_user]
- end
- return unless fb_id
- fbuser = Fbuser.find_by_facebook_user_id(fb_id)
- return fbuser.playing_as if fbuser
- end
-
-
- #only use layout if not a facebook request - todo - standardize the 'is_facebook' test
- # layout proc{ |c| c.params[:fb_sig] ? false : 'application' }
-
- # the player this request is being processed for
+ # the player this request is being processed for - should be request.player but...
def current_player
p = request.player || player_over_http
request.player = p if p
@@ -65,7 +40,7 @@ def authorize
unless current_player
flash[:notice] = "Login is required in order to take this action."
session[:original_uri] = request.request_uri
- redirect_to is_facebook? ? register_url : login_url
+ redirect_to login_url
end
end
View
1 app/views/fbuser/index.html.erb
@@ -1 +0,0 @@
-This page must be requested from within <a href="http://apps.facebook.com/enpassant">Facebook</a>
View
8 app/views/match/show.fbml.erb
@@ -1,8 +0,0 @@
-<h1><%= "A Duel to the Death between #{match.white.name} and #{match.black.name}!" -%></h1>
-
-Hi. Welcome, <%= current_player.name %>.
-
-<!-- use facebook hybrid model to load our nice ajax page in iframe -->
-<fb:iframe src="<%= "http://enpassant.dyndns.org/match/#{match.id}/show.html" %>" width="750" height="750" style="border:0px">
-
-</fb:iframe>
View
5 config/deploy.rb
@@ -54,9 +54,6 @@
run "rm -f #{release_path}/config/environments/production.rb"
run "ln -s #{shared_path}/production.rb #{release_path}/config/environments/production.rb"
end
- task :remove_fb do
- run "rm -rf #{release_path}/vendor/plugins/facebooker"
- end
task :update_rev do
run "cp #{release_path}/REVISION #{release_path}/public/REVISION"
end
@@ -68,6 +65,6 @@
run "touch #{current_path}/tmp/restart.txt"
end
- after "deploy:update_code", "configure:db", "configure:env", "configure:remove_fb", "configure:update_rev"
+ after "deploy:update_code", "configure:db", "configure:env", "configure:update_rev"
end
View
37 config/facebooker.yml
@@ -1,37 +0,0 @@
-# The api key, secret key, and canvas page name are required to get started
-# Tunnel configuration is only needed if you are going to use the facebooker:tunnel Rake tasks
-# Your callback url in Facebook should be set to http://public_host:public_port
-
-development:
- api_key: 69cc9cf788a17cc7b55d29cb41c41bb3
- secret_key: 1db3ad4ff3a616db8912ac3bf7608fda
- canvas_page_name: enpassant
- #i notice that javascript_include_tag defaults uses this - not sure it should - hmm
- #callback_url: http://enpassant.dyndns.org:3000/
- tunnel:
- public_host_username: deanr
- public_host: enpassant.dyndns.org
- public_port: 3142
- local_port: 3000
-
-test:
- api_key: 69cc9cf788a17cc7b55d29cb41c41bb3
- secret_key: 1db3ad4ff3a616db8912ac3bf7608fda
- canvas_page_name: enpassant
- callback_url: http://enpassant.dyndns.org:3000/
- tunnel:
- public_host_username:
- public_host:
- public_port: 4007
- local_port: 3000
-
-production:
- api_key:
- secret_key:
- canvas_page_name:
- callback_url:
- tunnel:
- public_host_username:
- public_host:
- public_port: 4007
- local_port: 3000
View
8 config/routes.rb
@@ -2,9 +2,7 @@
# The priority is based upon order of creation: first created -> highest priority.
- # Default routes - facebook or not
- map.facebook_root '', :controller => "match", :conditions => {:canvas => true}
- map.root :controller => "authentication", :conditions => {:canvas => false}
+ map.root :controller => "authentication"
map.auth 'authentication/:action', :controller => 'authentication'
map.login 'authentication/login', :controller => 'authentication', :action => 'login'
@@ -21,10 +19,6 @@
match.resource :chat
end
-
- #sets controller courtesy of Sean
- map.resource :set, :member => {:change => :post}
-
# Install the default routes as the lowest priority.
map.connect ':controller/:id/:action'
map.connect ':controller/:id/:action.:format'
View
16 db/migrate/20090401060000_create_fbusers.rb
@@ -1,16 +0,0 @@
-class CreateFbusers < ActiveRecord::Migration
- def self.up
- create_table :fbusers do |t|
- t.integer :facebook_user_id, :null => false
- t.integer :playing_as
- t.timestamps
- end
-
- # this line is problematic when database is not supportive of bigint (ie sqlite)
- # execute("alter table fbusers modify facebook_user_id bigint")
- end
-
- def self.down
- drop_table :fbusers
- end
-end
View
7 db/schema.rb
@@ -19,13 +19,6 @@
t.datetime "updated_at"
end
- create_table "fbusers", :force => true do |t|
- t.integer "facebook_user_id", :null => false
- t.integer "playing_as"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
create_table "gameplays", :force => true do |t|
t.integer "player_id", :null => false
t.integer "match_id", :null => false
View
125 doc/functionality_verified_by_tests.txt
@@ -1,125 +0,0 @@
-(in C:/ChessOnRails/trunk)
-Note: this document should be regenerated periodically by running
- rake test:doc
-
-authentication_controller should:
- - login security question only
- - test user dean can login
- - user can login
- - user can logout
- - redirects to uri first requested after login
- - reject incorrect login
-
-fbuser_controller should:
- - can sniff facebook request test or actual
- - does not authenticate without facebook info
- - redirected to login to facebook when requested in TEST environment and unauthenticated
- - known fbuser can invoke register to set new name
- - unknown fbuser can invoke register to establish self with new name
- - newly registered user gets a match with me
-
-match_controller should:
- - redirected to match listing page when resigning match
- - white view of board when requested by white
- - black view of board when requested by black
- - requesting ended match yields result template
- - gets form for creating new match
- - creates new match opponent as black
- - gets match status
- - gets list of active matches
- - verifies showing a match renders the board
- - can undo last move if you made it
-
-move_controller should:
- - reject move made with one or more invalid coordinates
- - accepts and notates move via coordinates
- - errs if specified match not there or active
- - cant move when on match you dont own
- - reject move made with notation and one or more coordinates
- - reject move made without notation or coordinates
- - cant move when not your turn
- - game over when checkmating move posted
- - non ajax move posting redirects to match page
- - ajax move responds with rjs template to update status
- - invalid ajax move responds with error
- - can request move list for match
-
-gameplay should:
- - navigates from match listing to match
- - makes checkmating move
-
-board should:
- - new match gets an initial board
- - after one move board reflects move
- - knows a valid location and distinguishes between invalid one
- - pawn can advance one or two on first move
- - pawn can only advance one on successive moves
- - pawn diagonal captures possible accounting for ends
- - piece cannot move off edge of board
- - knight has more moves in the center
- - knows what side occupies a square
- - knows what piece is on a square
- - detects moved piece
- - castled short white king on g1
- - knows if side is in check
- - scholars mate capture with queen is checkmate
- - scholars mate capture with bishop not checkmate
- - pawn can capture en passant
- - pawn en passant not possible for single stepped opponent pawn
- - promotes automatically to queen on reaching opposing back rank
- - may promote to knight on reaching opposing back rank
- - considering a move is temporary
-
-fbuser should:
- - can update name after signing in
-
-match should:
- - 32 pieces on chess initial board
- - first player to move is player1
- - next to move alternates sides
- - knows what side player is on
- - knows whose turn it is
- - shows lineup
- - player can resign
-
-move should:
- - unstarted match has no moves
- - notates noncapturing knight move
- - pawn cannot move two initially if blocked
- - notates noncapturing pawn moves correctly
- - notates white kingside castle correctly
- - notates white queenside castle correctly
- - notates check if no intervening piece blocks check
- - does not notate check if intervening piece blocks check
- - allows move from notation only
- - allows move from notation only pawn version
- - detects attempt to move from incorrect notation
- - notates which knight moved to a square if ambiguous
- - can castle via notation
- - errs if unrecognized notation
- - errs if ambiguous move made by notation
- - errs if move leaves ones own king in check
-
-piece should:
- - recognize valid piece types
- - position composed of rank and file
- - has a notation for king and queen
- - has a notation for minor and rook
- - has a notation for pawn
- - rook has four lines of attack
- - bishop has four lines of attack
- - queen has eight lines of attack
- - kings knights pawns have no lines of attack
- - rook can move nowhere on initial board
- - image names abstract away irrelevant details
- - pawn may not promote to king
- - pawn may not promote unless on back rank
- - no piece other than pawn may promote
-
-player should:
- - can be created
- - stores name
- - reject registering duplicate player names
-
-user should:
-
View
6 doc/stats.txt
@@ -2,12 +2,12 @@
+----------------------+-------+-------+---------+---------+-----+-------+
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
-| Controllers | 160 | 105 | 5 | 16 | 3 | 4 |
+| Controllers | 135 | 92 | 5 | 14 | 2 | 4 |
| Helpers | 50 | 36 | 0 | 7 | 0 | 3 |
| Models | 965 | 670 | 18 | 93 | 5 | 5 |
| Libraries | 376 | 265 | 4 | 36 | 9 | 5 |
+----------------------+-------+-------+---------+---------+-----+-------+
-| Total | 1551 | 1076 | 27 | 152 | 5 | 5 |
+| Total | 1526 | 1063 | 27 | 150 | 5 | 5 |
+----------------------+-------+-------+---------+---------+-----+-------+
- Code LOC: 1076 Test LOC: 0 Code to Test Ratio: 1:0.0
+ Code LOC: 1063 Test LOC: 0 Code to Test Ratio: 1:0.0
View
26 test/fixtures/fbusers.yml
@@ -1,26 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-
-dean:
- facebook_user_id: 829567899
- playing_as: 1
-jack:
- facebook_user_id: 534926873
- playing_as: 6
-milan:
- facebook_user_id: 507422110
- playing_as: 7
-dustin:
- facebook_user_id: 651048525
- playing_as: 8
-jones:
- facebook_user_id: 732375919
- playing_as: 9
-paul_fb:
- facebook_user_id: 15508568
- playing_as: 10
-stephen:
- facebook_user_id: 2401181
- playing_as: 11
-maula:
- facebook_user_id: 77800072
- playing_as: 12

0 comments on commit 40bbd4f

Please sign in to comment.