Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9d9a19
commit 003eda0
Showing
2 changed files
with
212 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# MongoMapper for Devise | ||
|
||
*mm-devise* will let you use [devise](http://github.com/plataformatec/devise) with [MongoMapper](http://github.com/jnunemaker/mongomapper). | ||
|
||
The gem gives you the options of 2 ORM setups depending on what library you wish to use for validations: | ||
|
||
:mongo_mapper:: | ||
Uses MongoMapper validations. | ||
:mongo_mapper_active_model:: | ||
Uses ActiveModel::Validations. | ||
|
||
The advantage to this is ActiveModel's I18n support for error messages, and | ||
it uses the same validations lib as devise does by default. | ||
|
||
Currently only the <code>mongo_mapper</code> option has been tested. | ||
|
||
There should be full ActiveModel support in a future version of MongoMapper, after Rails 3 is released. | ||
ActiveModel support will likely be part of *MongoMapper 1.0* (as mentioned by jnunemaker in a post). | ||
|
||
*mm-devise* is intended for use with *Rails 3* and *Devise 1.1.1* It may work with earlier versions, but it's not been tested | ||
|
||
This README only covers *mm-devise* specifics. | ||
Make sure to read the devise README http://github.com/plataformatec/devise/blob/master/README.rdoc | ||
|
||
## Installation | ||
|
||
Add devise, mm-devise and MongoMapper gems to your Gemfile. The following gems are required | ||
|
||
gem 'mongo_mapper', '>= 0.8.2' | ||
gem 'jnunemaker-validatable', '>= 1.8.4' | ||
gem 'bson_ext', '>= 1.0.4' | ||
gem 'devise', '~> 1.1.1' | ||
gem 'mm-devise', '>= 1.1.0' | ||
gem 'rails3-generators', '>= 0.12.1' | ||
|
||
You can install http://github.com/indirect/rails3-generators which includes mongo_mapper Model generator | ||
|
||
gem install rails3-generators | ||
|
||
Alternatively use bundler to install all required gems in your rails app | ||
|
||
bundle install | ||
|
||
Run the generator: | ||
|
||
rails generate devise:install | ||
|
||
The generator will install an initializer which describes ALL Devise's | ||
configuration options and you MUST take a look at it. Make sure to specify | ||
either <code>mongo_mapper</code> or <code>mongo_mapper_active_model</code> (ActiveModel::Validations) | ||
as the orm in the configuration file. | ||
|
||
To add Devise to any of your models using the generator: | ||
|
||
rails generate mongo_mapper:devise MODEL | ||
|
||
Read the README for devise at http://github.com/plataformatec/devise/blob/master/README.rdoc | ||
|
||
## Test Driven Development - extending this project | ||
|
||
To develop on this project using TDD, requires the following setup. | ||
Clone this project into a container folder, fx <code>/projects</code>, so you have fx <code>/projects/mm-devise</code> | ||
In the same container folder clone <code>devise</code> from github | ||
|
||
Example: | ||
|
||
projects $ git clone [repo]\mm-devise.git | ||
projects $ git clone [repo]\devise.git | ||
projects $ cd mm-devise | ||
projects $ bundle install | ||
projects $ rake test</pre> | ||
|
||
If you run <code>$ rake test</code>, you will currently (Aug 6) still get a few errors and failures. | ||
This is NOT due to any errors in <code>mm-devise</code>, but rather to a few "issues" with the devise tests themselves IMO. | ||
|
||
## TODO | ||
|
||
* Example app | ||
* Rails templates | ||
|
||
## Note on Patches/Pull Requests | ||
|
||
* Fork the project. | ||
* Make your feature addition or bug fix. | ||
* Add tests for it. This is important so I don't break it in a | ||
future version unintentionally. | ||
* Commit, do not mess with rakefile, version, or history. | ||
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) | ||
* Send me a pull request. Bonus points for topic branches. | ||
|
||
## Maintainers | ||
|
||
*Kristian Mandrup* | ||
|
||
## Contributors | ||
|
||
*Jared Morgan* | ||
Created the dm-devise gem which was used as a template for the development of this gem | ||
Also came with suggestions for a few critical fixes and improvements in the code. Thanks :) | ||
|
||
## Bugs and Feedback | ||
|
||
For mm-devise specific issues, please create an issue on GitHub at: | ||
|
||
[mm-devise issues](http://github.com/kristianmandrup/mm-devise/issues) | ||
|
||
## Copyright | ||
|
||
Copyright (c) 2010 Kristian Mandrup. See LICENSE for details. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
# Generated by jeweler | ||
# DO NOT EDIT THIS FILE DIRECTLY | ||
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command | ||
# -*- encoding: utf-8 -*- | ||
|
||
Gem::Specification.new do |s| | ||
s.name = %q{mm-devise} | ||
s.version = "1.1.1" | ||
|
||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= | ||
s.authors = ["Kristian Mandrup"] | ||
s.date = %q{2010-08-07} | ||
s.description = %q{dm-devise adds MongoMapper support to devise (http://github.com/plataformatec/devise) for authentication support for Rails} | ||
s.email = %q{jmorgan@morgancreative.net} | ||
s.extra_rdoc_files = [ | ||
"LICENSE", | ||
"README.rdoc" | ||
] | ||
s.files = [ | ||
".document", | ||
".gitignore", | ||
"Gemfile", | ||
"Gemfile.lock", | ||
"LICENSE", | ||
"README.rdoc", | ||
"Rakefile", | ||
"lib/devise/orm/mongo_mapper.rb", | ||
"lib/devise/orm/mongo_mapper/compatibility.rb", | ||
"lib/devise/orm/mongo_mapper/date_time.rb", | ||
"lib/devise/orm/mongo_mapper/mm-validations.rb", | ||
"lib/devise/orm/mongo_mapper/schema.rb", | ||
"lib/devise/orm/mongo_mapper_active_model.rb", | ||
"lib/generators/mongo_mapper/devise_generator.rb", | ||
"lib/mm-devise/version.rb", | ||
"test/mongo_mapper/compatibility_test.rb", | ||
"test/orm/mongo_mapper.rb", | ||
"test/orm/mongo_mapper_active_model.rb", | ||
"test/overrides/mm_validations_test.rb", | ||
"test/overrides/mongo_mapper_test.rb", | ||
"test/rails_app/app/mongo_mapper/admin.rb", | ||
"test/rails_app/app/mongo_mapper/shim.rb", | ||
"test/rails_app/app/mongo_mapper/user.rb", | ||
"test/rails_app/app/mongo_mapper_active_model/admin.rb", | ||
"test/rails_app/app/mongo_mapper_active_model/user.rb", | ||
"test/rails_app/config/application.rb", | ||
"test/rails_app/config/environment.rb", | ||
"test/test_helper.rb" | ||
] | ||
s.homepage = %q{http://github.com/kristianmandrup/mm-devise} | ||
s.rdoc_options = ["--charset=UTF-8"] | ||
s.require_paths = ["lib"] | ||
s.rubygems_version = %q{1.3.7} | ||
s.summary = %q{Support for using MongoMapper ORM with devise} | ||
s.test_files = [ | ||
"test/mongo_mapper/compatibility_test.rb", | ||
"test/orm/mongo_mapper.rb", | ||
"test/orm/mongo_mapper_active_model.rb", | ||
"test/overrides/mm_validations_test.rb", | ||
"test/overrides/mongo_mapper_test.rb", | ||
"test/rails_app/app/mongo_mapper/admin.rb", | ||
"test/rails_app/app/mongo_mapper/shim.rb", | ||
"test/rails_app/app/mongo_mapper/user.rb", | ||
"test/rails_app/app/mongo_mapper_active_model/admin.rb", | ||
"test/rails_app/app/mongo_mapper_active_model/user.rb", | ||
"test/rails_app/config/application.rb", | ||
"test/rails_app/config/environment.rb", | ||
"test/test_helper.rb" | ||
] | ||
|
||
if s.respond_to? :specification_version then | ||
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION | ||
s.specification_version = 3 | ||
|
||
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then | ||
s.add_runtime_dependency(%q<mongo_mapper>, [">= 0.8.2"]) | ||
s.add_runtime_dependency(%q<rails3-generators>, [">= 0.12.1"]) | ||
s.add_runtime_dependency(%q<jnunemaker-validatable>, [">= 1.8.4"]) | ||
s.add_runtime_dependency(%q<bson_ext>, [">= 1.0.4"]) | ||
s.add_runtime_dependency(%q<devise>, [">= 1.1.1"]) | ||
s.add_runtime_dependency(%q<warden>, ["~> 0.10.7"]) | ||
s.add_runtime_dependency(%q<bcrypt-ruby>, ["~> 2.1.2"]) | ||
else | ||
s.add_dependency(%q<mongo_mapper>, [">= 0.8.2"]) | ||
s.add_dependency(%q<rails3-generators>, [">= 0.12.1"]) | ||
s.add_dependency(%q<jnunemaker-validatable>, [">= 1.8.4"]) | ||
s.add_dependency(%q<bson_ext>, [">= 1.0.4"]) | ||
s.add_dependency(%q<devise>, [">= 1.1.1"]) | ||
s.add_dependency(%q<warden>, ["~> 0.10.7"]) | ||
s.add_dependency(%q<bcrypt-ruby>, ["~> 2.1.2"]) | ||
end | ||
else | ||
s.add_dependency(%q<mongo_mapper>, [">= 0.8.2"]) | ||
s.add_dependency(%q<rails3-generators>, [">= 0.12.1"]) | ||
s.add_dependency(%q<jnunemaker-validatable>, [">= 1.8.4"]) | ||
s.add_dependency(%q<bson_ext>, [">= 1.0.4"]) | ||
s.add_dependency(%q<devise>, [">= 1.1.1"]) | ||
s.add_dependency(%q<warden>, ["~> 0.10.7"]) | ||
s.add_dependency(%q<bcrypt-ruby>, ["~> 2.1.2"]) | ||
end | ||
end | ||
|