authlogic_facebook_shim 0.3.3 → 0.5.0

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 (59) hide show
  1. data/Gemfile +4 -0
  2. data/Gemfile.lock +113 -0
  3. data/README.rdoc +8 -1
  4. data/Rakefile +39 -20
  5. data/authlogic_facebook_shim.gemspec +22 -19
  6. data/lib/authlogic_facebook_shim/adapters/koala_adapter.rb +12 -9
  7. data/lib/authlogic_facebook_shim/railtie.rb +19 -0
  8. data/lib/authlogic_facebook_shim/session/adapter.rb +23 -0
  9. data/lib/authlogic_facebook_shim/session/config.rb +1 -1
  10. data/lib/authlogic_facebook_shim/session/facebook.rb +3 -4
  11. data/lib/authlogic_facebook_shim/session.rb +4 -0
  12. data/lib/authlogic_facebook_shim/version.rb +3 -0
  13. data/lib/authlogic_facebook_shim.rb +6 -9
  14. data/test/dummy/app/controllers/application_controller.rb +3 -0
  15. data/test/dummy/app/helpers/application_helper.rb +2 -0
  16. data/test/{rails_root → dummy}/app/models/user.rb +1 -0
  17. data/test/{rails_root → dummy}/app/models/user_session.rb +0 -0
  18. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  19. data/test/dummy/config/application.rb +49 -0
  20. data/test/dummy/config/boot.rb +10 -0
  21. data/test/dummy/config/database.yml +6 -0
  22. data/test/dummy/config/environment.rb +5 -0
  23. data/test/dummy/config/environments/development.rb +27 -0
  24. data/test/dummy/config/environments/test.rb +37 -0
  25. data/test/{rails_root → dummy}/config/facebook.yml +0 -0
  26. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  27. data/test/dummy/config/initializers/inflections.rb +10 -0
  28. data/test/dummy/config/initializers/mime_types.rb +5 -0
  29. data/test/dummy/config/initializers/secret_token.rb +7 -0
  30. data/test/dummy/config/initializers/session_store.rb +8 -0
  31. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  32. data/test/dummy/config/locales/en.yml +5 -0
  33. data/test/dummy/config/routes.rb +2 -0
  34. data/test/dummy/config.ru +4 -0
  35. data/test/{rails_root → dummy}/db/migrate/20101217000008_create_users.rb +0 -0
  36. data/test/{rails_root → dummy}/db/seeds.rb +0 -0
  37. data/test/dummy/log/test.log +1386 -0
  38. data/test/test_helper.rb +20 -20
  39. data/test/units/adapters/koala_adapter_test.rb +202 -146
  40. data/test/units/session/config_test.rb +110 -108
  41. data/test/units/session/facebook_test.rb +175 -156
  42. metadata +123 -155
  43. data/VERSION +0 -1
  44. data/test/rails_root/app/controllers/application_controller.rb +0 -10
  45. data/test/rails_root/app/helpers/application_helper.rb +0 -3
  46. data/test/rails_root/config/boot.rb +0 -110
  47. data/test/rails_root/config/database.yml +0 -10
  48. data/test/rails_root/config/environment.rb +0 -31
  49. data/test/rails_root/config/environments/development.rb +0 -0
  50. data/test/rails_root/config/environments/test.rb +0 -0
  51. data/test/rails_root/config/initializers/authlogic_facebook_koala.rb +0 -5
  52. data/test/rails_root/config/initializers/new_rails_defaults.rb +0 -21
  53. data/test/rails_root/config/initializers/session_store.rb +0 -15
  54. data/test/rails_root/config/locales/en.yml +0 -5
  55. data/test/rails_root/config/routes.rb +0 -43
  56. data/test/rails_root/log/test.log +0 -1137
  57. data/test/rails_root/script/console +0 -3
  58. data/test/rails_root/script/dbconsole +0 -3
  59. data/test/rails_root/script/generate +0 -3
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in canard.gemspec
4
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,113 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ authlogic_facebook_shim (0.4.0)
5
+ authlogic (~> 3.0)
6
+
7
+ GEM
8
+ remote: http://rubygems.org/
9
+ specs:
10
+ actionmailer (3.1.3)
11
+ actionpack (= 3.1.3)
12
+ mail (~> 2.3.0)
13
+ actionpack (3.1.3)
14
+ activemodel (= 3.1.3)
15
+ activesupport (= 3.1.3)
16
+ builder (~> 3.0.0)
17
+ erubis (~> 2.7.0)
18
+ i18n (~> 0.6)
19
+ rack (~> 1.3.5)
20
+ rack-cache (~> 1.1)
21
+ rack-mount (~> 0.8.2)
22
+ rack-test (~> 0.6.1)
23
+ sprockets (~> 2.0.3)
24
+ activemodel (3.1.3)
25
+ activesupport (= 3.1.3)
26
+ builder (~> 3.0.0)
27
+ i18n (~> 0.6)
28
+ activerecord (3.1.3)
29
+ activemodel (= 3.1.3)
30
+ activesupport (= 3.1.3)
31
+ arel (~> 2.2.1)
32
+ tzinfo (~> 0.3.29)
33
+ activeresource (3.1.3)
34
+ activemodel (= 3.1.3)
35
+ activesupport (= 3.1.3)
36
+ activesupport (3.1.3)
37
+ multi_json (~> 1.0)
38
+ addressable (2.2.6)
39
+ arel (2.2.1)
40
+ authlogic (3.0.3)
41
+ activerecord (>= 3.0.7)
42
+ activerecord (>= 3.0.7)
43
+ builder (3.0.0)
44
+ erubis (2.7.0)
45
+ faraday (0.7.5)
46
+ addressable (~> 2.2.6)
47
+ multipart-post (~> 1.1.3)
48
+ rack (>= 1.1.0, < 2)
49
+ hike (1.2.1)
50
+ i18n (0.6.0)
51
+ json (1.6.1)
52
+ koala (1.2.1)
53
+ faraday (~> 0.7.0)
54
+ multi_json (~> 1.0)
55
+ mail (2.3.0)
56
+ i18n (>= 0.4.0)
57
+ mime-types (~> 1.16)
58
+ treetop (~> 1.4.8)
59
+ mime-types (1.17.2)
60
+ minitest (2.8.1)
61
+ multi_json (1.0.3)
62
+ multipart-post (1.1.4)
63
+ override (0.0.10)
64
+ polyglot (0.3.3)
65
+ rack (1.3.5)
66
+ rack-cache (1.1)
67
+ rack (>= 0.4)
68
+ rack-mount (0.8.3)
69
+ rack (>= 1.0.0)
70
+ rack-ssl (1.3.2)
71
+ rack
72
+ rack-test (0.6.1)
73
+ rack (>= 1.0)
74
+ rails (3.1.3)
75
+ actionmailer (= 3.1.3)
76
+ actionpack (= 3.1.3)
77
+ activerecord (= 3.1.3)
78
+ activeresource (= 3.1.3)
79
+ activesupport (= 3.1.3)
80
+ bundler (~> 1.0)
81
+ railties (= 3.1.3)
82
+ railties (3.1.3)
83
+ actionpack (= 3.1.3)
84
+ activesupport (= 3.1.3)
85
+ rack-ssl (~> 1.3.2)
86
+ rake (>= 0.8.7)
87
+ rdoc (~> 3.4)
88
+ thor (~> 0.14.6)
89
+ rake (0.9.2.2)
90
+ rdoc (3.11)
91
+ json (~> 1.4)
92
+ sprockets (2.0.3)
93
+ hike (~> 1.2)
94
+ rack (~> 1.0)
95
+ tilt (!= 1.3.0, ~> 1.1)
96
+ sqlite3 (1.3.4)
97
+ thor (0.14.6)
98
+ tilt (1.3.3)
99
+ treetop (1.4.10)
100
+ polyglot
101
+ polyglot (>= 0.3.1)
102
+ tzinfo (0.3.31)
103
+
104
+ PLATFORMS
105
+ ruby
106
+
107
+ DEPENDENCIES
108
+ authlogic_facebook_shim!
109
+ koala
110
+ minitest (~> 2)
111
+ override
112
+ rails (~> 3.0)
113
+ sqlite3
data/README.rdoc CHANGED
@@ -1,6 +1,8 @@
1
1
  = authlogic_facebook_shim
