simplest_auth 0.2.5 → 0.2.6

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.
data/README.textile CHANGED
@@ -21,7 +21,7 @@ SimplestAuth depends (for now) on the BCrypt gem, so install that first:
21
21
 
22
22
  Configure for the gem:
23
23
 
24
- <pre><code>config.gem 'vigetlabs-simplest_auth', :lib => 'simplest_auth'</code></pre>
24
+ <pre><code>config.gem 'simplest_auth'</code></pre>
25
25
 
26
26
  h2. Usage
27
27
 
@@ -8,28 +8,28 @@ module SimplestAuth
8
8
  attr_accessor :password, :password_confirmation
9
9
  end
10
10
 
11
- if base.active_record? || base.mongo_mapper?
11
+ if base.data_mapper?
12
12
  base.class_eval do
13
- before_save :hash_password, :if => :password_required?
13
+ before(:save) {hash_password if password_required?}
14
14
  end
15
- elsif base.data_mapper?
15
+ elsif base.active_record? || base.mongo_mapper?
16
16
  base.class_eval do
17
- before(:save) {hash_password if password_required?}
17
+ before_save :hash_password, :if => :password_required?
18
18
  end
19
19
  end
20
20
  end
21
21
 
22
22
  module ClassMethods
23
23
  def active_record?
24
- defined?(ActiveRecord)
24
+ defined?(ActiveRecord) && ancestors.include?(ActiveRecord::Base)
25
25
  end
26
26
 
27
27
  def data_mapper?
28
- defined?(DataMapper)
28
+ defined?(DataMapper) && ancestors.include?(DataMapper::Resource)
29
29
  end
30
30
 
31
31
  def mongo_mapper?
32
- defined?(MongoMapper)
32
+ defined?(MongoMapper) && ancestors.include?(MongoMapper::Document)
33
33
  end
34
34
 
35
35
  def authenticate(email, password)
@@ -3,7 +3,7 @@ module SimplestAuth
3
3
 
4
4
  MAJOR = 0
5
5
  MINOR = 2
6
- TINY = 5
6
+ TINY = 6
7
7
 
8
8
  def self.to_s # :nodoc:
9
9
  [MAJOR, MINOR, TINY].join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplest_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Pitale
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-14 00:00:00 -05:00
12
+ date: 2009-12-21 00:00:00 -05:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -37,6 +37,10 @@ files:
37
37
  - lib/simplest_auth/model.rb
38
38
  - lib/simplest_auth/version.rb
39
39
  - lib/simplest_auth.rb
40
+ - test/unit/simplest_auth/ar_model_test.rb
41
+ - test/unit/simplest_auth/controller_test.rb
42
+ - test/unit/simplest_auth/dm_model_test.rb
43
+ - test/unit/simplest_auth/model_test.rb
40
44
  has_rdoc: true
41
45
  homepage: http://viget.com/extend
42
46
  licenses: []