devision 0.0.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/devision.rb +16 -1
 - data/lib/devision/errors.rb +5 -0
 - data/lib/devision/version.rb +1 -1
 - metadata +2 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: d0d40bc28fbdcf1a056c0bfef93fff9c4ee4996d
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 5f1f41aa293a6b994ca2d2dc4d6dc473a19dc6e4
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 28133bb9926f593b122b056c250cebe231c80613f1f4c3141e5bee8f12ade5ad5b4261ce2148a27fa728675f75e054c5f6b5c7316fb4f4576929191eeaf81cde
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: cd22e81f9d8d6dba9fa57db0bcdf1f65267c16404512508ac9c8698222e3e3ad97043d282e4b7d989bd8843cb15f7ad94d5b2e562c82a2afa62923cd0cecc2d9
         
     | 
    
        data/lib/devision.rb
    CHANGED
    
    | 
         @@ -5,6 +5,7 @@ require 'securerandom' 
     | 
|
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            module Devision
         
     | 
| 
       7 
7 
     | 
    
         
             
              autoload :TokenGenerator, 'devision/token_generator'
         
     | 
| 
      
 8 
     | 
    
         
            +
              autoload :Errors, 'devision/errors'
         
     | 
| 
       8 
9 
     | 
    
         | 
| 
       9 
10 
     | 
    
         
             
              module Models
         
     | 
| 
       10 
11 
     | 
    
         
             
                autoload :Config, 'devision/models/config'
         
     | 
| 
         @@ -17,7 +18,6 @@ module Devision 
     | 
|
| 
       17 
18 
     | 
    
         
             
              # Devision configuration settings (for initializers)
         
     | 
| 
       18 
19 
     | 
    
         
             
              require 'devision/configuration_options'
         
     | 
| 
       19 
20 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
       21 
21 
     | 
    
         
             
              # Generate a user friendly 'nice' string randomly to be used as token.
         
     | 
| 
       22 
22 
     | 
    
         
             
              def self.nice_token
         
     | 
| 
       23 
23 
     | 
    
         
             
                SecureRandom.urlsafe_base64(15).tr('lIO0', 'sxyz')
         
     | 
| 
         @@ -41,7 +41,22 @@ module Devision 
     | 
|
| 
       41 
41 
     | 
    
         
             
              # Default way to setup Devision. Just call this in an initializer
         
     | 
| 
       42 
42 
     | 
    
         
             
              def self.setup
         
     | 
| 
       43 
43 
     | 
    
         
             
                yield(self)
         
     | 
| 
      
 44 
     | 
    
         
            +
                self.initialize!
         
     | 
| 
       44 
45 
     | 
    
         
             
              end
         
     | 
| 
       45 
46 
     | 
    
         | 
| 
      
 47 
     | 
    
         
            +
              protected
         
     | 
| 
      
 48 
     | 
    
         
            +
                def self.initialize!
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
                  Devision.token_generator ||= begin
         
     | 
| 
      
 51 
     | 
    
         
            +
                    if secret = Devision.secret_key
         
     | 
| 
      
 52 
     | 
    
         
            +
                      Devision::TokenGenerator.new(
         
     | 
| 
      
 53 
     | 
    
         
            +
                        Devision::CachingKeyGenerator.new(Devision::KeyGenerator.new(secret))
         
     | 
| 
      
 54 
     | 
    
         
            +
                      )
         
     | 
| 
      
 55 
     | 
    
         
            +
                    else
         
     | 
| 
      
 56 
     | 
    
         
            +
                      raise Devision::Errors::Configuration.new('Devision.secret_key contain a value for encryption.')
         
     | 
| 
      
 57 
     | 
    
         
            +
                    end
         
     | 
| 
      
 58 
     | 
    
         
            +
                  end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                end
         
     | 
| 
       46 
61 
     | 
    
         | 
| 
       47 
62 
     | 
    
         
             
            end
         
     | 
    
        data/lib/devision/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: devision
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - John Faucett
         
     | 
| 
         @@ -129,6 +129,7 @@ files: 
     | 
|
| 
       129 
129 
     | 
    
         
             
            - devision.gemspec
         
     | 
| 
       130 
130 
     | 
    
         
             
            - lib/devision.rb
         
     | 
| 
       131 
131 
     | 
    
         
             
            - lib/devision/configuration_options.rb
         
     | 
| 
      
 132 
     | 
    
         
            +
            - lib/devision/errors.rb
         
     | 
| 
       132 
133 
     | 
    
         
             
            - lib/devision/models/authenticatable.rb
         
     | 
| 
       133 
134 
     | 
    
         
             
            - lib/devision/models/config.rb
         
     | 
| 
       134 
135 
     | 
    
         
             
            - lib/devision/models/confirmable.rb
         
     |