mm-devise 1.1.10 → 1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Changelog.txt +9 -0
- data/Gemfile +16 -18
- data/README.markdown +20 -13
- data/Rakefile +4 -56
- data/lib/devise/orm/mongo_mapper.rb +22 -11
- data/lib/mm-devise/version.rb +1 -1
- data/mm-devise.gemspec +17 -98
- data/test/orm/mongo_mapper.rb +5 -25
- data/test/rails_app/app/mongo_mapper/admin.rb +3 -5
- data/test/rails_app/app/mongo_mapper/shim.rb +3 -17
- data/test/rails_app/app/mongo_mapper/user.rb +2 -17
- data/test/test_helper.rb +7 -6
- metadata +52 -172
- data/.document +0 -5
- data/.gitignore +0 -5
- data/lib/devise/orm/mongo_mapper/compatibility.rb +0 -89
- data/lib/devise/orm/mongo_mapper/date_time.rb +0 -14
- data/lib/devise/orm/mongo_mapper/mm-validations.rb +0 -91
- data/lib/devise/orm/mongo_mapper/schema.rb +0 -86
- data/lib/devise/orm/mongo_mapper_active_model.rb +0 -68
- data/test/orm/mongo_mapper_active_model.rb +0 -8
- data/test/overrides/mm_validations_test.rb +0 -46
- data/test/overrides/mongo_mapper_test.rb +0 -48
- data/test/rails_app/app/mongo_mapper_active_model/admin.rb +0 -13
- data/test/rails_app/app/mongo_mapper_active_model/user.rb +0 -13
@@ -2,25 +2,10 @@ require 'shared_user'
|
|
2
2
|
|
3
3
|
class User
|
4
4
|
include MongoMapper::Document
|
5
|
+
include Shim
|
6
|
+
include SharedUser
|
5
7
|
|
6
8
|
key :username, String
|
7
9
|
key :facebook_token, String
|
8
10
|
timestamps!
|
9
|
-
|
10
|
-
include SharedUser
|
11
|
-
include Shim
|
12
|
-
|
13
|
-
unless DEVISE_ORM == :mongo_mapper_active_model
|
14
|
-
before_validation :update_password_confirmation
|
15
|
-
|
16
|
-
# DM's validates_confirmation_of requires the confirmation field to be present,
|
17
|
-
# while ActiveModel by default skips the confirmation test if the confirmation
|
18
|
-
# value is nil. This test takes advantage of AM's behavior, so just add the
|
19
|
-
# :password_confirmation value.
|
20
|
-
def update_password_confirmation
|
21
|
-
if self.password && self.password_confirmation.nil?
|
22
|
-
self.password_confirmation = self.password
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
11
|
end
|
data/test/test_helper.rb
CHANGED
@@ -8,19 +8,20 @@ require "rails_app/config/environment"
|
|
8
8
|
require "rails/test_help"
|
9
9
|
require "orm/#{DEVISE_ORM}"
|
10
10
|
|
11
|
-
MongoMapper.connection = Mongo::Connection.new(ENV['MONGO_RUBY_DRIVER_HOST'] || 'localhost')
|
12
|
-
MongoMapper.database = 'mm-devise-db'
|
13
|
-
|
14
11
|
I18n.load_path << "#{DEVISE_PATH}/test/support/locale/en.yml"
|
15
|
-
require 'mocha'
|
16
12
|
|
13
|
+
require 'mocha'
|
14
|
+
require 'webrat'
|
17
15
|
Webrat.configure do |config|
|
18
16
|
config.mode = :rails
|
19
17
|
config.open_error_files = false
|
20
18
|
end
|
21
19
|
|
22
|
-
#Devise::Oauth.test_mode!
|
23
|
-
|
24
20
|
# Add support to load paths so we can overwrite broken webrat setup
|
25
21
|
$:.unshift "#{DEVISE_PATH}/test/support"
|
26
22
|
Dir["#{DEVISE_PATH}/test/support/**/*.rb"].each { |f| require f }
|
23
|
+
|
24
|
+
# For generators
|
25
|
+
require "rails/generators/test_case"
|
26
|
+
require "generators/devise/install_generator"
|
27
|
+
require "generators/devise/views_generator"
|
metadata
CHANGED
@@ -1,223 +1,103 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: mm-devise
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 1
|
7
|
-
- 1
|
8
|
-
- 10
|
9
|
-
version: 1.1.10
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '1.2'
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Kristian Mandrup
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-06-01 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: mongo_mapper
|
22
|
-
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
|
-
requirements:
|
26
|
-
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 0
|
30
|
-
- 8
|
31
|
-
- 4
|
32
|
-
version: 0.8.4
|
33
|
-
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: bson
|
37
|
-
prerelease: false
|
38
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ">="
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
segments:
|
44
|
-
- 1
|
45
|
-
- 0
|
46
|
-
- 9
|
47
|
-
version: 1.0.9
|
48
|
-
type: :runtime
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: rails3-generators
|
52
|
-
prerelease: false
|
53
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &2153491700 !ruby/object:Gem::Requirement
|
54
17
|
none: false
|
55
|
-
requirements:
|
56
|
-
- -
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
- 0
|
60
|
-
- 13
|
61
|
-
- 0
|
62
|
-
version: 0.13.0
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.9.0
|
63
22
|
type: :runtime
|
64
|
-
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: jnunemaker-validatable
|
67
23
|
prerelease: false
|
68
|
-
|
69
|
-
|
70
|
-
requirements:
|
71
|
-
- - ">="
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
segments:
|
74
|
-
- 1
|
75
|
-
- 8
|
76
|
-
- 1
|
77
|
-
version: 1.8.1
|
78
|
-
type: :runtime
|
79
|
-
version_requirements: *id004
|
80
|
-
- !ruby/object:Gem::Dependency
|
24
|
+
version_requirements: *2153491700
|
25
|
+
- !ruby/object:Gem::Dependency
|
81
26
|
name: devise
|
82
|
-
|
83
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
27
|
+
requirement: &2153491200 !ruby/object:Gem::Requirement
|
84
28
|
none: false
|
85
|
-
requirements:
|
86
|
-
- -
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
|
89
|
-
- 1
|
90
|
-
- 1
|
91
|
-
- 1
|
92
|
-
version: 1.1.1
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '1.2'
|
93
33
|
type: :runtime
|
94
|
-
version_requirements: *id005
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
|
-
name: sugar-high
|
97
34
|
prerelease: false
|
98
|
-
|
35
|
+
version_requirements: *2153491200
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: sugar-high
|
38
|
+
requirement: &2153490740 !ruby/object:Gem::Requirement
|
99
39
|
none: false
|
100
|
-
requirements:
|
40
|
+
requirements:
|
101
41
|
- - ~>
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
|
104
|
-
- 0
|
105
|
-
- 3
|
106
|
-
- 0
|
107
|
-
version: 0.3.0
|
108
|
-
type: :runtime
|
109
|
-
version_requirements: *id006
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: warden
|
112
|
-
prerelease: false
|
113
|
-
requirement: &id007 !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
|
-
requirements:
|
116
|
-
- - ">="
|
117
|
-
- !ruby/object:Gem::Version
|
118
|
-
segments:
|
119
|
-
- 0
|
120
|
-
- 10
|
121
|
-
- 7
|
122
|
-
version: 0.10.7
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.4.3
|
123
44
|
type: :runtime
|
124
|
-
version_requirements: *id007
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: bcrypt-ruby
|
127
45
|
prerelease: false
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
segments:
|
134
|
-
- 2
|
135
|
-
- 1
|
136
|
-
- 2
|
137
|
-
version: 2.1.2
|
138
|
-
type: :runtime
|
139
|
-
version_requirements: *id008
|
140
|
-
description: dm-devise adds MongoMapper support to devise (http://github.com/plataformatec/devise) for authentication support for Rails
|
141
|
-
email: jmorgan@morgancreative.net
|
46
|
+
version_requirements: *2153490740
|
47
|
+
description: dm-devise adds MongoMapper support to devise (http://github.com/plataformatec/devise)
|
48
|
+
for authentication support for Rails
|
49
|
+
email: kmandrup@gmail.com
|
142
50
|
executables: []
|
143
|
-
|
144
51
|
extensions: []
|
145
|
-
|
146
|
-
|
147
|
-
- LICENSE
|
148
|
-
- README.markdown
|
149
|
-
files:
|
150
|
-
- .document
|
151
|
-
- .gitignore
|
152
|
-
- Gemfile
|
153
|
-
- LICENSE
|
154
|
-
- README.markdown
|
155
|
-
- Rakefile
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
156
54
|
- lib/devise/orm/mongo_mapper.rb
|
157
|
-
- lib/devise/orm/mongo_mapper/compatibility.rb
|
158
|
-
- lib/devise/orm/mongo_mapper/date_time.rb
|
159
|
-
- lib/devise/orm/mongo_mapper/mm-validations.rb
|
160
|
-
- lib/devise/orm/mongo_mapper/schema.rb
|
161
|
-
- lib/devise/orm/mongo_mapper_active_model.rb
|
162
55
|
- lib/generators/mongo_mapper/devise_generator.rb
|
163
56
|
- lib/mm-devise/version.rb
|
57
|
+
- Changelog.txt
|
164
58
|
- mm-devise.gemspec
|
59
|
+
- Gemfile
|
60
|
+
- LICENSE
|
61
|
+
- Rakefile
|
62
|
+
- README.markdown
|
165
63
|
- test/mongo_mapper/compatibility_test.rb
|
166
64
|
- test/orm/mongo_mapper.rb
|
167
|
-
- test/orm/mongo_mapper_active_model.rb
|
168
|
-
- test/overrides/mm_validations_test.rb
|
169
|
-
- test/overrides/mongo_mapper_test.rb
|
170
65
|
- test/rails_app/app/mongo_mapper/admin.rb
|
171
66
|
- test/rails_app/app/mongo_mapper/shim.rb
|
172
67
|
- test/rails_app/app/mongo_mapper/user.rb
|
173
|
-
- test/rails_app/app/mongo_mapper_active_model/admin.rb
|
174
|
-
- test/rails_app/app/mongo_mapper_active_model/user.rb
|
175
68
|
- test/rails_app/config/application.rb
|
176
69
|
- test/rails_app/config/environment.rb
|
177
70
|
- test/test_helper.rb
|
178
|
-
has_rdoc: true
|
179
71
|
homepage: http://github.com/kristianmandrup/mm-devise
|
180
72
|
licenses: []
|
181
|
-
|
182
73
|
post_install_message:
|
183
|
-
rdoc_options:
|
184
|
-
|
185
|
-
require_paths:
|
74
|
+
rdoc_options: []
|
75
|
+
require_paths:
|
186
76
|
- lib
|
187
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
188
78
|
none: false
|
189
|
-
requirements:
|
190
|
-
- -
|
191
|
-
- !ruby/object:Gem::Version
|
192
|
-
|
193
|
-
|
194
|
-
version: "0"
|
195
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ! '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
196
84
|
none: false
|
197
|
-
requirements:
|
198
|
-
- -
|
199
|
-
- !ruby/object:Gem::Version
|
200
|
-
|
201
|
-
- 0
|
202
|
-
version: "0"
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
203
89
|
requirements: []
|
204
|
-
|
205
90
|
rubyforge_project:
|
206
|
-
rubygems_version: 1.
|
91
|
+
rubygems_version: 1.8.5
|
207
92
|
signing_key:
|
208
93
|
specification_version: 3
|
209
94
|
summary: Support for using MongoMapper ORM with devise
|
210
|
-
test_files:
|
95
|
+
test_files:
|
211
96
|
- test/mongo_mapper/compatibility_test.rb
|
212
97
|
- test/orm/mongo_mapper.rb
|
213
|
-
- test/orm/mongo_mapper_active_model.rb
|
214
|
-
- test/overrides/mm_validations_test.rb
|
215
|
-
- test/overrides/mongo_mapper_test.rb
|
216
98
|
- test/rails_app/app/mongo_mapper/admin.rb
|
217
99
|
- test/rails_app/app/mongo_mapper/shim.rb
|
218
100
|
- test/rails_app/app/mongo_mapper/user.rb
|
219
|
-
- test/rails_app/app/mongo_mapper_active_model/admin.rb
|
220
|
-
- test/rails_app/app/mongo_mapper_active_model/user.rb
|
221
101
|
- test/rails_app/config/application.rb
|
222
102
|
- test/rails_app/config/environment.rb
|
223
103
|
- test/test_helper.rb
|
data/.document
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
module Devise
|
2
|
-
module Orm
|
3
|
-
module MongoMapper
|
4
|
-
module Compatibility
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
|
7
|
-
extend ActiveSupport::Concern
|
8
|
-
extend ActiveModel::Naming
|
9
|
-
|
10
|
-
include ActiveModel::Serializers::Xml
|
11
|
-
include ActiveModel::Serializers::JSON
|
12
|
-
|
13
|
-
def to_xml(options = {}, &block)
|
14
|
-
options[:except] ||= []
|
15
|
-
options[:except] << :_id
|
16
|
-
|
17
|
-
super options do |b|
|
18
|
-
b.id self.id
|
19
|
-
block.call(b) if block_given?
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
module ClassMethods
|
25
|
-
# Hooks for confirmable
|
26
|
-
def before_create(*args)
|
27
|
-
wrap_hook(:before, :create, *args)
|
28
|
-
end
|
29
|
-
|
30
|
-
def after_create(*args)
|
31
|
-
wrap_hook(:after, :create, *args)
|
32
|
-
end
|
33
|
-
|
34
|
-
def before_save(*args)
|
35
|
-
wrap_hook(:before, :save, *args)
|
36
|
-
end
|
37
|
-
|
38
|
-
def wrap_hook(action, method, *args)
|
39
|
-
options = args.extract_options!
|
40
|
-
|
41
|
-
args.each do |callback|
|
42
|
-
callback_method = :"#{callback}_callback_wrap"
|
43
|
-
send action, method, callback_method
|
44
|
-
class_eval <<-METHOD, __FILE__, __LINE__ + 1
|
45
|
-
def #{callback_method}
|
46
|
-
#{callback} if #{options[:if] || true}
|
47
|
-
end
|
48
|
-
METHOD
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
# Add ActiveRecord like finder
|
53
|
-
def find(*args)
|
54
|
-
case args.first
|
55
|
-
when :first, :all
|
56
|
-
send(args.shift, *args)
|
57
|
-
else
|
58
|
-
where(:'_id' => args.first).first
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
# def changed?
|
64
|
-
# dirty?
|
65
|
-
# end
|
66
|
-
=begin
|
67
|
-
def save(options=nil)
|
68
|
-
if options.is_a?(Hash) && options[:validate] == false
|
69
|
-
save!
|
70
|
-
else
|
71
|
-
super()
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
def update_attribute(name, value)
|
76
|
-
update_attributes(name => value)
|
77
|
-
end
|
78
|
-
#
|
79
|
-
# def update_attributes(*args)
|
80
|
-
# update(*args)
|
81
|
-
# end
|
82
|
-
=end
|
83
|
-
def invalid?
|
84
|
-
!valid?
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|