authlogic_facebook_shim 0.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +76 -0
  3. data/Rakefile +39 -0
  4. data/VERSION +1 -0
  5. data/authlogic_facebook_shim.gemspec +30 -0
  6. data/init.rb +1 -0
  7. data/lib/authlogic_facebook_shim/acts_as_authentic.rb +20 -0
  8. data/lib/authlogic_facebook_shim/helper.rb +4 -0
  9. data/lib/authlogic_facebook_shim/session/adapter.rb +1 -0
  10. data/lib/authlogic_facebook_shim/session/adapters/koala_adapter.rb +35 -0
  11. data/lib/authlogic_facebook_shim/session/config.rb +82 -0
  12. data/lib/authlogic_facebook_shim/session/facebook.rb +72 -0
  13. data/lib/authlogic_facebook_shim/session.rb +12 -0
  14. data/lib/authlogic_facebook_shim.rb +15 -0
  15. data/rails/init.rb +1 -0
  16. data/test/rails_root/app/controllers/application_controller.rb +10 -0
  17. data/test/rails_root/app/helpers/application_helper.rb +3 -0
  18. data/test/rails_root/app/models/user.rb +7 -0
  19. data/test/rails_root/app/models/user_session.rb +7 -0
  20. data/test/rails_root/config/boot.rb +110 -0
  21. data/test/rails_root/config/database.yml +10 -0
  22. data/test/rails_root/config/environment.rb +31 -0
  23. data/test/rails_root/config/environments/development.rb +0 -0
  24. data/test/rails_root/config/environments/test.rb +0 -0
  25. data/test/rails_root/config/facebook.yml +7 -0
  26. data/test/rails_root/config/initializers/authlogic_facebook_koala.rb +5 -0
  27. data/test/rails_root/config/initializers/new_rails_defaults.rb +21 -0
  28. data/test/rails_root/config/initializers/session_store.rb +15 -0
  29. data/test/rails_root/config/locales/en.yml +5 -0
  30. data/test/rails_root/config/routes.rb +43 -0
  31. data/test/rails_root/db/migrate/20101217000008_create_users.rb +37 -0
  32. data/test/rails_root/db/seeds.rb +7 -0
  33. data/test/rails_root/log/test.log +159 -0
  34. data/test/rails_root/script/console +3 -0
  35. data/test/rails_root/script/dbconsole +3 -0
  36. data/test/rails_root/script/generate +3 -0
  37. data/test/test_helper.rb +43 -0
  38. data/test/units/session/adapter_test.rb +182 -0
  39. data/test/units/session/config_test.rb +145 -0
  40. data/test/units/session/facebook_test.rb +221 -0
  41. metadata +234 -0
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 James McCarthy
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,76 @@
1
+ = authlogic_facebook_shim
2
+
3
+ This is a plugin for integrating facebook sessions into authlogic.
4
+
5
+ This requires a config/facebook.yml file that looks like this:
6
+
7
+ development:
8
+ app_id: appid
9
+ api_key: apikey
10
+ secret_key: secretkey
11
+
12
+ production:
13
+ app_id: appid
14
+ api_key: apikey
15
+ secret_key: secretkey
16
+
17
+ If you don't have different facebook credentials for different environments you can set these in UserSession
18
+
19
+ facebook_app_id 'appid'
20
+ facebook_api_key 'apikey'
21
+ facebook_secret_key 'secretkey'
22
+
23
+ In your controller you probably have something like this;
24
+
25
+ def current_user_session
26
+ @current_user_session ||= AccountSession.find
27
+ end
28
+
29
+ def current_user
30
+ @current_user ||= current_user_session.try(:user)
31
+ end
32
+
33
+ def logged_in?
34
+ current_user && !current_user_session.stale?
35
+ end
36
+
37
+ To get hold of the facebook particulars you will need to add something like this;
38
+
39
+ def facebook_user
40
+ current_user_session.try(:facebook_user)
41
+ end
42
+
43
+ def facebook_user?
44
+ !facebook_user.nil?
45
+ end
46
+
47
+ def facebook_session?
48
+ current_user_session.try(:facebook_session?)
49
+ end
50
+
51
+ If you have conventional signin and want to ignore facebook for it you will need to do this in your user_sessions_controller;
52
+
53
+ def create
54
+ @account_session = AccountSession.new(params[:account_session])
55
+ @account_session.skip_facebook_authentication = true
56
+ if @account_session.save
57
+ redirect_to member_home_path
58
+ else
59
+ render :action => :new
60
+ end
61
+ end
62
+
63
+
64
+ == Note on Patches/Pull Requests
65
+
66
+ * Fork the project.
67
+ * Make your feature addition or bug fix.
68
+ * Add tests for it. This is important so I don't break it in a future version unintentionally.
69
+ * Commit, do not mess with rakefile, version, or history. (if you want to have
70
+ your own version, that is fine but bump version in a commit by itself I can
71
+ ignore when I pull)
72
+ * Send me a pull request. Bonus points for topic branches.
73
+
74
+ == Copyright
75
+
76
+ Copyright (c) 2010 James McCarthy. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,39 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'jeweler'
4
+ require 'rake/rdoctask'
5
+
6
+ Jeweler::Tasks.new
7
+
8
+ Rake::RDocTask.new do |rdoc|
9
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
10
+
11
+ rdoc.rdoc_dir = 'rdoc'
12
+ rdoc.title = "authlogic_facebook_shim #{version}"
13
+ rdoc.rdoc_files.include('README*')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ require 'rake/testtask'
18
+ Rake::TestTask.new(:test) do |test|
19
+ test.libs << 'test'
20
+ test.pattern = 'test/**/*_test.rb'
21
+ test.verbose = true
22
+ end
23
+
24
+ begin
25
+ require 'rcov/rcovtask'
26
+ Rcov::RcovTask.new do |test|
27
+ test.libs << 'test'
28
+ test.pattern = 'test/**/*_test.rb'
29
+ test.verbose = true
30
+ end
31
+ rescue LoadError
32
+ task :rcov do
33
+ abort "RCov is not available. In order to run rcov, you must: gem install rcov"
34
+ end
35
+ end
36
+
37
+ task :test => :check_dependencies
38
+
39
+ task :default => :test
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.3.0
@@ -0,0 +1,30 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = %q{authlogic_facebook_shim}
3
+ s.version = "0.3.2"
4
+
5
+ s.required_rubygems_version = Gem::Requirement.new(">=1.2.0") if s.respond_to? :required_rubygems_version=
6
+ s.authors = ["James McCarthy"]
7
+ s.date = %q{2010-05-27}
8
+ s.description = %q{Authlogic plugin to support Facebook OAuth2 javascript sessions. Currently requires koala but is easily extended for other facebook gems}
9
+ s.email = %q{james2mccarthy@gmail.com}
10
+ s.extra_rdoc_files = [
11
+ "LICENSE",
12
+ "README.rdoc"
13
+ ]
14
+ s.files = Dir.glob('**/*') - Dir.glob('authlogic_facebook_shim*.gem')
15
+ s.homepage = %q{http://github.com/james2m/authlogic_facebook_shim}
16
+ s.rdoc_options = ["--charset=UTF-8"]
17
+ s.require_paths = ["lib"]
18
+ s.rubygems_version = %q{1.3.5}
19
+ s.summary = %q{Authlogic plugin to support Facebook Javascript OAuth2 Sessions.}
20
+ s.test_files = Dir.glob('test/**/*')
21
+
22
+ s.add_runtime_dependency('authlogic', "~>2.1.3")
23
+ s.add_development_dependency('rails', '~>2.3.5')
24
+ s.add_development_dependency('flexmock')
25
+ s.add_development_dependency('jeweler')
26
+ s.add_development_dependency('shoulda')
27
+ s.add_development_dependency('sqlite3-ruby')
28
+ s.add_development_dependency('test-unit')
29
+ end
30
+
data/init.rb ADDED
@@ -0,0 +1 @@
1
+ require File.dirname(__FILE__) + "/rails/init.rb"
@@ -0,0 +1,20 @@
1
+ module AuthlogicFacebookShim
2
+ module ActsAsAuthentic
3
+ def self.included(klass)
4
+ klass.class_eval do
5
+ extend Config
6
+ add_acts_as_authentic_module(Methods, :prepend)
7
+ end
8
+ end
9
+
10
+ module Config
11
+ end
12
+
13
+ module Methods
14
+ def self.included(klass)
15
+ klass.class_eval do
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,4 @@
1
+ module AuthlogicFacebookShim
2
+ module Helper
3
+ end
4
+ end
@@ -0,0 +1 @@
1
+ require File.expand_path('adapters/koala_adapter', File.dirname(__FILE__)) if defined?(Koala)
@@ -0,0 +1,35 @@
1
+ module AuthlogicFacebookShim
2
+ module Session
3
+ module Adapter
4
+
5
+ def facebook_session
6
+ @facebook_session ||= begin
7
+ if controller.cookies.has_key?("fbs_#{facebook_app_id}")
8
+ oauth = Koala::Facebook::OAuth.new(facebook_app_id, facebook_secret_key)
9
+ if oauth.respond_to?(:get_user_info_from_cookie)
10
+ user_info = oauth.get_user_info_from_cookie(controller.cookies)
11
+ else
12
+ user_info = oauth.get_user_from_cookie(controller.cookies)
13
+ end
14
+ OpenStruct.new( user_info )
15
+ end
16
+ end
17
+ end
18
+
19
+ def facebook_session?
20
+ !facebook_session.nil?
21
+ end
22
+
23
+ def facebook_user
24
+ @facebook_user ||= begin
25
+ facebook_graph = Koala::Facebook::GraphAPI.new(facebook_session.access_token)
26
+ user = facebook_graph.get_object('me')
27
+ user[:uid] = user.delete('id')
28
+ OpenStruct.new( user )
29
+ end if facebook_session?
30
+ end
31
+
32
+ end
33
+ end
34
+ end
35
+
@@ -0,0 +1,82 @@
1
+ module AuthlogicFacebookShim
2
+ module Session
3
+
4
+ module Config
5
+
6
+ def self.extended(klass)
7
+ (class << klass; self end).send(:define_method, :default_config) do
8
+ @default_config ||= begin
9
+ config_file = File.join(Rails.root, 'config', facebook_config_file)
10
+ OpenStruct.new(File.exist?(config_file) ? YAML.load_file(config_file)[Rails.env] : {})
11
+ end
12
+ end
13
+ end
14
+
15
+ # Specify your config file if using one. If not then you need to specify
16
+ # facebook_app_id, facebook_secret_key & facebook_api_key
17
+ #
18
+ # * <tt>Default:</tt> facebook.yml
19
+ # * <tt>Accepts:</tt> String
20
+ def facebook_config_file(value=nil)
21
+ rw_config(:facebook_config_file, value, 'facebook.yml')
22
+ end
23
+ alias_method :facebook_config_file=, :facebook_config_file
24
+
25
+ # Specify your app_id.
26
+ #
27
+ # * <tt>Default:</tt> app_id in config/facebook.yml
28
+ # * <tt>Accepts:</tt> String
29
+ def facebook_app_id(value=nil)
30
+ rw_config(:facebook_app_id, value, default_config.app_id)
31
+ end
32
+ alias_method :facebook_app_id=, :facebook_app_id
33
+
34
+ # Specify your secret_key.
35
+ #
36
+ # * <tt>Default:</tt> secret_key in config/facebook.yml
37
+ # * <tt>Accepts:</tt> String
38
+ def facebook_secret_key(value=nil)
39
+ rw_config(:facebook_secret_key, value, default_config.secret_key)
40
+ end
41
+ alias_method :facebook_secret_key=, :facebook_secret_key
42
+
43
+ # Specify your api_key.
44
+ #
45
+ # * <tt>Default:</tt> api_key in config/facebook.yml
46
+ # * <tt>Accepts:</tt> String
47
+ def facebook_api_key(value=nil)
48
+ rw_config(:facebook_api_key, value, default_config.api_key)
49
+ end
50
+ alias_method :facebook_api_key=, :facebook_api_key
51
+
52
+ # What user field should be used for the facebook UID?
53
+ #
54
+ # * <tt>Default:</tt> :facebook_uid
55
+ # * <tt>Accepts:</tt> Symbol
56
+ def facebook_uid_field(value=nil)
57
+ rw_config(:facebook_uid_field, value, :facebook_uid)
58
+ end
59
+ alias_method :facebook_uid_field=, :facebook_uid_field
60
+
61
+ # What method should be used to find the facebook account?
62
+ #
63
+ # * <tt>Default:</tt> :find_by_#{facebook_uid_field}
64
+ # * <tt>Accepts:</tt> Symbol or String
65
+ def facebook_finder(value=nil)
66
+ rw_config(:facebook_finder, value, nil)
67
+ end
68
+ alias_method :facebook_finder=, :facebook_finder
69
+
70
+ # Should a new user be automatically created if there is no user with
71
+ # given facebook uid?
72
+ #
73
+ # * <tt>Default:</tt> false
74
+ # * <tt>Accepts:</tt> Boolean
75
+ def facebook_auto_register(value=nil)
76
+ rw_config(:facebook_auto_register, value, false)
77
+ end
78
+ alias_method :facebook_auto_register=, :facebook_auto_register
79
+ end
80
+
81
+ end
82
+ end
@@ -0,0 +1,72 @@
1
+ module AuthlogicFacebookShim
2
+ module Session
3
+
4
+ module Facebook
5
+
6
+ def self.included(klass)
7
+
8
+ klass.class_eval do
9
+ attr_accessor :skip_facebook_authentication
10
+ validate :validate_by_facebook, :if => :authenticating_with_facebook?
11
+ end
12
+
13
+ end
14
+
15
+ def logged_in_with_facebook?
16
+ @logged_in_with_facebook
17
+ end
18
+
19
+ protected
20
+ # Override this if you want only some requests to use facebook
21
+ def authenticating_with_facebook?
22
+ !skip_facebook_authentication && !authenticating_with_unauthorized_record? && facebook_session?
23
+ end
24
+
25
+ private
26
+
27
+ def validate_by_facebook
28
+ facebook_uid = facebook_session.uid
29
+ self.attempted_record = klass.send(facebook_finder, facebook_uid)
30
+
31
+ if self.attempted_record || !facebook_auto_register?
32
+ return @logged_in_with_facebook = !!self.attempted_record
33
+ else
34
+ self.attempted_record = klass.new
35
+ self.attempted_record.send(:"#{facebook_uid_field}=", facebook_uid)
36
+ if self.attempted_record.respond_to?(:before_connect)
37
+ self.attempted_record.send(:before_connect, facebook_session)
38
+ end
39
+
40
+ @logged_in_with_facebook = true
41
+ return self.attempted_record.save(false)
42
+ end
43
+ end
44
+
45
+ def facebook_app_id
46
+ self.class.facebook_app_id
47
+ end
48
+
49
+ def facebook_api_key
50
+ self.class.facebook_api_key
51
+ end
52
+
53
+ def facebook_secret_key
54
+ self.class.facebook_secret_key
55
+ end
56
+
57
+ def facebook_auto_register?
58
+ self.class.facebook_auto_register
59
+ end
60
+
61
+ def facebook_uid_field
62
+ self.class.facebook_uid_field
63
+ end
64
+
65
+ def facebook_finder
66
+ self.class.facebook_finder || "find_by_#{facebook_uid_field}"
67
+ end
68
+
69
+ end
70
+
71
+ end
72
+ end
@@ -0,0 +1,12 @@
1
+ module AuthlogicFacebookShim
2
+ module Session
3
+
4
+ def self.included(klass)
5
+ klass.extend Session::Config
6
+ klass.send(:include, Session::Adapter)
7
+ klass.send(:include, Session::Facebook)
8
+ end
9
+
10
+ end
11
+ end
12
+
@@ -0,0 +1,15 @@
1
+ require 'yaml'
2
+ require 'ostruct'
3
+ require 'singleton'
4
+
5
+
6
+ if ActiveRecord::Base.respond_to?(:add_acts_as_authentic_module)
7
+ require 'authlogic_facebook_shim/acts_as_authentic'
8
+ require 'authlogic_facebook_shim/session/config'
9
+ require 'authlogic_facebook_shim/session/adapter'
10
+ require 'authlogic_facebook_shim/session/facebook'
11
+ require 'authlogic_facebook_shim/session'
12
+ require 'authlogic_facebook_shim/helper'
13
+ Authlogic::Session::Base.send :include, AuthlogicFacebookShim::Session
14
+ ActiveRecord::Base.send :include, AuthlogicFacebookShim::ActsAsAuthentic
15
+ end
data/rails/init.rb ADDED
@@ -0,0 +1 @@
1
+ require 'authlogic_facebook_shim'
@@ -0,0 +1,10 @@
1
+ # Filters added to this controller apply to all controllers in the application.
2
+ # Likewise, all the methods added will be available for all controllers.
3
+
4
+ class ApplicationController < ActionController::Base
5
+ helper :all # include all helpers, all the time
6
+ protect_from_forgery # See ActionController::RequestForgeryProtection for details
7
+
8
+ # Scrub sensitive parameters from your log
9
+ # filter_parameter_logging :password
10
+ end
@@ -0,0 +1,3 @@
1
+ # Methods added to this helper will be available to all templates in the application.
2
+ module ApplicationHelper
3
+ end
@@ -0,0 +1,7 @@
1
+ class User < ActiveRecord::Base
2
+ acts_as_authentic
3
+
4
+ def before_connect(facebook_session)
5
+ true
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ class UserSession < Authlogic::Session::Base
2
+
3
+ facebook_app_id '233423200151'
4
+ facebook_api_key 'f4fdb590052b81c3d73c5d2aa5908308'
5
+ facebook_secret_key '8371c9fc95a7d0a3d9cdb6bbacfea306'
6
+
7
+ end
@@ -0,0 +1,110 @@
1
+ # Don't change this file!
2
+ # Configure your app in config/environment.rb and config/environments/*.rb
3
+
4
+ RAILS_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?(RAILS_ROOT)
5
+
6
+ module Rails
7
+ class << self
8
+ def boot!
9
+ unless booted?
10
+ preinitialize
11
+ pick_boot.run
12
+ end
13
+ end
14
+
15
+ def booted?
16
+ defined? Rails::Initializer
17
+ end
18
+
19
+ def pick_boot
20
+ (vendor_rails? ? VendorBoot : GemBoot).new
21
+ end
22
+
23
+ def vendor_rails?
24
+ File.exist?("#{RAILS_ROOT}/vendor/rails")
25
+ end
26
+
27
+ def preinitialize
28
+ load(preinitializer_path) if File.exist?(preinitializer_path)
29
+ end
30
+
31
+ def preinitializer_path
32
+ "#{RAILS_ROOT}/config/preinitializer.rb"
33
+ end
34
+ end
35
+
36
+ class Boot
37
+ def run
38
+ load_initializer
39
+ Rails::Initializer.run(:set_load_path)
40
+ end
41
+ end
42
+
43
+ class VendorBoot < Boot
44
+ def load_initializer
45
+ require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
46
+ Rails::Initializer.run(:install_gem_spec_stubs)
47
+ Rails::GemDependency.add_frozen_gem_path
48
+ end
49
+ end
50
+
51
+ class GemBoot < Boot
52
+ def load_initializer
53
+ self.class.load_rubygems
54
+ load_rails_gem
55
+ require 'initializer'
56
+ end
57
+
58
+ def load_rails_gem
59
+ if version = self.class.gem_version
60
+ gem 'rails', version
61
+ else
62
+ gem 'rails'
63
+ end
64
+ rescue Gem::LoadError => load_error
65
+ $stderr.puts %(Missing the Rails #{version} gem. Please `gem install -v=#{version} rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.)
66
+ exit 1
67
+ end
68
+
69
+ class << self
70
+ def rubygems_version
71
+ Gem::RubyGemsVersion rescue nil
72
+ end
73
+
74
+ def gem_version
75
+ if defined? RAILS_GEM_VERSION
76
+ RAILS_GEM_VERSION
77
+ elsif ENV.include?('RAILS_GEM_VERSION')
78
+ ENV['RAILS_GEM_VERSION']
79
+ else
80
+ parse_gem_version(read_environment_rb)
81
+ end
82
+ end
83
+
84
+ def load_rubygems
85
+ min_version = '1.3.2'
86
+ require 'rubygems'
87
+ unless rubygems_version >= min_version
88
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version} (you have #{rubygems_version}). Please `gem update --system` and try again.)
89
+ exit 1
90
+ end
91
+
92
+ rescue LoadError
93
+ $stderr.puts %Q(Rails requires RubyGems >= #{min_version}. Please install RubyGems and try again: http://rubygems.rubyforge.org)
94
+ exit 1
95
+ end
96
+
97
+ def parse_gem_version(text)
98
+ $1 if text =~ /^[^#]*RAILS_GEM_VERSION\s*=\s*["']([!~<>=]*\s*[\d.]+)["']/
99
+ end
100
+
101
+ private
102
+ def read_environment_rb
103
+ File.read("#{RAILS_ROOT}/config/environment.rb")
104
+ end
105
+ end
106
+ end
107
+ end
108
+
109
+ # All that for this:
110
+ Rails.boot!
@@ -0,0 +1,10 @@
1
+ development:
2
+ :adapter: sqlite3
3
+ :database: ":memory:"
4
+ pool: 5
5
+ timeout: 5000
6
+ test:
7
+ :adapter: sqlite3
8
+ :database: ":memory:"
9
+ pool: 5
10
+ timeout: 5000
@@ -0,0 +1,31 @@
1
+ RAILS_GEM_VERSION = '2.3.5' unless defined? RAILS_GEM_VERSION
2
+
3
+ # Bootstrap the Rails environment, frameworks, and default configuration
4
+ require File.join(File.dirname(__FILE__), 'boot')
5
+
6
+ Rails::Initializer.run do |config|
7
+ # config.load_paths += %W( #{RAILS_ROOT}/extras )
8
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
9
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
10
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
11
+ # config.i18n.default_locale = :de
12
+ # config.active_record.schema_format = :sql
13
+
14
+ config.gem "authlogic"
15
+ config.gem 'flexmock'
16
+ config.gem "koala"
17
+ config.gem "shoulda"
18
+ config.gem "test-unit", :lib => "test/unit"
19
+
20
+ config.frameworks -= [ :active_resource, :action_mailer ]
21
+ config.log_level = :debug
22
+ config.cache_classes = false
23
+ config.whiny_nils = true
24
+ config.action_controller.consider_all_requests_local = true
25
+ config.action_controller.perform_caching = false
26
+ config.action_view.cache_template_loading = true
27
+ config.action_controller.allow_forgery_protection = false
28
+ config.action_mailer.delivery_method = :test
29
+ config.time_zone = 'UTC'
30
+
31
+ end
File without changes
@@ -0,0 +1,7 @@
1
+ test:
2
+ app_id: appidfromfile
3
+ api_key: apikeyfromfile
4
+ secret_key: secretkeyfromfile
5
+ canvas_page_name: facebook_koala
6
+ callback_url: http://example.com/
7
+
@@ -0,0 +1,5 @@
1
+ afk_path = File.join(File.dirname(__FILE__), *%w(.. .. .. ..))
2
+ afk_lib_path = File.join(afk_path, "lib")
3
+
4
+ $LOAD_PATH.unshift(afk_lib_path)
5
+ load File.join(afk_path, "init.rb")
@@ -0,0 +1,21 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # These settings change the behavior of Rails 2 apps and will be defaults
4
+ # for Rails 3. You can remove this initializer when Rails 3 is released.
5
+
6
+ if defined?(ActiveRecord)
7
+ # Include Active Record class name as root for JSON serialized output.
8
+ ActiveRecord::Base.include_root_in_json = true
9
+
10
+ # Store the full class name (including module namespace) in STI type column.
11
+ ActiveRecord::Base.store_full_sti_class = true
12
+ end
13
+
14
+ ActionController::Routing.generate_best_match = false
15
+
16
+ # Use ISO 8601 format for JSON serialized times and dates.
17
+ ActiveSupport.use_standard_json_time_format = true
18
+
19
+ # Don't escape HTML entities in JSON, leave that for the #json_escape helper.
20
+ # if you're including raw json in an HTML page.
21
+ ActiveSupport.escape_html_entities_in_json = false
@@ -0,0 +1,15 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying cookie session data integrity.
4
+ # If you change this key, all old sessions will become invalid!
5
+ # Make sure the secret is at least 30 characters and all random,
6
+ # no regular words or you'll be exposed to dictionary attacks.
7
+ ActionController::Base.session = {
8
+ :key => '_rails_root_session',
9
+ :secret => '4deb5b6e05377d982fa6ef37582c0be6de39e1473cc99a4a0f32fd61ec735cd9e86276b2c25fc781e7df8cd6afdc819208f7f497a755e217bff75728d05f543b'
10
+ }
11
+
12
+ # Use the database for sessions instead of the cookie-based default,
13
+ # which shouldn't be used to store highly confidential information
14
+ # (create the session table with "rake db:sessions:create")
15
+ # ActionController::Base.session_store = :active_record_store