Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 226
- Log:
When running Rake tasks, the use of PATH_PREFIX in routes.rb causes
problems. The routes get parsed but unless RAILS_RELATIVE_URL_ROOT is
set in the environment, they fail because PATH_PREFIX ends up 'nil'
and you can't add 'nil' to a string. Up until now I've just set the
environment variable to an empty string (any defined value will do)
and started again, but this is pretty stupid. A far simpler approach
is to just define PATH_PREFIX to an empty string if the enviroment
variable is missing, allowing rake tasks to run without extra work.Modified environment.rb to do this in all cases, including patching
old applications that aren't used, in case they're ever used again.
- Author:
- rool
- Date:
- Wed Jun 13 18:00:17 +0100 2007
- Size:
- 5462 Bytes
1 | # Be sure to restart your webserver when you modify this file. |
2 | |
3 | # Uncomment below to force Rails into production mode |
4 | # (Use only when you can't set environment variables through your web/app server) |
5 | # ENV['RAILS_ENV'] = 'production' |
6 | |
7 | # Bootstrap the Rails environment, frameworks, and default configuration |
8 | require File.join(File.dirname(__FILE__), 'boot') |
9 | |
10 | # Location of application relative to document root in terms of |
11 | # URLs (i.e. according to the web server configuration, not the |
12 | # filesystem location). |
13 | |
14 | PATH_PREFIX = ENV['RAILS_RELATIVE_URL_ROOT'] || '' |
15 | |
16 | Rails::Initializer.run do |config| |
17 | # We don't run in the document root, so images etc. must come from |
18 | # a non-root location too. Hijack the 'asset host' facility to get |
19 | # helper-based links pointing in the right place. |
20 | config.action_controller.asset_host = PATH_PREFIX |
21 | |
22 | # Skip frameworks you're not going to use |
23 | # config.frameworks -= [ :action_web_service, :action_mailer ] |
24 | |
25 | # Add additional load paths for your own custom dirs |
26 | # config.load_paths += %W( #{RAILS_ROOT}/app/services ) |
27 | |
28 | # I need the localization plugin to load first |
29 | # Otherwise, I can't localize plugins <= localization |
30 | config.plugins = [ 'localization' ] |
31 | Dir.entries("#{RAILS_ROOT}/vendor/plugins/").each { |dir| |
32 | config.plugins.push("#{dir}") if File.directory?("#{RAILS_ROOT}/vendor/plugins/#{dir}/lib") |
33 | } |
34 | |
35 | config.load_paths += %W( |
36 | vendor/rubypants |
37 | vendor/akismet |
38 | vendor/redcloth/lib |
39 | vendor/bluecloth/lib |
40 | vendor/flickr |
41 | vendor/syntax/lib |
42 | vendor/sparklines/lib |
43 | vendor/uuidtools/lib |
44 | vendor/jabber4r/lib |
45 | vendor/mocha/lib |
46 | vendor/memcache-client/lib |
47 | vendor/cached_model/lib |
48 | ).map {|dir| "#{RAILS_ROOT}/#{dir}"}.select { |dir| File.directory?(dir) } |
49 | |
50 | # Force all environments to use the same logger level |
51 | # (by default production uses :info, the others :debug) |
52 | config.log_level = :warn |
53 | |
54 | # Use the database for sessions instead of the file system |
55 | # (create the session table with 'rake create_sessions_table') |
56 | config.action_controller.session_store = :active_record_store |
57 | |
58 | # Enable page/fragment caching by setting a file-based store |
59 | # (remember to create the caching directory and make it readable to the application) |
60 | config.action_controller.fragment_cache_store = :file_store, "#{RAILS_ROOT}/tmp/cache" |
61 | |
62 | # Activate observers that should always be running |
63 | # config.active_record.observers = :cacher, :garbage_collector |
64 | config.active_record.observers = :email_notifier, :web_notifier |
65 | |
66 | config.active_record.allow_concurrency = false |
67 | |
68 | # Make Active Record use UTC-base instead of local time |
69 | # config.active_record.default_timezone = :utc |
70 | |
71 | # Use Active Record's schema dumper instead of SQL when creating the test database |
72 | # (enables use of different database adapters for development and test environments) |
73 | # config.active_record.schema_format = :ruby |
74 | |
75 | # See Rails::Configuration for more options |
76 | end |
77 | |
78 | # Add new inflection rules using the following format |
79 | # (all these examples are active by default): |
80 | # Inflector.inflections do |inflect| |
81 | # inflect.plural /^(ox)$/i, '\1en' |
82 | # inflect.singular /^(ox)en/i, '\1' |
83 | # inflect.irregular 'person', 'people' |
84 | # inflect.uncountable %w( fish sheep ) |
85 | # end |
86 | |
87 | Inflector.inflections {|i| i.uncountable %w(feedback)} |
88 | |
89 | # Include your application configuration below |
90 | |
91 | # Allow multiple Rails applications by giving the session cookie a |
92 | # unique prefix. |
93 | |
94 | ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS[:session_key] = 'typoapp_session_id' |
95 | |
96 | # Load included libraries. |
97 | require 'redcloth' |
98 | require 'bluecloth' |
99 | require 'rubypants' |
100 | require 'flickr' |
101 | require 'uuidtools' |
102 | |
103 | require 'migrator' |
104 | require 'rails_patch/active_record' |
105 | require 'login_system' |
106 | require 'typo_version' |
107 | require 'metafragment' |
108 | require 'actionparamcache' |
109 | $KCODE = 'u' |
110 | require 'jcode' |
111 | require 'xmlrpc_fix' |
112 | require 'transforms' |
113 | require 'builder' |
114 | |
115 | require 'typo_deprecated' |
116 | |
117 | #MemoryProfiler.start(:delay => 10, :string_debug => false) |
118 | |
119 | unless Builder::XmlMarkup.methods.include? '_attr_value' |
120 | # Builder 2.0 has many important fixes, but for now we will only backport |
121 | # this one... |
122 | class Builder::XmlMarkup |
123 | # Insert the attributes (given in the hash). |
124 | def _insert_attributes(attrs, order=[]) |
125 | return if attrs.nil? |
126 | order.each do |k| |
127 | v = attrs[k] |
128 | @target << %{ #{k}="#{_attr_value(v)}"} if v # " WART |
129 | end |
130 | attrs.each do |k, v| |
131 | @target << %{ #{k}="#{_attr_value(v)}"} unless order.member?(k) # " WART |
132 | end |
133 | end |
134 | |
135 | def _attr_value(value) |
136 | case value |
137 | when Symbol |
138 | value.to_s |
139 | else |
140 | _escape(value.to_s).gsub(%r{"}, '"') # " WART |
141 | end |
142 | end |
143 | end |
144 | end |
145 | |
146 | ActiveSupport::CoreExtensions::Time::Conversions::DATE_FORMATS.merge!( |
147 | :long_weekday => '%a %B %e, %Y %H:%M' |
148 | ) |
149 | |
150 | ActionMailer::Base.default_charset = 'utf-8' |
151 | |
152 | if RAILS_ENV != 'test' |
153 | begin |
154 | mail_settings = YAML.load(File.read("#{RAILS_ROOT}/config/mail.yml")) |
155 | |
156 | ActionMailer::Base.delivery_method = mail_settings['method'] |
157 | ActionMailer::Base.server_settings = mail_settings['settings'] |
158 | rescue |
159 | # Fall back to using sendmail by default |
160 | ActionMailer::Base.delivery_method = :sendmail |
161 | end |
162 | end |
163 | |
164 | FLICKR_KEY='84f652422f05b96b29b9a960e0081c50' |
165 | |
166 | #require 'memcache_util' |
167 | require 'cached_model' |
168 | CachedModel.use_local_cache = true |
169 | CachedModel.use_memcache = false |
170 | |
171 | # Uncomment this to choose your blog's language |
172 | #Localization.lang = 'fr_FR' |