2
2
 
3
- This is a plugin for integrating facebook sessions into authlogic.
3
+ This is a plugin for integrating facebook sessions into authlogic. It relies on using the Javascript SDK to
4
+ login to facebook. Currently the shim support koala (https://github.com/arsduo/koala) for access the graph API
5
+ but if you have a preferred library it is easy to add an adapter.
4
6
 
5
7
  This requires a config/facebook.yml file that looks like this:
6
8
 
@@ -48,6 +50,11 @@ To get hold of the facebook particulars you will need to add something like this
48
50
  current_user_session.try(:facebook_session?)
49
51
  end
50
52
 
53
+ == Adapters
54
+
55
+ Currently the only adapter in the shim is for koala (https://github.com/arsduo/koala) but if you have a preferred
56
+ wrapper for accessing the graph API please fork the project and add your own adapter (with tests) then send me a pull
57
+ request.
51
58
 
52
59
  == Note on Patches/Pull Requests
53
60
 
data/Rakefile CHANGED
@@ -1,34 +1,53 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'rake/rdoctask'
1
+ #!/usr/bin/env rake
2
+ begin
3
+ require 'bundler/setup'
4
+ rescue LoadError
5
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6
+ end
7
+ begin
8
+ require 'rdoc/task'
9
+ rescue LoadError
10
+ require 'rdoc/rdoc'
11
+ require 'rake/rdoctask'
12
+ RDoc::Task = Rake::RDocTask
13
+ end
4
14
 
5
- Rake::RDocTask.new do |rdoc|
15
+ desc 'Generate documentation for the authlogic_facebook_shim gem.'
16
+ RDoc::Task.new(:rdoc) do |rdoc|
6
17
  version = File.exist?('VERSION') ? File.read('VERSION') : ""
7
18
 
8
19
  rdoc.rdoc_dir = 'rdoc'
9
- rdoc.title = "authlogic_facebook_shim #{version}"
10
- rdoc.rdoc_files.include('README*')
11
- rdoc.rdoc_files.include('lib/**/*.rb')
20
+ rdoc.title = 'authlogic_facebook_shim #{version}'
21
+ rdoc.main = 'README.rdoc'
22
+ rdoc.options << '--line-numbers' << '--inline-source'
23
+ rdoc.rdoc_files.include('README.rdoc', 'lib/**/*.rb')
12
24
  end
13
25
 
26
+ Bundler::GemHelper.install_tasks
27
+
14
28
  require 'rake/testtask'
15
- Rake::TestTask.new(:test) do |test|
16
- test.libs << 'test'
17
- test.pattern = 'test/**/*_test.rb'
18
- test.verbose = true
29
+
30
+ desc 'Test the authlogic_facebook_shim gem.'
31
+ Rake::TestTask.new(:test) do |t|
32
+ t.libs << 'lib'
33
+ t.libs << 'test'
34
+ t.pattern = 'test/**/*_test.rb'
35
+ t.verbose = true
19
36
  end
20
37
 
21
- begin
22
- require 'rcov/rcovtask'
23
- Rcov::RcovTask.new do |test|
24
- test.libs << 'test'
25
- test.pattern = 'test/**/*_test.rb'
26
- test.verbose = true
38
+ namespace :rcov do
39
+
40
+ desc "Generate a coverage report in coverage/"
41
+ task :gen do
42
+ sh "rcov --output coverage test/*_test.rb --exclude 'gems/*'"
27
43
  end
28
- rescue LoadError
29
- task :rcov do
30
- abort "RCov is not available. In order to run rcov, you must: gem install rcov"
44
+
45
+ desc "Remove generated coverage files."
46
+ task :clobber do
47
+ sh "rm -rdf coverage"
31
48
  end
49
+
32
50
  end
33
51
 
52
+ desc 'Default: run unit tests.'
34
53
  task :default => :test
@@ -1,29 +1,32 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "authlogic_facebook_shim/version"
4
+
1
5
  Gem::Specification.new do |s|
2
- s.name = %q{authlogic_facebook_shim}
3
- s.version = "0.3.3"
6
+ s.name = %q{authlogic_facebook_shim}
7
+ s.version = AuthlogicFacebookShim::VERSION
4
8
 
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}
9
+ s.authors = ["James McCarthy"]
10
+ s.date = %q{2011-11-26}
11
+ s.description = %q{Authlogic extension to support Facebook OAuth2 javascript sessions. Currently requires koala but is easily extended for other facebook api wrappers.}
12
+ s.email = %q{james2mccarthy@gmail.com}
10
13
  s.extra_rdoc_files = [
11
14
  "LICENSE",
12
15
  "README.rdoc"
13
16
  ]
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.files = Dir.glob('**/*') - Dir.glob('authlogic_facebook_shim*.gem')
18
+ s.homepage = %q{http://github.com/james2m/authlogic_facebook_shim}
19
+ s.rdoc_options = ["--charset=UTF-8"]
17
20
  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
+ s.summary = %q{Authlogic extension to support Facebook Javascript OAuth2 Sessions.}
22
+ s.test_files = Dir.glob('test/**/*')
21
23
 
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('shoulda')
26
- s.add_development_dependency('sqlite3-ruby')
27
- s.add_development_dependency('test-unit')
24
+ s.add_runtime_dependency 'authlogic', '~>3.0'
25
+
26
+ s.add_development_dependency 'rails', '~>3.0'
27
+ s.add_development_dependency "minitest", '~>2'
28
+ s.add_development_dependency "override"
29
+ s.add_development_dependency 'sqlite3'
30
+ s.add_development_dependency 'koala'
28
31
  end
29
32
 
@@ -4,15 +4,15 @@ module AuthlogicFacebookShim
4
4
 
5
5
  def facebook_session
6
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 )
7
+
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)
15
13
  end
