mm-devise 1.2 → 1.3
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/Gemfile +0 -2
- data/README.markdown +25 -41
- data/lib/generators/mongo_mapper/devise_generator.rb +3 -6
- data/lib/mm-devise/version.rb +1 -1
- data/mm-devise.gemspec +0 -3
- metadata +5 -16
data/Gemfile
CHANGED
data/README.markdown
CHANGED
@@ -1,66 +1,50 @@
|
|
1
1
|
# MongoMapper for Devise
|
2
2
|
|
3
|
-
|
3
|
+
`mm-devise` will let you use [devise](http://github.com/plataformatec/devise) with [MongoMapper](http://github.com/jnunemaker/mongomapper).
|
4
4
|
|
5
|
-
|
5
|
+
`mm-devise` is intended for use with `Rails 3+` and `Devise 1.2` and above. It may work with earlier versions of devise.
|
6
6
|
|
7
|
-
This README only covers
|
7
|
+
This README only covers `mm-devise` specifics. Make sure to read the [devise README](http://github.com/plataformatec/devise/blob/master/README.rdoc)
|
8
8
|
|
9
9
|
## Status update, June 2011
|
10
10
|
|
11
|
-
Recently upgraded to (hopefully!) support Devise > 1.2 and MongoMapper 0.9.0.
|
12
|
-
|
13
|
-
## Usage options
|
14
|
-
|
15
|
-
The gem gives you the options of 2 ORM setups depending on what library you wish to use for validations:
|
16
|
-
|
17
|
-
* *mongo_mapper* - Uses MongoMapper validations
|
18
|
-
* *mongo_mapper_active_model* - Uses ActiveModel::Validations
|
19
|
-
|
20
|
-
The advantage to this is ActiveModel's I18n support for error messages, and it uses the same validations lib as devise does by default.
|
21
|
-
|
22
|
-
## ActiveModel compatibility
|
23
|
-
|
24
|
-
Currently only the <code>mongo_mapper</code> option has been tested.
|
25
|
-
There should be full ActiveModel support in a future version of MongoMapper, after Rails 3 is released.
|
26
|
-
ActiveModel support will likely be part of *MongoMapper 1.0* (as mentioned by jnunemaker in a post).
|
11
|
+
Recently upgraded to (hopefully!) support Devise > 1.2 and MongoMapper 0.9.0.
|
27
12
|
|
28
13
|
## Installation
|
29
14
|
|
30
|
-
Add
|
15
|
+
Add `devise`, `mm-devise` and `mongo_mapper` gems to your Gemfile (your Rails app Gemfile).
|
31
16
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
gem 'mm-devise', '>= 1.2'
|
36
|
-
</pre>
|
17
|
+
gem 'mongo_mapper', '~> 0.9.0'
|
18
|
+
# You'll want this to for better mongo driver performance
|
19
|
+
gem 'bson_ext'
|
37
20
|
|
38
|
-
|
21
|
+
gem 'devise', '~> 1.3.4'
|
22
|
+
gem 'mm-devise', '~> 1.2.0'
|
39
23
|
|
40
|
-
|
24
|
+
Use bundler to install all required gems in your Rails 3 app
|
41
25
|
|
42
|
-
|
26
|
+
bundle install
|
43
27
|
|
44
|
-
|
28
|
+
Run the devise install generator, followed by the mm-devise model generator:
|
45
29
|
|
46
|
-
|
47
|
-
|
48
|
-
either <code>mongo_mapper</code> or <code>mongo_mapper_active_model</code> (ActiveModel::Validations)
|
49
|
-
as the orm in the configuration file.
|
30
|
+
rails generate devise:install
|
31
|
+
rails generate mongo_mapper:devise MODEL
|
50
32
|
|
51
|
-
|
33
|
+
The devise install generator will install an initializer
|
34
|
+
(`config/inititializer/devise.rb`) which describes ALL Devise's configuration
|
35
|
+
options and you MUST take a look at it. Maker sure this line exists:
|
52
36
|
|
53
|
-
|
37
|
+
require 'devise/orm/mongo_mapper'
|
54
38
|
|
55
|
-
|
39
|
+
NOTE: The model generator should do this automatically.
|
56
40
|
|
57
41
|
To add Devise to any of your models using the generator:
|
58
42
|
|
59
|
-
|
43
|
+
rails generate mongo_mapper:devise MODEL
|
60
44
|
|
61
|
-
Example: create a User model for use with Devise
|
45
|
+
Example: create a User model for use with Devise
|
62
46
|
|
63
|
-
|
47
|
+
rails generate mongo_mapper:devise User
|
64
48
|
|
65
49
|
Read the README for devise at [devise README](http://github.com/plataformatec/devise/blob/master/README.rdoc)
|
66
50
|
|
@@ -73,7 +57,7 @@ In the same container folder clone <code>devise</code> from github
|
|
73
57
|
Example:
|
74
58
|
|
75
59
|
<pre>git clone http://github.com/kristianmandrup/mm-devise.git
|
76
|
-
git clone http://github.com/plataformatec/devise.git
|
60
|
+
git clone http://github.com/plataformatec/devise.git
|
77
61
|
cd mm-devise
|
78
62
|
bundle install
|
79
63
|
rake test</pre>
|
@@ -87,7 +71,7 @@ rake test</pre>
|
|
87
71
|
<pre>$ gem push pkg/mm-devis-xxxx.gem</pre>
|
88
72
|
|
89
73
|
## Note on Patches/Pull Requests
|
90
|
-
|
74
|
+
|
91
75
|
* Fork the project.
|
92
76
|
* Make your feature addition or bug fix.
|
93
77
|
* Add tests for it. This is important so I don't break it in a
|
@@ -1,6 +1,4 @@
|
|
1
1
|
require 'generators/devise/orm_helpers'
|
2
|
-
require 'sugar-high/file'
|
3
|
-
require 'sugar-high/file_mutate'
|
4
2
|
|
5
3
|
module MongoMapper
|
6
4
|
module Generators
|
@@ -11,13 +9,12 @@ module MongoMapper
|
|
11
9
|
invoke "mongo_mapper:model", [name] unless model_exists?
|
12
10
|
end
|
13
11
|
|
14
|
-
def inject_devise_content
|
12
|
+
def inject_devise_content
|
15
13
|
inject_into_file model_path, model_contents, :after => "include MongoMapper::Document\n"
|
16
14
|
end
|
17
15
|
|
18
|
-
def replace_default_devise_orm
|
19
|
-
|
20
|
-
File.replace_content_from devise_init_file, :where => 'orm/active_record', :with => 'orm/mongo_mapper'
|
16
|
+
def replace_default_devise_orm
|
17
|
+
gsub_file Rails.root.join("config/initializers/devise.rb"), 'orm/active_record', 'orm/mongo_mapper'
|
21
18
|
end
|
22
19
|
end
|
23
20
|
end
|
data/lib/mm-devise/version.rb
CHANGED
data/mm-devise.gemspec
CHANGED
@@ -16,8 +16,5 @@ Gem::Specification.new do |s|
|
|
16
16
|
|
17
17
|
s.add_dependency 'mongo_mapper', '>= 0.9.0'
|
18
18
|
s.add_dependency 'devise', '>= 1.2'
|
19
|
-
# s.add_dependency 'rails3-generators', '>= 0.14.0'
|
20
|
-
s.add_dependency 'sugar-high', '~> 0.4.3'
|
21
19
|
s.add_dependency "SystemTimer", "~> 1.2" if RUBY_VERSION < "1.9"
|
22
|
-
|
23
20
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mm-devise
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '1.
|
4
|
+
version: '1.3'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2011-06-01 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mongo_mapper
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153906760 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.9.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2153906760
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: devise
|
27
|
-
requirement: &
|
27
|
+
requirement: &2153934140 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,18 +32,7 @@ dependencies:
|
|
32
32
|
version: '1.2'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: sugar-high
|
38
|
-
requirement: &2153490740 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
version: 0.4.3
|
44
|
-
type: :runtime
|
45
|
-
prerelease: false
|
46
|
-
version_requirements: *2153490740
|
35
|
+
version_requirements: *2153934140
|
47
36
|
description: dm-devise adds MongoMapper support to devise (http://github.com/plataformatec/devise)
|
48
37
|
for authentication support for Rails
|
49
38
|
email: kmandrup@gmail.com
|