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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 43c30705818f3d105f21c7270c92e7f1824225b0
4
- data.tar.gz: aa8bb3b3b720f5336b42f13e7ff1ad18450c76cd
3
+ metadata.gz: d0d40bc28fbdcf1a056c0bfef93fff9c4ee4996d
4
+ data.tar.gz: 5f1f41aa293a6b994ca2d2dc4d6dc473a19dc6e4
5
5
  SHA512:
6
- metadata.gz: c9da084babbbe7878ca794570626f27b8d4b15d02b91c1b209be41de3edcca642809bc0ad96fc908abfd1752a9628e75cb7f1517c06a916850853beabf974bfc
7
- data.tar.gz: 73f23e9e1aeb2f8c8bcabd1444a9c97dabe0745938e641fdc099e2b3c37ca5b340a5c7e729218a3031c260cbad66b6615892de251bbfcc783ae01cf3f2e4930f
6
+ metadata.gz: 28133bb9926f593b122b056c250cebe231c80613f1f4c3141e5bee8f12ade5ad5b4261ce2148a27fa728675f75e054c5f6b5c7316fb4f4576929191eeaf81cde
7
+ data.tar.gz: cd22e81f9d8d6dba9fa57db0bcdf1f65267c16404512508ac9c8698222e3e3ad97043d282e4b7d989bd8843cb15f7ad94d5b2e562c82a2afa62923cd0cecc2d9
@@ -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
@@ -0,0 +1,5 @@
1
+ module Devision
2
+ module Errors
3
+ class Configuration < StandardError; ;end
4
+ end
5
+ end
@@ -7,7 +7,7 @@ module Devision
7
7
 
8
8
  MAJOR = 0
9
9
  MINOR = 0
10
- PATCH = 0
10
+ PATCH = 1
11
11
  STRING = [MAJOR,MINOR,PATCH].join('.').freeze
12
12
  end
13
13
  end
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.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