Skip to content
This repository
Newer
Older
100644 149 lines (135 sloc) 5.687 kb
3096629d » tenderlove
2011-08-24 we are *sure* we want to set the encoding, so silence warnings around it
1 require 'active_support/core_ext/kernel/reporting'
cd3033eb » josevalim
2011-12-13 Add config.file_watcher so developers can provide their own watchers …
2 require 'active_support/file_update_checker'
b17e358e » josevalim
2010-01-23 Move configuration to subfolders.
3 require 'rails/engine/configuration'
4
5 module Rails
6 class Application
7 class Configuration < ::Rails::Engine::Configuration
0f3d426a » felixbuenemann
2012-02-10 Make log autoflushing configurable
8 attr_accessor :allow_concurrency, :asset_host, :asset_path, :assets, :autoflush_log,
951b5820 » drogus
2012-02-01 Allow to set custom console type with Rails.application.config.console=
9 :cache_classes, :cache_store, :consider_all_requests_local, :console,
02127e64 » josevalim
2011-12-16 Allow a custom exceptions app to set.
10 :dependency_loading, :exceptions_app, :file_watcher, :filter_parameters,
51aeae91 » tenderlove
2012-03-12 allow people to specify custom formatters, use the default formatter …
11 :force_ssl, :helpers_paths, :logger, :log_formatter, :log_tags, :preload_frameworks,
dad7fdc5 » spastorino
2012-01-02 Rails::Plugin has gone
12 :railties_order, :relative_url_root, :secret_token,
fa1d9a88 » josevalim
2011-12-12 Speed up development by only reloading classes if dependencies files …
13 :serve_static_assets, :ssl_options, :static_cache_control, :session_options,
0da12df2 » kennyj
2012-03-01 Load db/schema_cache.dump duaring boot time.
14 :time_zone, :reload_classes_only_on_change, :use_schema_cache_dump
b17e358e » josevalim
2010-01-23 Move configuration to subfolders.
15
64c82f9e » tenderlove
2011-01-05 only define log_level reader once, make sure to initialize @log_level
16 attr_writer :log_level
4af43128 » tenderlove
2011-08-24 only define the encoding reader since we define the writer later on
17 attr_reader :encoding
64c82f9e » tenderlove
2011-01-05 only define log_level reader once, make sure to initialize @log_level
18
b17e358e » josevalim
2010-01-23 Move configuration to subfolders.
19 def initialize(*)
20 super
aaec0072 » wycats
2010-08-15 Make sure apps upgrading from 2.3 get defaulted to UTF-8 (ht: parndt)
21 self.encoding = "utf-8"
fa1d9a88 » josevalim
2011-12-12 Speed up development by only reloading classes if dependencies files …
22 @allow_concurrency = false
23 @consider_all_requests_local = false
24 @filter_parameters = []
25 @helpers_paths = []
26 @dependency_loading = true
27 @serve_static_assets = true
28 @static_cache_control = nil
29 @force_ssl = false
30 @ssl_options = {}
31 @session_store = :cookie_store
32 @session_options = {}
33 @time_zone = "UTC"
34 @log_level = nil
35 @middleware = app_middleware
36 @generators = app_generators
37 @cache_store = [ :file_store, "#{root}/tmp/cache/" ]
38 @railties_order = [:all]
39 @relative_url_root = ENV["RAILS_RELATIVE_URL_ROOT"]
40 @reload_classes_only_on_change = true
cd3033eb » josevalim
2011-12-13 Add config.file_watcher so developers can provide their own watchers …
41 @file_watcher = ActiveSupport::FileUpdateChecker
02127e64 » josevalim
2011-12-16 Allow a custom exceptions app to set.
42 @exceptions_app = nil
4a98a305 » felixbuenemann
2012-02-23 Always default to flushing enabled
43 @autoflush_log = true
51aeae91 » tenderlove
2012-03-12 allow people to specify custom formatters, use the default formatter …
44 @log_formatter = ActiveSupport::Logger::SimpleFormatter.new
0da12df2 » kennyj
2012-03-01 Load db/schema_cache.dump duaring boot time.
45 @use_schema_cache_dump = true
28fee29e » josh
2011-03-30 Unify sprockets config options
46
47 @assets = ActiveSupport::OrderedOptions.new
75342407 » josevalim
2011-10-02 Provide initialize_on_precompile which, when set to false, does not i…
48 @assets.enabled = false
49 @assets.paths = []
50 @assets.precompile = [ Proc.new{ |path| !File.extname(path).in?(['.js', '.css']) },
51 /(?:\/|\\|\A)application\.(css|js)$/ ]
52 @assets.prefix = "/assets"
53 @assets.version = ''
54 @assets.debug = false
55 @assets.compile = true
56 @assets.digest = false
57 @assets.manifest = nil
58 @assets.cache_store = [ :file_store, "#{root}/tmp/cache/assets/" ]
59 @assets.js_compressor = nil
60 @assets.css_compressor = nil
61 @assets.initialize_on_precompile = true
226783d1 » guilleiguaran
2012-01-17 Silent Sprockets logger when config.assets.logger is set to false
62 @assets.logger = nil
ec73710c » josevalim
2010-04-07 Alleviate the pain in working with utf8 templates by setting a defaul…
63 end
64
8284fd38 » drogus
2010-08-04 Get rid of static_paths method and instead configure paths for Action…
65 def compiled_asset_path
66 "/"
67 end
68
ec73710c » josevalim
2010-04-07 Alleviate the pain in working with utf8 templates by setting a defaul…
69 def encoding=(value)
70 @encoding = value
5ca86ac8 » lest
2011-12-24 deprecate String#encoding_aware? and remove its usage
71 silence_warnings do
72 Encoding.default_external = value
73 Encoding.default_internal = value
ec73710c » josevalim
2010-04-07 Alleviate the pain in working with utf8 templates by setting a defaul…
74 end
b17e358e » josevalim
2010-01-23 Move configuration to subfolders.
75 end
76
77 def paths
78 @paths ||= begin
79 paths = super
d649bf15 » josevalim
2010-10-06 Provide a cleaner syntax for paths configuration that does not rely o…
80 paths.add "config/database", :with => "config/database.yml"
81 paths.add "config/environment", :with => "config/environment.rb"
82 paths.add "lib/templates"
83 paths.add "log", :with => "log/#{Rails.env}.log"
afc82882 » josevalim
2011-04-15 Remove the ability for engines to serve assets from the public direct…
84 paths.add "public"
85 paths.add "public/javascripts"
86 paths.add "public/stylesheets"
d649bf15 » josevalim
2010-10-06 Provide a cleaner syntax for paths configuration that does not rely o…
87 paths.add "tmp"
b17e358e » josevalim
2010-01-23 Move configuration to subfolders.
88 paths
89 end
90 end
91
92 # Enable threaded mode. Allows concurrent requests to controller actions and
93 # multiple database connections. Also disables automatic dependency loading
94 # after boot, and disables reloading code on every request, as these are
95 # fundamentally incompatible with thread safety.
96 def threadsafe!
76df63e1 » prasath
2012-01-12 changing self.attribute to @atrribute to follow one kind of value ass…
97 @preload_frameworks = true
98 @cache_classes = true
99 @dependency_loading = false
100 @allow_concurrency = true
b17e358e » josevalim
2010-01-23 Move configuration to subfolders.
101 self
102 end
103
104 # Loads and returns the contents of the #database_configuration_file. The
105 # contents of the file are processed via ERB before being sent through
106 # YAML::load.
107 def database_configuration
108 require 'erb'
3b378a78 » tenderlove
2012-04-03 use File.binread to pull in the schema cache
109 YAML.load ERB.new(IO.read(paths["config/database"].first)).result
b17e358e » josevalim
2010-01-23 Move configuration to subfolders.
110 end
111
112 def log_level
113 @log_level ||= Rails.env.production? ? :info : :debug
114 end
c2dbc391 » Carlhuda
2010-03-02 Have log subscribers subscribe to the actual events, so the subscribe…
115
116 def colorize_logging
2e7d6ff0 » kennyj
2012-01-27 Remove redundant instance_variables (@colorize_logging)
117 ActiveSupport::LogSubscriber.colorize_logging
c2dbc391 » Carlhuda
2010-03-02 Have log subscribers subscribe to the actual events, so the subscribe…
118 end
119
120 def colorize_logging=(val)
6788db82 » josevalim
2010-06-24 Move Rails::LogSubscriber to ActiveSupport::LogSubscriber, allowing f…
121 ActiveSupport::LogSubscriber.colorize_logging = val
c2dbc391 » Carlhuda
2010-03-02 Have log subscribers subscribe to the actual events, so the subscribe…
122 self.generators.colorize_logging = val
123 end
395d6648 » josevalim
2010-03-26 Move application configuration to the application configuration objec…
124
125 def session_store(*args)
126 if args.empty?
127 case @session_store
128 when :disabled
129 nil
130 when :active_record_store
131 ActiveRecord::SessionStore
132 when Symbol
133 ActionDispatch::Session.const_get(@session_store.to_s.camelize)
134 else
135 @session_store
136 end
137 else
138 @session_store = args.shift
139 @session_options = args.shift || {}
140 end
141 end
4f6af26a » lest
2011-12-20 remove AS whiny nil extension and deprecate config.whiny_nils
142
143 def whiny_nils=(*)
144 ActiveSupport::Deprecation.warn "config.whiny_nils option " \
145 "is deprecated and no longer works", caller
146 end
b17e358e » josevalim
2010-01-23 Move configuration to subfolders.
147 end
148 end
f38e89cf » josh
2010-03-20 Move railties/builtin into lib
149 end
Something went wrong with that request. Please try again.