Permalink
Browse files

first commit

  • Loading branch information...
0 parents commit b7f7c71958f1c9e7acede3d309f8a5ea44fd9767 @shenoudab committed Aug 13, 2010
@@ -0,0 +1,7 @@
+.bundle/
+log/*.log
+pkg/
+nbproject/
+test/dummy/db/*.sqlite3
+test/dummy/log/*.log
+test/dummy/tmp/
@@ -0,0 +1,19 @@
+source 'http://rubygems.org'
+
+#gem 'rails', '3.0.0.rc'
+gem 'rails', :git => 'git://github.com/rails/rails.git'
+
+gem 'warden'
+gem 'devise', :git => 'git://github.com/plataformatec/devise.git'
+
+gem 'couchrest'
+gem 'couchrest_extended_document'
+gem 'couchrest_model'
+
+gem 'oauth2'
+
+gem 'rails3-generators', :git => 'git://github.com/shenoudab/rails3-generators.git'
+
+gem 'webrat', '0.7.0'
+gem 'mocha', :require => false
+gem 'bcrypt-ruby', :require => 'bcrypt'
@@ -0,0 +1,128 @@
+GIT
+ remote: git://github.com/plataformatec/devise.git
+ revision: 701bbf2
+ specs:
+ devise (1.2.0)
+ bcrypt-ruby (~> 2.1.2)
+ warden (~> 0.10.7)
+
+GIT
+ remote: git://github.com/rails/rails.git
+ revision: 2a98480
+ specs:
+ actionmailer (3.0.0.rc)
+ actionpack (= 3.0.0.rc)
+ mail (~> 2.2.5)
+ actionpack (3.0.0.rc)
+ activemodel (= 3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ builder (~> 2.1.2)
+ erubis (~> 2.6.6)
+ i18n (~> 0.4.1)
+ rack (~> 1.2.1)
+ rack-mount (~> 0.6.9)
+ rack-test (~> 0.5.4)
+ tzinfo (~> 0.3.22)
+ activemodel (3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ builder (~> 2.1.2)
+ i18n (~> 0.4.1)
+ activerecord (3.0.0.rc)
+ activemodel (= 3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ arel (~> 0.4.0)
+ tzinfo (~> 0.3.22)
+ activeresource (3.0.0.rc)
+ activemodel (= 3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ activesupport (3.0.0.rc)
+ rails (3.0.0.rc)
+ actionmailer (= 3.0.0.rc)
+ actionpack (= 3.0.0.rc)
+ activerecord (= 3.0.0.rc)
+ activeresource (= 3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ bundler (>= 1.0.0.rc.2)
+ railties (= 3.0.0.rc)
+ railties (3.0.0.rc)
+ actionpack (= 3.0.0.rc)
+ activesupport (= 3.0.0.rc)
+ rake (>= 0.8.3)
+ thor (~> 0.14.0)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ abstract (1.0.0)
+ addressable (2.2.0)
+ arel (0.4.0)
+ activesupport (>= 3.0.0.beta)
+ bcrypt-ruby (2.1.2)
+ builder (2.1.2)
+ couchrest (1.0.0)
+ json (= 1.2.4)
+ mime-types (>= 1.15)
+ rest-client (>= 0.5)
+ couchrest_extended_document (1.0.0)
+ activesupport (>= 2.3.0)
+ builder (>= 2.1.2)
+ couchrest (>= 1.0.0)
+ mime-types (>= 1.15)
+ couchrest_model (1.0.0.beta7)
+ activemodel (>= 3.0.0.beta4)
+ activesupport (>= 2.3.5)
+ couchrest (>= 1.0.0.beta)
+ mime-types (>= 1.15)
+ erubis (2.6.6)
+ abstract (>= 1.0.0)
+ faraday (0.4.6)
+ addressable (>= 2.1.1)
+ rack (>= 1.0.1)
+ i18n (0.4.1)
+ json (1.2.4)
+ mail (2.2.5)
+ activesupport (>= 2.3.6)
+ mime-types
+ treetop (>= 1.4.5)
+ mime-types (1.16)
+ mocha (0.9.8)
+ rake
+ multi_json (0.0.4)
+ nokogiri (1.4.3.1)
+ oauth2 (0.0.10)
+ faraday (~> 0.4.1)
+ multi_json (>= 0.0.4)
+ polyglot (0.3.1)
+ rack (1.2.1)
+ rack-mount (0.6.9)
+ rack (>= 1.0.0)
+ rack-test (0.5.4)
+ rack (>= 1.0)
+ rake (0.8.7)
+ rest-client (1.6.0)
+ mime-types (>= 1.16)
+ thor (0.14.0)
+ treetop (1.4.8)
+ polyglot (>= 0.3.1)
+ tzinfo (0.3.22)
+ warden (0.10.7)
+ rack (>= 1.0.0)
+ webrat (0.7.0)
+ nokogiri (>= 1.2.0)
+ rack (>= 1.0)
+ rack-test (>= 0.5.3)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ bcrypt-ruby
+ couchrest
+ couchrest_extended_document
+ couchrest_model
+ devise!
+ mocha
+ oauth2
+ rails!
+ warden
+ webrat (= 0.7.0)
@@ -0,0 +1,20 @@
+Copyright 2010 YOURNAME
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,86 @@
+# DeviseCouch for Devise and CouchrestModel
+
+*devise_couch* will let you use [devise](http://github.com/plataformatec/devise) with [CocuhrestModel](http://github.com/couchrest/couchrest_model).
+
+*devise_couch* is intended for use with *Rails 3* and *Devise 1.1.1*. It may work with earlier versions of devise, but it's not been tested.
+
+This README only covers *devise_couch* specifics. Make sure to read the [devise README](http://github.com/plataformatec/devise/blob/master/README.rdoc)
+
+## Usage options
+
+The gem gives you the options of 2 ORM setups depending on what library you wish to use for validations:
+
+* *couchrest_model* - Uses CocuhrestModel validations
+* *couchrest_model_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.
+
+## ActiveModel compatibility
+
+Currently only the <code>couchrest_model</code> option has been tested.
+There should be full ActiveModel support in a future version of CocuhrestModel, after Rails 3 is released.
+ActiveModel support will likely be part of *CocuhrestModel 1.0* (as mentioned by jnunemaker in a post).
+
+## Installation
+
+Add *devise*, *devise_couch* and *couchrest_model* gems to your Gemfile (your Rails app Gemfile). The following gems are required
+
+<pre>
+ gem 'couchrest'
+ gem 'couchrest_extended_document'
+ gem 'couchrest_model'
+ gem 'devise'
+ gem 'devise_couch'
+ gem 'rails3-generators', :git => 'git://github.com/shenoudab/rails3-generators.git'
+</pre>
+
+<pre>gem install rails3-generators</pre>
+
+Alternatively use bundler to install all required gems in your Rails 3 app
+
+<pre>bundle install</pre>
+
+Run the generator:
+
+<pre>rails generate devise:install</pre>
+
+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:
+
+<pre>rails generate couchrest_model:devise MODEL</pre>
+
+Example: create a User model for use with Devise
+
+<pre>rails generate couchrest_model:devise User</pre>
+
+Read the README for devise at [devise README](http://github.com/plataformatec/devise/blob/master/README.rdoc)
+
+## 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.
+
+## Thanks
+
+*Kristian Mandrup* - - Created the mm-devise gem which was used as a template for the development of this gem.
+Also made suggestions for a few critical fixes and improvements in the code. Thanks :)
+
+*Jared Morgan* - Created the dm-devise gem which was used as a template for the development of this gem.
+Also made suggestions for a few critical fixes and improvements in the code. Thanks :)
+
+## Bugs and Feedback
+
+For *devise_couch* specific issues, please create an issue on GitHub at: [devise_couch issues](http://github.com/shenoudab/devise_couch/issues)
+
+## Copyright
+
+Copyright (c) 2010 Shenouda Bertel MobiThought. See LICENSE for details.
@@ -0,0 +1,60 @@
+# encoding: UTF-8
+require 'rake'
+require 'rake/rdoctask'
+require 'rake/gempackagetask'
+require 'rake/testtask'
+require File.join(File.dirname(__FILE__), 'lib', 'devise_couch', 'version')
+
+desc 'Default: run tests for all CouchDB ORM setups.'
+task :default => :pre_commit
+
+desc 'Run Devise tests for all CouchDB ORM setups.'
+task :pre_commit do
+ Dir[File.join(File.dirname(__FILE__), 'test', 'orm', '*.rb')].each do |file|
+ orm = File.basename(file).split(".").first
+ ENV['DEVISE_PATH'] ||= File.expand_path('../devise')
+ system "rake test DEVISE_ORM=#{orm} DEVISE_PATH=#{ENV['DEVISE_PATH']}"
+ end
+end
+
+desc 'Run Devise tests using CouchDB. Specify path to devise with DEVISE_PATH'
+Rake::TestTask.new(:test) do |test|
+ ENV['DEVISE_ORM'] ||= 'couchrest_model'
+ ENV['DEVISE_PATH'] ||= File.expand_path('./')
+ unless File.exist?(ENV['DEVISE_PATH'])
+ puts "Specify the path to devise (e.g. rake DEVISE_PATH=/path/to/devise). Not found at #{ENV['DEVISE_PATH']}"
+ exit
+ end
+ test.libs << 'lib' << 'test'
+ test.libs << "#{ENV['DEVISE_PATH']}/lib"
+ test.libs << "#{ENV['DEVISE_PATH']}/test"
+ test.test_files = FileList["#{ENV['DEVISE_PATH']}/test/**/*_test.rb"] + FileList['test/**/*_test.rb']
+ test.verbose = true
+end
+
+Rake::RDocTask.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'DeviseCouch'
+ rdoc.options << '--line-numbers' << '--inline-source'
+ rdoc.rdoc_files.include('README.rdoc')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
+
+spec = Gem::Specification.new do |s|
+ s.name = "devise_couch"
+ s.summary = "CouchDB integration for Devise framework."
+ s.description = "CouchDB integration for Devise framework."
+ s.files = FileList["[A-Z]*", "{app,config,lib}/**/*"]
+ s.version = CouchrestModel::Devise::VERSION.dup
+ s.email = "sbertel@mobithought.com"
+ s.homepage = "http://github.com/shenoudab/devise_couch"
+ s.author = 'Shenouda Bertel'
+end
+
+Rake::GemPackageTask.new(spec) do |pkg|
+end
+
+desc "Install the gem #{spec.name}-#{spec.version}.gem"
+task :install do
+ system("gem install pkg/#{spec.name}-#{spec.version}.gem --no-ri --no-rdoc")
+end
@@ -0,0 +1,40 @@
+require "couchrest/model/base"
+
+module Devise
+ module Orm
+ module CouchrestModel
+ module Hook
+ def devise_modules_hook!
+ extend Schema
+ #Include Compatibility
+ yield
+ return unless Devise.apply_schema
+ devise_modules.each { |m| send(m) if respond_to?(m, true) }
+ end
+ end #Hook
+ module Schema
+ include Devise::Schema
+ # Tell how to apply schema methods.
+ def apply_schema(name, type, options={})
+ return unless Devise.apply_schema
+ property name, :type => type
+ end
+ end #Module Schema
+ end #CouchRest
+ end #Orm
+end #Devise
+
+#CouchRest::Model::Base.send(:extend, Devise::Models)
+#CouchRest::Model::Base.send(:include, Devise::Models)
+
+#CouchRest::Model::Base.append_extensions(Devise::Models)
+#CouchRest::Model::Base.append_extensions(Devise::Orm::CouchrestModel::Hook)
+
+module CouchRest
+ module Model
+ class Base
+ extend ::Devise::Models
+ extend ::Devise::Orm::CouchrestModel::Hook
+ end
+ end
+end
Oops, something went wrong.

0 comments on commit b7f7c71

Please sign in to comment.