14
+ OpenStruct.new( user_info ) if user_info
15
+
16
16
  end
17
17
  end
18
18
 
@@ -22,10 +22,13 @@ module AuthlogicFacebookShim
22
22
 
23
23
  def facebook_user
24
24
  @facebook_user ||= begin
25
- facebook_graph = Koala::Facebook::GraphAPI.new(facebook_session.access_token)
25
+
26
+ graph_api = Koala::Facebook.const_defined?(:API) ? Koala::Facebook::API : Koala::Facebook::GraphAPI
27
+ facebook_graph = graph_api.new(facebook_session.access_token)
26
28
  user = facebook_graph.get_object('me')
27
29
  user[:uid] = user.delete('id')
28
30
  OpenStruct.new( user )
31
+
29
32
  end if facebook_session?
30
33
  end
31
34
 
@@ -0,0 +1,19 @@
1
+ require 'authlogic_facebook_shim'
2
+ require 'rails'
3
+
4
+ module AuthlogicFacebookShim
5
+ class Railtie < Rails::Railtie
6
+
7
+ initializer "authlogic_facebook_shim.active_record" do |app|
8
+ ActiveSupport.on_load :active_record do
9
+
10
+ if respond_to?(:add_acts_as_authentic_module)
11
+ Authlogic::Session::Base.send :include, AuthlogicFacebookShim::Session
12
+ include AuthlogicFacebookShim::ActsAsAuthentic
13
+ end
14
+
15
+ end
16
+ end
17
+
18
+ end
19
+ end
@@ -1,6 +1,29 @@
1
1
  module AuthlogicFacebookShim
