xn_devise_ldap_authenticatable 0.8.5

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 (89) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +10 -0
  3. data/CHANGELOG.md +7 -0
  4. data/Gemfile +8 -0
  5. data/MIT-LICENSE +20 -0
  6. data/README.md +143 -0
  7. data/Rakefile +16 -0
  8. data/lib/devise_ldap_authenticatable.rb +49 -0
  9. data/lib/devise_ldap_authenticatable/exception.rb +6 -0
  10. data/lib/devise_ldap_authenticatable/ldap/adapter.rb +87 -0
  11. data/lib/devise_ldap_authenticatable/ldap/connection.rb +243 -0
  12. data/lib/devise_ldap_authenticatable/logger.rb +11 -0
  13. data/lib/devise_ldap_authenticatable/model.rb +120 -0
  14. data/lib/devise_ldap_authenticatable/strategy.rb +39 -0
  15. data/lib/devise_ldap_authenticatable/version.rb +3 -0
  16. data/lib/generators/devise_ldap_authenticatable/install_generator.rb +63 -0
  17. data/lib/generators/devise_ldap_authenticatable/templates/ldap.yml +55 -0
  18. data/spec/ldap/.gitignore +2 -0
  19. data/spec/ldap/base.ldif +73 -0
  20. data/spec/ldap/clear.ldif +26 -0
  21. data/spec/ldap/local.schema +6 -0
  22. data/spec/ldap/openldap-data/.gitignore +2 -0
  23. data/spec/ldap/openldap-data/run/.gitignore +2 -0
  24. data/spec/ldap/openldap-data/run/.gitkeep +0 -0
  25. data/spec/ldap/run-server +31 -0
  26. data/spec/ldap/server.pem +38 -0
  27. data/spec/ldap/slapd-test.conf.erb +107 -0
  28. data/spec/rails_app/Rakefile +7 -0
  29. data/spec/rails_app/app/controllers/application_controller.rb +7 -0
  30. data/spec/rails_app/app/controllers/posts_controller.rb +15 -0
  31. data/spec/rails_app/app/helpers/application_helper.rb +2 -0
  32. data/spec/rails_app/app/helpers/posts_helper.rb +2 -0
  33. data/spec/rails_app/app/models/post.rb +2 -0
  34. data/spec/rails_app/app/models/user.rb +7 -0
  35. data/spec/rails_app/app/views/layouts/application.html.erb +26 -0
  36. data/spec/rails_app/app/views/posts/index.html.erb +2 -0
  37. data/spec/rails_app/config.ru +4 -0
  38. data/spec/rails_app/config/application.rb +46 -0
  39. data/spec/rails_app/config/boot.rb +13 -0
  40. data/spec/rails_app/config/cucumber.yml +8 -0
  41. data/spec/rails_app/config/database.yml +25 -0
  42. data/spec/rails_app/config/environment.rb +5 -0
  43. data/spec/rails_app/config/environments/development.rb +21 -0
  44. data/spec/rails_app/config/environments/production.rb +46 -0
  45. data/spec/rails_app/config/environments/test.rb +34 -0
  46. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  47. data/spec/rails_app/config/initializers/devise.rb +247 -0
  48. data/spec/rails_app/config/initializers/inflections.rb +10 -0
  49. data/spec/rails_app/config/initializers/mime_types.rb +5 -0
  50. data/spec/rails_app/config/initializers/secret_token.rb +7 -0
  51. data/spec/rails_app/config/initializers/session_store.rb +8 -0
  52. data/spec/rails_app/config/ldap.yml +22 -0
  53. data/spec/rails_app/config/ldap_with_boolean_ssl.yml +22 -0
  54. data/spec/rails_app/config/ldap_with_erb.yml +23 -0
  55. data/spec/rails_app/config/ldap_with_uid.yml +18 -0
  56. data/spec/rails_app/config/locales/devise.en.yml +59 -0
  57. data/spec/rails_app/config/locales/en.yml +5 -0
  58. data/spec/rails_app/config/routes.rb +64 -0
  59. data/spec/rails_app/config/ssl_ldap.yml +21 -0
  60. data/spec/rails_app/config/ssl_ldap_with_erb.yml +23 -0
  61. data/spec/rails_app/config/ssl_ldap_with_uid.yml +18 -0
  62. data/spec/rails_app/db/migrate/20100708120448_devise_create_users.rb +40 -0
  63. data/spec/rails_app/db/schema.rb +35 -0
  64. data/spec/rails_app/features/manage_logins.feature +35 -0
  65. data/spec/rails_app/features/step_definitions/login_steps.rb +21 -0
  66. data/spec/rails_app/features/step_definitions/web_steps.rb +219 -0
  67. data/spec/rails_app/features/support/env.rb +58 -0
  68. data/spec/rails_app/features/support/paths.rb +38 -0
  69. data/spec/rails_app/lib/tasks/.gitkeep +0 -0
  70. data/spec/rails_app/lib/tasks/cucumber.rake +53 -0
  71. data/spec/rails_app/public/404.html +26 -0
  72. data/spec/rails_app/public/422.html +26 -0
  73. data/spec/rails_app/public/500.html +26 -0
  74. data/spec/rails_app/public/images/rails.png +0 -0
  75. data/spec/rails_app/public/javascripts/application.js +2 -0
  76. data/spec/rails_app/public/javascripts/controls.js +965 -0
  77. data/spec/rails_app/public/javascripts/dragdrop.js +974 -0
  78. data/spec/rails_app/public/javascripts/effects.js +1123 -0
  79. data/spec/rails_app/public/javascripts/prototype.js +4874 -0
  80. data/spec/rails_app/public/javascripts/rails.js +118 -0
  81. data/spec/rails_app/public/stylesheets/.gitkeep +0 -0
  82. data/spec/rails_app/script/cucumber +10 -0
  83. data/spec/rails_app/script/rails +6 -0
  84. data/spec/spec_helper.rb +55 -0
  85. data/spec/support/factories.rb +16 -0
  86. data/spec/unit/connection_spec.rb +14 -0
  87. data/spec/unit/user_spec.rb +331 -0
  88. data/xn_devise_ldap_authenticatable.gemspec +36 -0
  89. metadata +363 -0
