summaryrefslogtreecommitdiffstats
path: root/lib/redmine/configuration.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-09-01 00:48:02 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2011-09-01 00:48:02 +0000
commit7d26d8167b19cf50470720cb2fcddecf378a97b7 (patch)
treee5c05d042d2bd6908d188e9cd70cededc80df06c /lib/redmine/configuration.rb
parentab558ee331c9b5eeda3defacb1f0295d9eeaac6b (diff)
downloadredmine-7d26d8167b19cf50470720cb2fcddecf378a97b7.tar.gz
redmine-7d26d8167b19cf50470720cb2fcddecf378a97b7.zip
remove trailing white-spaces from lib/redmine/configuration.rb.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6943 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/configuration.rb')
-rw-r--r--lib/redmine/configuration.rb32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/redmine/configuration.rb b/lib/redmine/configuration.rb
index 34880ce58..4257861c3 100644
--- a/lib/redmine/configuration.rb
+++ b/lib/redmine/configuration.rb
@@ -5,42 +5,42 @@
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
module Redmine
module Configuration
-
+
# Configuration default values
@defaults = {
'email_delivery' => nil
}
-
+
@config = nil
-
+
class << self
# Loads the Redmine configuration file
# Valid options:
# * <tt>:file</tt>: the configuration file to load (default: config/configuration.yml)
- # * <tt>:env</tt>: the environment to load the configuration for (default: Rails.env)
+ # * <tt>:env</tt>: the environment to load the configuration for (default: Rails.env)
def load(options={})
filename = options[:file] || File.join(Rails.root, 'config', 'configuration.yml')
env = options[:env] || Rails.env
-
+
@config = @defaults.dup
-
+
load_deprecated_email_configuration(env)
if File.file?(filename)
@config.merge!(load_from_yaml(filename, env))
end
-
+
# Compatibility mode for those who copy email.yml over configuration.yml
%w(delivery_method smtp_settings sendmail_settings).each do |key|
if value = @config.delete(key)
@@ -48,7 +48,7 @@ module Redmine
@config['email_delivery'][key] = value
end
end
-
+
if @config['email_delivery']
ActionMailer::Base.perform_deliveries = true
@config['email_delivery'].each do |k, v|
@@ -56,16 +56,16 @@ module Redmine
ActionMailer::Base.send("#{k}=", v)
end
end
-
+
@config
end
-
+
# Returns a configuration setting
def [](name)
load unless @config
@config[name]
end
-
+
# Yields a block with the specified hash configuration settings
def with(settings)
settings.stringify_keys!
@@ -75,9 +75,9 @@ module Redmine
yield if block_given?
@config.merge! was
end
-
+
private
-
+
def load_from_yaml(filename, env)
yaml = YAML::load_file(filename)
conf = {}
@@ -94,7 +94,7 @@ module Redmine
end
conf
end
-
+
def load_deprecated_email_configuration(env)
deprecated_email_conf = File.join(Rails.root, 'config', 'email.yml')
if File.file?(deprecated_email_conf)