2
2
  module Session
3
3
  module Adapter
4
+
5
+ # The adapter requires 3 methods;
6
+ #
7
+ # facebook_session should return an OpenStruct or similar object that returns the users
8
+ # uid and access_token when those methods are called.
9
+ #
10
+ # facebook_session? should just return true if there is a facebook session i.e. the
11
+ # facebook fbs_FACEBOOK_APP_ID cookie has been set.
12
+ #
13
+ # facebook_user should return an OpenStruct or similar object that returns the users
14
+ # properties by responding to methods of the same name. The one execption to this rule
15
+ # is the facebook property id is replaced with a property uid to aviod clashing with
16
+ # the Object#id method in Ruby.
17
+ #
18
+ # The Facebook user properties are documented here
19
+ # http://developers.facebook.com/docs/reference/api/user/
20
+
21
+
22
+ # The shim chooses which adapter to use by checking for a constant derived from the name
23
+ # of the adapter for example to load the koala_adapter the shim first checks for the
24
+ # existence of the Koala constant so you need to ensure you load Koala first. Likewise
25
+ # an adapter for Mogli needs to be called mogli_adapter.rb and Facebooker2 would be
26
+ # facebooker2_adapter.rb
4
27
  Dir[File.expand_path('../adapters/*.rb', File.dirname(__FILE__))].each do |adapter|
5
28
  class_name = File.basename(adapter).rpartition(/_adapter\.rb$/).shift.camelize
6
29
  if defined?(class_name)
@@ -63,7 +63,7 @@ module AuthlogicFacebookShim
63
63
  # * <tt>Default:</tt> :find_by_#{facebook_uid_field}
64
64
  # * <tt>Accepts:</tt> Symbol or String
65
65
  def facebook_finder(value=nil)
66
- rw_config(:facebook_finder, value, nil)
66
+ rw_config(:facebook_finder, value, false)
67
67
  end
68
68
  alias_method :facebook_finder=, :facebook_finder
69
69
 
@@ -19,15 +19,14 @@ module AuthlogicFacebookShim
19
19
  protected