@@ -0,0 +1,38 @@
1
+ -----BEGIN RSA PRIVATE KEY-----
2
+ MIICXQIBAAKBgQC/hxFetCTh++3sEwchxuscH5TID0Wj2S/heBjY6RuK5rPrAcUg
3
+ rA7jFEFilEQYpfGe3LIMBkr5pP4aR1NrLuvKZaHuBvRLwOcU7SbuFQ3FQLaJA3UK
4
+ E2IOH9wMg1BMcG1WbzB1nKc650omKo7KqOAIYFFVq3gzlDRUmHF6dCAnvwIDAQAB
5
+ AoGAcOBJfGbu1cCEF/2e1mlFZu214bIeeNInRdphynSXpuUQZBBG/Vpp66qkXlTD
6
+ TUN/gwDObgfHaBm1KAehQioFC9ys1Iymlt8IeRYXH9Tkl7URe30QGAGjdIPohWpZ
7
+ xl/aMrpQVvQukaStRNoJXA32j+tuR2KbxAK6bu9iLzXvCQECQQD6AOzHVDB06ZjF
8
+ iJYB1/CyZBg0Q2aIOwGXwle1t1O7q6nJ6UWkurQF/inBdJdE5SWNEzYsI1tEP0n2
9
+ 1ZBIWQxtAkEAxB8WgFjRqYdmUYGQ1k8yxMUTLbZFd6t2UZyB/LAw9CtjH9lrU0z9
10
+ 81UK/ywVHkoDDPHbFyvd1jludqbz+suRWwJBAPEL9UCXfwUquf8zm5b5cv09n0y8
11
+ 895ELlv5qQHvWg+oC1Q/08NptOvWTMJXPQbTfepQ7LmP+Y6LCzCwZ6YqHd0CQFiW
12
+ flB9Tj9YhNQ+RVE4twMAzhfw5FIY5joZCvI8F/DDBGRnjj4zYeafPHdkzyk+X0Bi
13
+ owdFblAM4yO/aCeZ+k8CQQDdBi+WnpaaSL0NXmAb6+7aQRZ/Gc2O9S2JL/Fxw4EQ
14
+ i7KTRdH/d6Db9SeQEc/uCbJW7fM4KbZcjFdncHFytakt
15
+ -----END RSA PRIVATE KEY-----
16
+ -----BEGIN CERTIFICATE-----
17
+ MIIDwjCCAyugAwIBAgIJAP+plC/uCHKkMA0GCSqGSIb3DQEBBQUAMIGdMQswCQYD
18
+ VQQGEwJVUzERMA8GA1UECBMIVmlyZ2luaWExEzARBgNVBAcTCkFsZXhhbmRyaWEx
19
+ DTALBgNVBAoTBFRlc3QxDTALBgNVBAsTBFRlc3QxJDAiBgNVBAMUG2RldmlzZV9s
20
+ ZGFwX2F1dGhlbnRpY2F0YWJsZTEiMCAGCSqGSIb3DQEJARYTZHBtY25ldmluQGdt
21
+ YWlsLmNvbTAeFw0xMDA4MDUyMTU1MDVaFw0xMTA4MDUyMTU1MDVaMIGdMQswCQYD
22
+ VQQGEwJVUzERMA8GA1UECBMIVmlyZ2luaWExEzARBgNVBAcTCkFsZXhhbmRyaWEx
23
+ DTALBgNVBAoTBFRlc3QxDTALBgNVBAsTBFRlc3QxJDAiBgNVBAMUG2RldmlzZV9s
24
+ ZGFwX2F1dGhlbnRpY2F0YWJsZTEiMCAGCSqGSIb3DQEJARYTZHBtY25ldmluQGdt
25
+ YWlsLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAv4cRXrQk4fvt7BMH
26
+ IcbrHB+UyA9Fo9kv4XgY2Okbiuaz6wHFIKwO4xRBYpREGKXxntyyDAZK+aT+GkdT
27
+ ay7rymWh7gb0S8DnFO0m7hUNxUC2iQN1ChNiDh/cDINQTHBtVm8wdZynOudKJiqO
28
+ yqjgCGBRVat4M5Q0VJhxenQgJ78CAwEAAaOCAQYwggECMB0GA1UdDgQWBBRcCNxq
29
+ 0PNXgMfYN2RQ2uIrBY03ADCB0gYDVR0jBIHKMIHHgBRcCNxq0PNXgMfYN2RQ2uIr
30
+ BY03AKGBo6SBoDCBnTELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZpcmdpbmlhMRMw
31
+ EQYDVQQHEwpBbGV4YW5kcmlhMQ0wCwYDVQQKEwRUZXN0MQ0wCwYDVQQLEwRUZXN0
32
+ MSQwIgYDVQQDFBtkZXZpc2VfbGRhcF9hdXRoZW50aWNhdGFibGUxIjAgBgkqhkiG
33
+ 9w0BCQEWE2RwbWNuZXZpbkBnbWFpbC5jb22CCQD/qZQv7ghypDAMBgNVHRMEBTAD
34
+ AQH/MA0GCSqGSIb3DQEBBQUAA4GBABjztpAgr6QxVCNxhgklrILH+RLxww3dgdra
35
+ J6C6pXl9lbM+XIWiUtzD3Y8z2+tkJtjWCCN7peM2OYFvdChIvRz8XoxHqNB9W8wj
36
+ xZOqBHN8MdI1g6PCD5Z8lK1TDvchTeskqCulE6tMHKaslByhfZS94uWY+NG5JY/Z
37
+ traWmtWh
38
+ -----END CERTIFICATE-----
@@ -0,0 +1,107 @@
1
+ #
2
+ # See slapd.conf(5) for details on configuration options.
3
+ # This file should NOT be world readable.
4
+ #
5
+ <% ldapdir = RUBY_PLATFORM.match(/linux/) ? 'ldap' : 'openldap' %>
6
+ include /etc/<%= ldapdir %>/schema/core.schema
7
+ include /etc/<%= ldapdir %>/schema/cosine.schema
8
+ include /etc/<%= ldapdir %>/schema/inetorgperson.schema
9
+ include /etc/<%= ldapdir %>/schema/nis.schema
10
+
11
+ ## Local definitions
12
+ # include /etc/<%= ldapdir %>/schema/local.schema
13
+ include <%= File.expand_path('local.schema', @conf_root) %>
14
+
15
+ # Allow LDAPv2 client connections. This is NOT the default.
16
+ allow bind_v2
17
+
18
+ # Do not enable referrals until AFTER you have a working directory
19
+ # service AND an understanding of referrals.
20
+ #referral ldap://root.openldap.org
21
+
22
+ pidfile <%= File.expand_path('openldap-data/run/slapd.pid', @conf_root) %>
23
+ argsfile <%= File.expand_path('openldap-data/run/slapd.args', @conf_root) %>
24
+
25
+ # Load dynamic backend modules:
26
+ modulepath /usr/lib/openldap
27
+
28
+ # modules available in openldap-servers-overlays RPM package:
29
+ # moduleload accesslog.la
30
+ # moduleload auditlog.la
31
+ # moduleload denyop.la
32
+ # moduleload dyngroup.la
33
+ # moduleload dynlist.la
34
+ # moduleload lastmod.la
35
+ # moduleload pcache.la
36
+ # moduleload ppolicy.la
37
+ # moduleload refint.la
38
+ # moduleload retcode.la
39
+ # moduleload rwm.la
40
+ # moduleload smbk5pwd.la
41
+ # moduleload syncprov.la
42
+ # moduleload translucent.la
43
+ # moduleload unique.la
44
+ # moduleload valsort.la
45
+
46
+ # modules available in openldap-servers-sql RPM package:
47
+ # moduleload back_sql.la
48
+
49
+ # The next three lines allow use of TLS for encrypting connections using a
50
+ # dummy test certificate which you can generate by changing to
51
+ # /etc/pki/tls/certs, running "make slapd.pem", and fixing permissions on
52
+ # slapd.pem so that the ldap user or group can read it. Your client software
53
+ # may balk at self-signed certificates, however.
54
+
55
+ # ## For LDAPS
56
+ <% if @ssl %>
57
+ TLSCACertificateFile <%= File.expand_path('server.pem', @conf_root) %>
58
+ TLSCertificateFile <%= File.expand_path('server.pem', @conf_root) %>
59
+ TLSCertificateKeyFile <%= File.expand_path('server.pem', @conf_root) %>
60
+ <% else %>
61
+ # TLSCACertificateFile server.pem
62
+ # TLSCertificateFile server.pem
63
+ # TLSCertificateKeyFile server.pem
64
+ <% end %>
65
+ #
66
+ # TLSVerifyClient demand
67
+
68
+ # Sample security restrictions
69
+ # Require integrity protection (prevent hijacking)
70
+ # Require 112-bit (3DES or better) encryption for updates
71
+ # Require 63-bit encryption for simple bind
72
+ # security ssf=1 update_ssf=112 simple_bind=64
73
+
74
+ # Sample access control policy:
75
+ # Root DSE: allow anyone to read it
76
+ # Subschema (sub)entry DSE: allow anyone to read it
77
+ # Other DSEs:
78
+ # Allow self write access
79
+ # Allow authenticated users read access
80
+ # Allow anonymous users to authenticate
81
+ # Directives needed to implement policy:
82
+
83
+ # access to dn.base="dc=esc" by * read
84
+ # access to dn.base="cn=Subschema" by * read
85
+ access to *
86
+ by self write
87
+ by * read
88
+ by anonymous auth
89
+
90
+ #
91
+ # if no access controls are present, the default policy
92
+ # allows anyone and everyone to read anything but restricts
93
+ # updates to rootdn. (e.g., "access to * by * read")
94
+ #
95
+ # rootdn can always read and write EVERYTHING!
96
+
97
+ #######################################################################
98
+ # ldbm and/or bdb database definitions
99
+ #######################################################################
100
+
101
+ database ldif
102
+
103
+ suffix "dc=test,dc=com"
104
+ directory openldap-data
105
+ rootdn "cn=admin,dc=test,dc=com"
106
+ ## rootpw = secret
107
+ rootpw {SSHA}fFjKcZb4cfOAcwSjJer8nCGOEVRUnwCC
@@ -0,0 +1,7 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+ require 'rake'
6
+
7
+ RailsApp::Application.load_tasks
@@ -0,0 +1,7 @@
1
+ class ApplicationController < ActionController::Base
2
+ rescue_from DeviseLdapAuthenticatable::LdapException do |exception|
3
+ render :text => exception, :status => 500
4
+ end
5
+ protect_from_forgery
6
+ layout 'application'
7
+ end
@@ -0,0 +1,15 @@
1
+ class PostsController < ApplicationController
2
+
3
+ before_filter :authenticate_user!, :except => [:index]
4
+
5
+ def index
6
+ # render :inline => "posts#index", :layout => "application"
7
+ render :text => "posts#index"
8
+ end
9
+
10
+ def new
11
+ # render :inline => "posts#new", :layout => "application"
12
+ render :text => "posts#new"
13
+ end
14
+
15
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ module PostsHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ class Post < ActiveRecord::Base
2
+ end
@@ -0,0 +1,7 @@
1
+ class User < ActiveRecord::Base
2
+
3
+ # Include default devise modules. Others available are:
4
+ # :token_authenticatable, :confirmable, :lockable and :timeoutable
5
+ devise :ldap_authenticatable, :registerable,
6
+ :recoverable, :rememberable, :trackable# , :validatable
7
+ end
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>RailsApp</title>
5
+ <%= stylesheet_link_tag :all %>
6
+ <%= javascript_include_tag :defaults %>
7
+ <%= csrf_meta_tag %>
8
+ </head>
9
+ <body>
10
+
11
+ <% if user_signed_in? %>
12
+ <%= link_to "sign out", destroy_user_session_path %>
13
+ <% else %>
14
+ <%= link_to "sign in", new_user_session_path %>
15
+ <% end %>
16
+
17
+ <p />
18
+
19
+ <% flash.each do |name, message| %>
20
+ <p id="<%= name %>" class="flash"><%= message %></p>
21
+ <% end %>
22
+
23
+ <%= yield %>
24
+
25
+ </body>
26
+ </html>
@@ -0,0 +1,2 @@
1
+ <h1>Posts#index</h1>
2
+ <p>Find me in app/views/posts/index.html.erb</p>
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run RailsApp::Application
@@ -0,0 +1,46 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ require 'rails/all'
4
+
5
+ # If you have a Gemfile, require the gems listed there, including any gems
6
+ # you've limited to :test, :development, or :production.
7
+ Bundler.require(:default, Rails.env) if defined?(Bundler)
8
+
9
+ module RailsApp
10
+ class Application < Rails::Application
11
+ # Settings in config/environments/* take precedence over those specified here.
12
+ # Application configuration should go into files in config/initializers
13
+ # -- all .rb files in that directory are automatically loaded.
14
+
15
+ # Add additional load paths for your own custom dirs
16
+ # config.load_paths += %W( #{config.root}/extras )
17
+
18
+ # Only load the plugins named here, in the order given (default is alphabetical).
19
+ # :all can be used as a placeholder for all plugins not explicitly named
20
+ # config.plugins = [ :exception_notification, :ssl_requirement, :all ]
21
+
22
+ # Activate observers that should always be running
23
+ # config.active_record.observers = :cacher, :garbage_collector, :forum_observer
24
+
25
+ # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
26
+ # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
27
+ # config.time_zone = 'Central Time (US & Canada)'
28
+
29
+ # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
30
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
31
+ # config.i18n.default_locale = :de
32
+
33
+ # Configure generators values. Many other options are available, be sure to check the documentation.
34
+ # config.generators do |g|
35
+ # g.orm :active_record
36
+ # g.template_engine :erb
37
+ # g.test_framework :test_unit, :fixture => true
38
+ # end
39
+
40
+ # Configure the default encoding used in templates for Ruby 1.9.
41
+ config.encoding = "utf-8"
42
+
43
+ # Configure sensitive parameters which will be filtered from the log file.
44
+ config.filter_parameters += [:password]
45
+ end
46
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+
3
+ # Set up gems listed in the Gemfile.
4
+ gemfile = File.expand_path('../../../../Gemfile', __FILE__)
5
+ begin
6
+ ENV['BUNDLE_GEMFILE'] = gemfile
7
+ require 'bundler'
8
+ Bundler.setup
9
+ rescue Bundler::GemNotFound => e
10
+ STDERR.puts e.message
11
+ STDERR.puts "Try running `bundle install`."
12
+ exit!
13
+ end if File.exist?(gemfile)
@@ -0,0 +1,8 @@
1
+ <%
2
+ rerun = File.file?('rerun.txt') ? IO.read('rerun.txt') : ""
3
+ rerun_opts = rerun.to_s.strip.empty? ? "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} features" : "--format #{ENV['CUCUMBER_FORMAT'] || 'pretty'} #{rerun}"
4
+ std_opts = "--format #{ENV['CUCUMBER_FORMAT'] || 'progress'} --strict --tags ~@wip"
5
+ %>
6
+ default: <%= std_opts %> features
7
+ wip: --tags @wip:3 --wip features
8
+ rerun: <%= rerun_opts %> --format rerun --out rerun.txt --strict --tags ~@wip
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3-ruby (not necessary on OS X Leopard)
3
+ development:
4
+ adapter: sqlite3
5
+ database: db/development.sqlite3
6
+ pool: 5
7
+ timeout: 5000
8
+
9
+ # Warning: The database defined as "test" will be erased and
10
+ # re-generated from your development database when you run "rake".
11
+ # Do not set this db to the same as development or production.
12
+ test: &test
13
+ adapter: sqlite3
14
+ database: db/test.sqlite3
15
+ pool: 5
16
+ timeout: 5000
17
+
18
+ production:
19
+ adapter: sqlite3
20
+ database: db/production.sqlite3
21
+ pool: 5
22
+ timeout: 5000
23
+
24
+ cucumber:
25
+ <<: *test
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ RailsApp::Application.initialize!
@@ -0,0 +1,21 @@
1
+ RailsApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.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 webserver when you make code changes.
7
+ config.cache_classes = false
8
+
9
+ # Do not eager load code on boot.
10
+ config.eager_load = false
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
+ # Don't care if the mailer can't send
17
+ config.action_mailer.raise_delivery_errors = false
18
+ config.active_support.deprecation = :log
19
+
20
+ config.action_mailer.default_url_options = { :host => 'localhost:3000' }
21
+ end
@@ -0,0 +1,46 @@
1
+ RailsApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.rb
3
+
4
+ # The production environment is meant for finished, "live" apps.
5
+ # Code is not reloaded between requests
6
+ config.cache_classes = true
7
+
8
+ # Full error reports are disabled and caching is turned on
9
+ config.consider_all_requests_local = false
10
+ config.action_controller.perform_caching = true
11
+
12
+ # Specifies the header that your server uses for sending files
13
+ config.action_dispatch.x_sendfile_header = "X-Sendfile"
14
+
15
+ # For nginx:
16
+ # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect'
17
+
18
+ # If you have no front-end server that supports something like X-Sendfile,
19
+ # just comment this out and Rails will serve the files
20
+
21
+ # See everything in the log (default is :info)
22
+ # config.log_level = :debug
23
+
24
+ # Use a different logger for distributed setups
25
+ # config.logger = SyslogLogger.new
26
+
27
+ # Use a different cache store in production
28
+ # config.cache_store = :mem_cache_store
29
+
30
+ # Disable Rails's static asset server
31
+ # In production, Apache or nginx will already do this
32
+ config.serve_static_assets = false
33
+
34
+ # Enable serving of images, stylesheets, and javascripts from an asset server
35
+ # config.action_controller.asset_host = "http://assets.example.com"
36
+
37
+ # Disable delivery errors, bad email addresses will be ignored
38
+ # config.action_mailer.raise_delivery_errors = false
39
+
40
+ # Enable threaded mode
41
+ # config.threadsafe!
42
+
43
+ # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
44
+ # the I18n.default_locale when a translation can not be found)
45
+ config.i18n.fallbacks = true
46
+ end
@@ -0,0 +1,34 @@
1
+ RailsApp::Application.configure do
2
+ # Settings specified here will take precedence over those in config/environment.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
+ # Do not eager load code on boot.
11
+ config.eager_load = false
12
+
13
+ # Show full error reports and disable caching
14
+ config.consider_all_requests_local = true
15
+ config.action_controller.perform_caching = false
16
+
17
+ # Raise exceptions instead of rendering exception templates
18
+ config.action_dispatch.show_exceptions = false
19
+
20
+ # Disable request forgery protection in test environment
21
+ config.action_controller.allow_forgery_protection = false
22
+
23
+ # Tell Action Mailer not to deliver emails to the real world.
24
+ # The :test delivery method accumulates sent emails in the
25
+ # ActionMailer::Base.deliveries array.
26
+ config.action_mailer.delivery_method = :test
27
+
28
+ config.active_support.deprecation = :stderr
29
+
30
+ # Use SQL instead of Active Record's schema dumper when creating the test database.
31
+ # This is necessary if your schema can't be completely dumped by the schema dumper,
32
+ # like if you have constraints or database-specific column types
33
+ # config.active_record.schema_format = :sql
34
+ end