Module: Pasaporte

Defined in:
lib/pasaporte.rb

Defined Under Namespace

Modules: Auth, CampingFlash, Controllers, CookiePreservingRedirect, Helpers, Models, Secure, Views

Constant Summary collapse

VERSION =
'0.0.3'
MAX_FAILED_LOGIN_ATTEMPTS =
3
THROTTLE_FOR =
2.minutes
DEFAULT_COUNTRY =
'nl'
DEFAULT_TZ =
'Europe/Amsterdam'
ALLOW_DELEGATION =
true
SESSION_LIFETIME =
12.hours
PARTIAL_SSL =
false
HTTP_PORT =
80
SSL_PORT =
443
LOGGER =

:nodoc:

Logger.new(STDERR)
PATH =

:nodoc:

File.expand_path(__FILE__)
AUTH =
my_little_auth
COUNTRIES =

:nodoc:

YAML::load(File.read(File.dirname(PATH) + '/pasaporte/iso_countries.yml'))
TIMEZONES =

:nodoc:

YAML::load(File.read(File.dirname(PATH) + '/pasaporte/timezones.yml')).sort{|e1, e2| e1[1] <=> e2[1]}

Class Method Summary collapse

Class Method Details

.apply_config!Object

Reads and applies pasaporte/config.yml to the constants



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/pasaporte.rb', line 58

def self.apply_config!
   silence_warnings do
    paths_to_analyze = [ENV['HOME'] + '/pasaporte-config.yml', File.dirname(PATH) + '/pasaporte/config.yml']
    paths_to_analyze.each do | config_path |
      begin
        fc = File.read(config_path)
        YAML::load(fc).each_pair do |k, v|
          # Cause us to fail if this constant does not exist
          norm = k.to_s.upcase.to_sym
          const_get(norm); const_set(norm, v)
        end
      rescue Errno::ENOENT # silence
      end
    end
  end
end

.createObject



1073
1074
1075
1076
1077
1078
1079
1080
1081
# File 'lib/pasaporte.rb', line 1073

def self.create
  JulikState.create_schema
  self::Models.create_schema
  self::LOGGER.warn "Deleting sessions, assocs and nonces"
  [self::Models::Throttle, self::Models::Nonce, 
   self::Models::Association, JulikState::State].each do | m |
    m.delete_all
  end
end