20
20
  # Override this if you want only some requests to use facebook
21
21
  def authenticating_with_facebook?
22
- !skip_facebook_authentication && !authenticating_with_unauthorized_record? && facebook_session?
22
+ !skip_facebook_authentication && !authenticating_with_unauthorized_record? && attempted_record.nil? && facebook_session?
23
23
  end
24
24
 
25
25
  private
26
26
 
27
27
  def validate_by_facebook
28
- facebook_uid = facebook_session.uid
28
+ facebook_uid = facebook_user.uid
29
29
  self.attempted_record = klass.send(facebook_finder, facebook_uid)
30
-
31
30
  if self.attempted_record || !facebook_auto_register?
32
31
  return @logged_in_with_facebook = !!self.attempted_record
33
32
  else
@@ -38,7 +37,7 @@ module AuthlogicFacebookShim
38
37
  end
39
38
 
40
39
  @logged_in_with_facebook = true
41
- return self.attempted_record.save(false)
40
+ return self.attempted_record.save(:validate => false)
42
41
  end
43
42
  end
44
43
 
@@ -1,5 +1,9 @@
1
1
  module AuthlogicFacebookShim
2
2
  module Session
3
+
4
+ autoload :Config, 'authlogic_facebook_shim/session/config'
5
+ autoload :Adapter, 'authlogic_facebook_shim/session/adapter'
6
+ autoload :Facebook, 'authlogic_facebook_shim/session/facebook'
3
7
 
4
8
  def self.included(klass)
5
9
  klass.extend Session::Config
@@ -0,0 +1,3 @@
1
+ module AuthlogicFacebookShim
2
+ VERSION = "0.5.0"
3
+ end
@@ -1,14 +1,11 @@
1
+ require 'authlogic_facebook_shim/version'
1
2
  require 'yaml'
2
3
  require 'ostruct'
3
4
  require 'singleton'
4
5
 
5
- if ActiveRecord::Base.respond_to?(:add_acts_as_authentic_module)
6
- require 'authlogic_facebook_shim/acts_as_authentic'
7
- require 'authlogic_facebook_shim/session/config'
8
- require 'authlogic_facebook_shim/session/adapter'
9
- require 'authlogic_facebook_shim/session/facebook'
10
- require 'authlogic_facebook_shim/session'
11
-
12
- Authlogic::Session::Base.send :include, AuthlogicFacebookShim::Session
13
- ActiveRecord::Base.send :include, AuthlogicFacebookShim::ActsAsAuthentic
6
+ module AuthlogicFacebookShim
7
+ autoload :ActsAsAuthentic, 'authlogic_facebook_shim/acts_as_authentic'
8
+ autoload :Session, 'authlogic_facebook_shim/session'
14
9
  end
10
+
11
+ require 'authlogic_facebook_shim/railtie' if defined?(Rails) && Rails::VERSION::MAJOR >= 3
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -4,4 +4,5 @@ class User < ActiveRecord::Base
4
4
  def before_connect(facebook_session)
5
5
  true
6
6
  end
7
+
7
8
  end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,49 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require "active_record/railtie"
5
+ require "action_controller/railtie"
6
+ require "rails/test_unit/railtie"
7
+
8
+ Bundler.require
9
+ require 'authlogic'
10
+ require "authlogic_facebook_shim"
11
+
12
+ module Dummy
13
+ class Application < Rails::Application
14
+ # Settings in config/environments/* take precedence over those specified here.
15
+ # Application configuration should go into files in config/initializers
16
+ # -- all .rb files in that directory are automatically loaded.
17
+
18
+ # Custom directories with classes and modules you want to be autoloadable.
19
+ # config.autoload_paths += %W(#{config.root}/extras)
20
+
21
+ # Only load the plugins named here, in the order given (default is alphabetical).
22
+ # :all can be used as a placeholder for all plugins not explicitly named.
23
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
24
+
25
+ # Activate observers that should always be running.
26
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
27
+
28
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
29
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
30
+ # config.time_zone = 'Central Time (US & Canada)'
31
+
32
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
33
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
34
+ # config.i18n.default_locale = :de
35
+
36
+ # Configure the default encoding used in templates for Ruby 1.9.
37
+ config.encoding = "utf-8"
38
+
39
+ # Configure sensitive parameters which will be filtered from the log file.
40
+ config.filter_parameters += [:password]
41
+
42
+ # Enable the asset pipeline
43
+ config.assets.enabled = false
44
+
45
+ # Version of your assets, change this if you want to expire all your assets
46
+ config.assets.version = '1.0'
47
+ end
48
+ end
49
+
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ if File.exist?(gemfile)
5
+ ENV['BUNDLE_GEMFILE'] = gemfile
6
+ require 'bundler'
7
+ Bundler.setup
8
+ end
9
+
10
+ $:.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,6 @@
1
+ test:
2
+ adapter: sqlite3
3
+ database: ':memory:'
4
+ development:
5
+ adapter: sqlite3
6
+ database: ':memory:'
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ Dummy::Application.initialize!
@@ -0,0 +1,27 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # In the development environment your application's code is reloaded on
5
+ # every request. This slows down response time but is perfect for development
6
+ # since you don't have to restart the web server when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Log error messages when you accidentally call methods on nil.
10
+ config.whiny_nils = true
11
+
12
+ # Show full error reports and disable caching
13
+ config.consider_all_requests_local = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Print deprecation notices to the Rails logger
17
+ config.active_support.deprecation = :log
18
+
19
+ # Only use best-standards-support built into browsers
20
+ config.action_dispatch.best_standards_support = :builtin
21
+
22
+ # Do not compress assets
23
+ config.assets.compress = false
24
+
25
+ # Expands the lines which load the assets
26
+ config.assets.debug = false
27
+ end
@@ -0,0 +1,37 @@
1
+ Dummy::Application.configure do
2
+ # Settings specified here will take precedence over those in config/application.rb
3
+
4
+ # The test environment is used exclusively to run your application's
5
+ # test suite. You never need to work with it otherwise. Remember that
6
+ # your test database is "scratch space" for the test suite and is wiped
7
+ # and recreated between test runs. Don't rely on the data there!
8
+ config.cache_classes = true
9
+
10
+ # Configure static asset server for tests with Cache-Control for performance
11
+ config.serve_static_assets = false
12
+ config.static_cache_control = "public, max-age=3600"
13
+
14
+ # Log error messages when you accidentally call methods on nil
15
+ config.whiny_nils = true
16
+
17
+ # Show full error reports and disable caching
18
+ config.consider_all_requests_local = true
19
+ config.action_controller.perform_caching = false
20
+
21
+ # Raise exceptions instead of rendering exception templates
22
+ config.action_dispatch.show_exceptions = false
23
+
24
+ # Disable request forgery protection in test environment
25
+ config.action_controller.allow_forgery_protection = false
26
+
27
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
28
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
29
+ # like if you have constraints or database-specific column types
30
+ # config.active_record.schema_format = :sql
31
+
32
+ # Print deprecation notices to the stderr
33
+ config.active_support.deprecation = :stderr
34
+
35
+ # Allow pass debug_assets=true as a query parameter to load pages with unpackaged assets
36
+ config.assets.allow_debugging = false
37
+ end
File without changes
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
+ # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
+
6
+ # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
+ # Rails.backtrace_cleaner.remove_silencers!
@@ -0,0 +1,10 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new inflection rules using the following format
4
+ # (all these examples are active by default):
5
+ # ActiveSupport::Inflector.inflections do |inflect|
6
+ # inflect.plural /^(ox)$/i, '\1en'
7
+ # inflect.singular /^(ox)en/i, '\1'
8
+ # inflect.irregular 'person', 'people'
9
+ # inflect.uncountable %w( fish sheep )
10
+ # end
@@ -0,0 +1,5 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Add new mime types for use in respond_to blocks:
4
+ # Mime::Type.register "text/richtext", :rtf
5
+ # Mime::Type.register_alias "text/html", :iphone
@@ -0,0 +1,7 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ # Your secret key for verifying the integrity of signed cookies.
4
+ # If you change this key, all old signed cookies 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
+ Dummy::Application.config.secret_token = '5ab1866fc84187a8ef685a7e0b6e55d1a616a3b767d4398cc6455d891e3079d991f5769f1ff2054ccf5ad8861e51871b9e3ef3c08654ccfb64a6cb6106a84d9a'
@@ -0,0 +1,8 @@
1
+ # Be sure to restart your server when you modify this file.
2
+
3
+ Dummy::Application.config.session_store :cookie_store, key: '_dummy_session'
4
+
5
+ # Use the database for sessions instead of the cookie-based default,
6
+ # which shouldn't be used to store highly confidential information
7
+ # (create the session table with "rails generate session_migration")
8
+ # Dummy::Application.config.session_store :active_record_store