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
This commit is contained in:
parent
ab558ee331
commit
7d26d8167b
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue