lib/active_samba_ldap/configuration.rb in activesambaldap-0.0.3 vs lib/active_samba_ldap/configuration.rb in activesambaldap-0.0.4

- old
+ new

@@ -40,11 +40,11 @@ module ClassMethods class ValidHash < Hash def [](name) if Private.required_variables.include?(name) and !has_key?(name) - raise RequiredVariableIsNotSet.new(name) + raise MissingRequiredVariableError.new(name) end super(name) end end @@ -71,15 +71,17 @@ missing_variables = names.find_all do |name| config[name.to_sym].nil? end end unless missing_variables.empty? - raise RequiredVariablesAreNotSet.new(missing_variables) + raise MissingRequiredVariableError.new(missing_variables) end end class Private + include ActiveSambaLdap::GetTextSupport + VARIABLES = %w(base host port scope bind_dn password method allow_anonymous sid smb_conf samba_domain samba_netbios_name password_hash_type @@ -103,11 +105,11 @@ def required_variables @required_variables ||= compute_required_variables end def compute_required_variables - not_required_variables = %w(base ldap_scope) + not_required_variables = %w(base scope ldap_scope) (VARIABLES - public_methods - not_required_variables).collect do |x| x.to_sym end end end @@ -303,10 +305,10 @@ def validate_password_hash_type(type) unless AVAILABLE_HASH_TYPES.include?(type) types = AVAILABLE_HASH_TYPES.collect {|x| x.inspect}.join(", ") raise InvalidConfigurationValueError.new("password_hash_type", type, - "must be in #{types}") + _("must be in %s") % types) end end private def retrieve_value_from_smb_conf(key)