forked from mephistorb/mephisto
/
environment.rb
95 lines (77 loc) · 3.79 KB
/
environment.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Be sure to restart your web server when you modify this file.
# Uncomment below to force Rails into production mode when
# you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production'
#require 'rubygems'
#require 'ruby-debug'
#Debugger.start
# Mephisto now requires Rails 2.2
RAILS_GEM_VERSION = '2.2.2' unless defined? RAILS_GEM_VERSION
# Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot')
require File.join(File.dirname(__FILE__), '../vendor/plugins/engines/boot')
require File.join(File.dirname(__FILE__), '../lib/mephisto/plugin')
# Don't load the application when running rake db:* tasks, because doing so
# will try to access database tables before they exist. See
# http://rails.lighthouseapp.com/projects/8994/tickets/63, which allegedly
# fixes this problem. Here's where I got the idea:
# http://justbarebones.blogspot.com/2008/05/rails-202-restful-authentication-and.html
def safe_to_load_application?
File.basename($0) != "rake" || !ARGV.any? {|a| a =~ /^(db|gems):/ }
end
# Make sure we a site-specific secret key file.
unless File.exists?(File.join(File.dirname(__FILE__),
'initializers/session_store.rb'))
raise <<EOD
You need to run 'rake config/initializers/session_store.rb' to create a
secret key for encrypting session cookies.
EOD
end
Rails::Initializer.run do |config|
# Settings in config/environments/* take precedence those specified here
# Skip frameworks you're not going to use
config.frameworks -= [ :active_resource ]
config.load_paths += %W( #{RAILS_ROOT}/app/cachers #{RAILS_ROOT}/app/drops #{RAILS_ROOT}/app/filters )
# This gem is a lightly-patched, in-tree version of rubypants. The
# upstream gem was last released in 2004, and needs to be repackaged
# before we can treat it like a normal gem.
config.load_paths += %W( #{RAILS_ROOT}/vendor/rubypants-0.2.0/lib )
# NFI why this is here. find and eradicate the bug.
config.load_paths += %W( #{RAILS_ROOT}/vendor/rails/actionwebservice/lib )
# Force all environments to use the same logger level
# (by default production uses :info, the others :debug)
# config.log_level = :debug
# Make Active Record use UTC-base instead of local time
config.active_record.default_timezone = :utc
# Use Active Record's schema dumper instead of SQL when creating the test database
# (enables use of different database adapters for development and test environments)
config.active_record.schema_format = :ruby
# Register our observers.
if safe_to_load_application?
config.active_record.observers = [:article_observer, :comment_observer]
end
# Allow table tags in untrusted HTML, but block img tags to prevent
# SRC attributes from being used in CSRF attacks.
config.action_view.sanitized_allowed_tags = ['table', 'tr', 'td']
config.after_initialize do
ActionView::Base.sanitized_allowed_tags.delete 'img'
ActionView::Base.sanitized_allowed_attributes.delete 'src'
end
# We're slowly moving the contents of vendor and vender/plugins into
# vendor/gems by adding config.gem declarations.
config.gem 'RedCloth', :version => '3.0.4', :lib => 'redcloth'
config.gem 'BlueCloth', :lib => 'bluecloth'
config.gem 'faker'
config.gem 'notahat-machinist', :lib => 'machinist',
:source => 'http://gems.github.com'
config.gem 'rubyzip', :lib => 'zip/zipfilesystem'
config.gem 'liquid'
config.gem 'will_paginate'
config.gem 'mocha'
config.gem 'coderay'
config.gem 'tzinfo', :version => '>= 0.3.12'
config.gem 'emk-safe_erb', :version => '>= 0.1.1', :lib => 'safe_erb',
:source => 'http://gems.github.com'
end
# Don't update this file, make custom tweaks in config/initializers/custom.rb,
# or create your own file in config/initializers