devise-neo4j 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
@@ -0,0 +1 @@
1
+ set autolist on
data/Gemfile ADDED
@@ -0,0 +1,25 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "rails", "3.0.4"
4
+ gem "oa-oauth", "~> 0.2.0", :require => "omniauth/oauth"
5
+ gem "oa-openid", "~> 0.2.0", :require => "omniauth/openid"
6
+
7
+ gem "devise", "1.3.4"
8
+
9
+ gem "ruby-debug", ">= 0.10.3" if RUBY_VERSION < '1.9'
10
+
11
+ group :neo4j do
12
+ #gem "neo4j", "1.1.0"
13
+ # Some fixes were required to get 1.1.0 totally working with devise-neo4j. Will look to get them pulled into the next
14
+ # gem release and will then update this gem
15
+ gem "neo4j", :git => "git://github.com/benjackson/neo4j.git", :branch => "fixes-for-devise-gem"
16
+ end
17
+
18
+ group :test do
19
+ gem "webrat", "0.7.2", :require => false
20
+ gem "mocha", :require => false
21
+ end
22
+
23
+ group :development do
24
+ gem "jeweler", :require => false
25
+ end
@@ -0,0 +1,147 @@
1
+ GIT
2
+ remote: git://github.com/benjackson/neo4j.git
3
+ revision: 5ca16715bc2a38e98ccc8dfde47510967b7c61b9
4
+ branch: fixes-for-devise-gem
5
+ specs:
6
+ neo4j (1.1.0-java)
7
+ activemodel (>= 3.0.0)
8
+ orm_adapter (>= 0.0.3)
9
+ railties (>= 3.0.0)
10
+ will_paginate (~> 3.0.pre)
11
+
12
+ GEM
13
+ remote: http://rubygems.org/
14
+ specs:
15
+ abstract (1.0.0)
16
+ actionmailer (3.0.4)
17
+ actionpack (= 3.0.4)
18
+ mail (~> 2.2.15)
19
+ actionpack (3.0.4)
20
+ activemodel (= 3.0.4)
21
+ activesupport (= 3.0.4)
22
+ builder (~> 2.1.2)
23
+ erubis (~> 2.6.6)
24
+ i18n (~> 0.4)
25
+ rack (~> 1.2.1)
26
+ rack-mount (~> 0.6.13)
27
+ rack-test (~> 0.5.7)
28
+ tzinfo (~> 0.3.23)
29
+ activemodel (3.0.4)
30
+ activesupport (= 3.0.4)
31
+ builder (~> 2.1.2)
32
+ i18n (~> 0.4)
33
+ activerecord (3.0.4)
34
+ activemodel (= 3.0.4)
35
+ activesupport (= 3.0.4)
36
+ arel (~> 2.0.2)
37
+ tzinfo (~> 0.3.23)
38
+ activeresource (3.0.4)
39
+ activemodel (= 3.0.4)
40
+ activesupport (= 3.0.4)
41
+ activesupport (3.0.4)
42
+ addressable (2.2.6)
43
+ arel (2.0.10)
44
+ bcrypt-ruby (2.1.4-java)
45
+ builder (2.1.2)
46
+ columnize (0.3.2)
47
+ devise (1.3.4)
48
+ bcrypt-ruby (~> 2.1.2)
49
+ orm_adapter (~> 0.0.3)
50
+ warden (~> 1.0.3)
51
+ erubis (2.6.6)
52
+ abstract (>= 1.0.0)
53
+ faraday (0.6.1)
54
+ addressable (~> 2.2.4)
55
+ multipart-post (~> 1.1.0)
56
+ rack (>= 1.1.0, < 2)
57
+ git (1.2.5)
58
+ i18n (0.6.0)
59
+ jeweler (1.6.0)
60
+ bundler (~> 1.0.0)
61
+ git (>= 1.2.5)
62
+ rake
63
+ mail (2.2.19)
64
+ activesupport (>= 2.3.6)
65
+ i18n (>= 0.4.0)
66
+ mime-types (~> 1.16)
67
+ treetop (~> 1.4.8)
68
+ mime-types (1.16)
69
+ mocha (0.9.12)
70
+ multi_json (1.0.2)
71
+ multi_xml (0.2.2)
72
+ multipart-post (1.1.1)
73
+ nokogiri (1.4.4.2-java)
74
+ weakling (>= 0.0.3)
75
+ oa-core (0.2.6)
76
+ oa-oauth (0.2.6)
77
+ faraday (~> 0.6.1)
78
+ multi_json (~> 1.0.0)
79
+ multi_xml (~> 0.2.2)
80
+ oa-core (= 0.2.6)
81
+ oauth (~> 0.4.0)
82
+ oauth2 (~> 0.4.1)
83
+ oa-openid (0.2.6)
84
+ oa-core (= 0.2.6)
85
+ rack-openid (~> 1.3.1)
86
+ ruby-openid-apps-discovery (~> 1.2.0)
87
+ oauth (0.4.4)
88
+ oauth2 (0.4.1)
89
+ faraday (~> 0.6.1)
90
+ multi_json (>= 0.0.5)
91
+ orm_adapter (0.0.5)
92
+ polyglot (0.3.1)
93
+ rack (1.2.3)
94
+ rack-mount (0.6.14)
95
+ rack (>= 1.0.0)
96
+ rack-openid (1.3.1)
97
+ rack (>= 1.1.0)
98
+ ruby-openid (>= 2.1.8)
99
+ rack-test (0.5.7)
100
+ rack (>= 1.0)
101
+ rails (3.0.4)
102
+ actionmailer (= 3.0.4)
103
+ actionpack (= 3.0.4)
104
+ activerecord (= 3.0.4)
105
+ activeresource (= 3.0.4)
106
+ activesupport (= 3.0.4)
107
+ bundler (~> 1.0)
108
+ railties (= 3.0.4)
109
+ railties (3.0.4)
110
+ actionpack (= 3.0.4)
111
+ activesupport (= 3.0.4)
112
+ rake (>= 0.8.7)
113
+ thor (~> 0.14.4)
114
+ rake (0.9.0)
115
+ ruby-debug (0.10.4)
116
+ columnize (>= 0.1)
117
+ ruby-debug-base (~> 0.10.4.0)
118
+ ruby-debug-base (0.10.4-java)
119
+ ruby-openid (2.1.8)
120
+ ruby-openid-apps-discovery (1.2.0)
121
+ ruby-openid (>= 2.1.7)
122
+ thor (0.14.6)
123
+ treetop (1.4.9)
124
+ polyglot (>= 0.3.1)
125
+ tzinfo (0.3.27)
126
+ warden (1.0.4)
127
+ rack (>= 1.0)
128
+ weakling (0.0.4-java)
129
+ webrat (0.7.2)
130
+ nokogiri (>= 1.2.0)
131
+ rack (>= 1.0)
132
+ rack-test (>= 0.5.3)
133
+ will_paginate (3.0.pre2)
134
+
135
+ PLATFORMS
136
+ java
137
+
138
+ DEPENDENCIES
139
+ devise (= 1.3.4)
140
+ jeweler
141
+ mocha
142
+ neo4j!
143
+ oa-oauth (~> 0.2.0)
144
+ oa-openid (~> 0.2.0)
145
+ rails (= 3.0.4)
146
+ ruby-debug (>= 0.10.3)
147
+ webrat (= 0.7.2)
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Ben Jackson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,48 @@
1
+ = devise-neo4j
2
+
3
+ A gem for Neo4j integration with the Devise authentication framework.
4
+
5
+ Neo4j: https://github.com/andreasronge/neo4j
6
+ Devise: https://github.com/plataformatec/devise
7
+
8
+ == Usage
9
+
10
+ === Installation
11
+
12
+ Add the neo4j and devise-neo4j gems to your Gemfile. The Neo4j gem should be taken from my github until a compatible neo4j gem is released:
13
+
14
+ gem "neo4j", :git => "git://github.com/benjackson/neo4j.git", :branch => "fixes-for-devise-gem"
15
+ gem "devise-neo4j"
16
+
17
+ Run the bundle install command:
18
+
19
+ bundle install
20
+
21
+ Then run the devise install generator and optionally update or create a devise-neo4j model:
22
+
23
+ bundle exec rails g devise:install --orm=neo4j
24
+ bundle exec rails g neo4j:devise MODEL
25
+
26
+ Now the model is setup like a default devise model, meaning you can do things like adding a before_filter in a controller to restrict access to logged-in users only:
27
+
28
+ before_filter :authenticate_<your model name>!
29
+
30
+ == Example App
31
+
32
+ You can see a very simple app that demonstrates Neo4j and devise here:
33
+
34
+ https://github.com/benjackson/devise-neo4j-example
35
+
36
+ == Note on Patches/Pull Requests
37
+
38
+ * Fork the project.
39
+ * Make your feature addition or bug fix.
40
+ * Add tests for it. This is important so I don't break it in a
41
+ future version unintentionally.
42
+ * Commit, do not mess with rakefile, version, or history.
43
+ (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)
44
+ * Send me a pull request. Bonus points for topic branches.
45
+
46
+ == Copyright
47
+
48
+ Copyright (c) 2011 Ben Jackson. See LICENSE for details.
@@ -0,0 +1,64 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+ require 'rake/rdoctask'
5
+
6
+ begin
7
+ require 'jeweler'
8
+ Jeweler::Tasks.new do |gem|
9
+ gem.name = "devise-neo4j"
10
+ gem.summary = %Q{Devise ORM for Neo4j}
11
+ gem.description = %Q{Neo4j integration with the Devise authentication framework}
12
+ gem.email = "ben.jackson1@gmail.com"
13
+ gem.homepage = "http://github.com/benjackson/devise-neo4j"
14
+ gem.authors = ["Ben Jackson", "Bobby Calderwood"]
15
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
+ gem.add_dependency "neo4j", "~> 1.1.0"
17
+ gem.add_dependency "devise", "1.3.4"
18
+ end
19
+ Jeweler::GemcutterTasks.new
20
+ rescue LoadError
21
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
22
+ end
23
+
24
+ desc 'Default: run tests for all ORM setups.'
25
+ task :default => [ :set_devise_path, :pre_commit ]
26
+
27
+ task :set_devise_path do
28
+ ENV['DEVISE_PATH'] = `bundle show devise`.chomp
29
+ end
30
+
31
+ desc 'Run Devise tests for all ORM setups.'
32
+ task :pre_commit do
33
+ Dir[File.join(File.dirname(__FILE__), 'test', 'orm', '*.rb')].each do |file|
34
+ orm = File.basename(file).split(".").first
35
+ ENV['DEVISE_ORM'] ||= orm
36
+ # system "rake test DEVISE_ORM=#{orm} DEVISE_PATH=#{ENV['DEVISE_PATH']}"
37
+ Rake::Task["test"].reenable
38
+ Rake::Task["test"].invoke
39
+ end
40
+ end
41
+
42
+ desc 'Run Devise tests. Specify path to devise with DEVISE_PATH'
43
+ Rake::TestTask.new(:test) do |test|
44
+ ENV['DEVISE_ORM'] ||= 'neo4j'
45
+ ENV['DEVISE_PATH'] ||= `bundle show devise`.chomp
46
+ unless File.exist?(ENV['DEVISE_PATH'])
47
+ puts "Specify the path to devise (e.g. rake DEVISE_PATH=/path/to/devise). Not found at #{ENV['DEVISE_PATH']}"
48
+ exit
49
+ end
50
+ test.libs << 'lib' << 'test'
51
+ test.libs << "#{ENV['DEVISE_PATH']}/lib"
52
+ test.libs << "#{ENV['DEVISE_PATH']}/test"
53
+ test.test_files = FileList["#{ENV['DEVISE_PATH']}/test/**/*_test.rb"] + FileList['test/**/*_test.rb']
54
+ test.verbose = true
55
+ end
56
+
57
+ Rake::RDocTask.new do |rdoc|
58
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
59
+
60
+ rdoc.rdoc_dir = 'rdoc'
61
+ rdoc.title = "devise-neo4j #{version}"
62
+ rdoc.rdoc_files.include('README*')
63
+ rdoc.rdoc_files.include('lib/**/*.rb')
64
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,83 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{devise-neo4j}
8
+ s.version = "1.0.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Ben Jackson", "Bobby Calderwood"]
12
+ s.date = %q{2011-05-25}
13
+ s.description = %q{Neo4j integration with the Devise authentication framework}
14
+ s.email = %q{ben.jackson1@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rdebugrc",
22
+ "Gemfile",
23
+ "Gemfile.lock",
24
+ "LICENSE",
25
+ "README.rdoc",
26
+ "Rakefile",
27
+ "VERSION",
28
+ "devise-neo4j.gemspec",
29
+ "lib/devise-neo4j.rb",
30
+ "lib/devise/orm/neo4j.rb",
31
+ "lib/devise/orm/neo4j/hook.rb",
32
+ "lib/devise/orm/neo4j/schema.rb",
33
+ "lib/generators/neo4j/devise_generator.rb",
34
+ "test/generators/neo4j/devise_generator_test.rb",
35
+ "test/orm/neo4j.rb",
36
+ "test/overrides/models/recoverable_test.rb",
37
+ "test/rails_app/app/neo4j/admin.rb",
38
+ "test/rails_app/app/neo4j/shim.rb",
39
+ "test/rails_app/app/neo4j/user.rb",
40
+ "test/rails_app/config/application.rb",
41
+ "test/rails_app/config/environment.rb",
42
+ "test/support/fix_last.rb",
43
+ "test/test_helper.rb"
44
+ ]
45
+ s.homepage = %q{http://github.com/benjackson/devise-neo4j}
46
+ s.require_paths = ["lib"]
47
+ s.rubygems_version = %q{1.5.1}
48
+ s.summary = %q{Devise ORM for Neo4j}
49
+
50
+ if s.respond_to? :specification_version then
51
+ s.specification_version = 3
52
+
53
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
54
+ s.add_runtime_dependency(%q<rails>, ["= 3.0.4"])
55
+ s.add_runtime_dependency(%q<oa-oauth>, ["~> 0.2.0"])
56
+ s.add_runtime_dependency(%q<oa-openid>, ["~> 0.2.0"])
57
+ s.add_runtime_dependency(%q<devise>, ["= 1.3.4"])
58
+ s.add_runtime_dependency(%q<ruby-debug>, [">= 0.10.3"])
59
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
60
+ s.add_runtime_dependency(%q<neo4j>, ["~> 1.1.0"])
61
+ s.add_runtime_dependency(%q<devise>, ["= 1.3.4"])
62
+ else
63
+ s.add_dependency(%q<rails>, ["= 3.0.4"])
64
+ s.add_dependency(%q<oa-oauth>, ["~> 0.2.0"])
65
+ s.add_dependency(%q<oa-openid>, ["~> 0.2.0"])
66
+ s.add_dependency(%q<devise>, ["= 1.3.4"])
67
+ s.add_dependency(%q<ruby-debug>, [">= 0.10.3"])
68
+ s.add_dependency(%q<jeweler>, [">= 0"])
69
+ s.add_dependency(%q<neo4j>, ["~> 1.1.0"])
70
+ s.add_dependency(%q<devise>, ["= 1.3.4"])
71
+ end
72
+ else
73
+ s.add_dependency(%q<rails>, ["= 3.0.4"])
74
+ s.add_dependency(%q<oa-oauth>, ["~> 0.2.0"])
75
+ s.add_dependency(%q<oa-openid>, ["~> 0.2.0"])
76
+ s.add_dependency(%q<devise>, ["= 1.3.4"])
77
+ s.add_dependency(%q<ruby-debug>, [">= 0.10.3"])
78
+ s.add_dependency(%q<jeweler>, [">= 0"])
79
+ s.add_dependency(%q<neo4j>, ["~> 1.1.0"])
80
+ s.add_dependency(%q<devise>, ["= 1.3.4"])
81
+ end
82
+ end
83
+
@@ -0,0 +1,3 @@
1
+ require 'devise'
2
+ require 'devise/orm/neo4j/hook'
3
+ require 'devise/orm/neo4j/schema'
@@ -0,0 +1,10 @@
1
+ require 'devise-neo4j'
2
+
3
+ module Neo4j
4
+ module Rails
5
+ class Model
6
+ extend ::Devise::Models
7
+ extend ::Devise::Orm::Neo4j::Hook
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,23 @@
1
+ module Devise
2
+ module Orm
3
+ module Neo4j
4
+ module Hook
5
+ def devise_modules_hook!
6
+ extend Schema
7
+ yield
8
+ devise_modules.each { |m| send(m) if respond_to?(m, true) }
9
+
10
+ # ensure we have the created_at property
11
+ property :created_at, :type => Time
12
+ end
13
+
14
+ # Overwrite the devise method to control indexation dependent on the specified modules
15
+ def devise(*modules)
16
+ # hack to get around Neo4j's requirement to index before uniqueness validation
17
+ index :email, :type => :exact if modules.include?(:validatable)
18
+ super
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,41 @@
1
+ module Devise
2
+ module Orm
3
+ module Neo4j
4
+ module Schema
5
+ include Devise::Schema
6
+
7
+ INDEXED_PROPERTIES = [ :email, :authentication_token, :confirmation_token, :remember_token, :reset_password_token, :unlock_token ]
8
+
9
+ # Tell how to apply schema methods
10
+ def apply_devise_schema(name, type, options={})
11
+ index name, :type => :exact if INDEXED_PROPERTIES.include?(name)
12
+ create_property(name, type, options)
13
+ end
14
+
15
+ protected
16
+ def create_property(name, type, options)
17
+ # Hack to get around encrypted_password not having the default of ""
18
+ options.delete(:default) if name == :encrypted_password
19
+
20
+ # If the property is required, its presence should be checked anyway
21
+ options.delete(:null)
22
+
23
+ Rails.logger.debug "Adding Devise property for #{self}: #{name.inspect}, #{{ :type => map_type(type) }.merge!(options).inspect}"
24
+ property name, { :type => map_type(type) }.merge!(options)
25
+ end
26
+
27
+ # map the Java type to the right Ruby type
28
+ def map_type(type)
29
+ case type.to_s
30
+ when "DateTime"
31
+ Time
32
+ when "Integer"
33
+ Fixnum
34
+ else
35
+ type
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,20 @@
1
+ require 'generators/devise/orm_helpers'
2
+
3
+ module Neo4j
4
+ module Generators
5
+ class DeviseGenerator < ::Rails::Generators::NamedBase
6
+ include ::Devise::Generators::OrmHelpers
7
+
8
+ def generate_model
9
+ invoke "neo4j:model", [name] unless model_exists? && behavior == :invoke
10
+ end
11
+
12
+ def inject_devise_content
13
+ inject_into_file(model_path, model_contents + <<CONTENT, :after => /Neo4j(::Rails)?::Model\n/) if model_exists?
14
+ # Setup accessible (or protected) attributes for your model
15
+ attr_accessible :email, :password, :password_confirmation, :remember_me
16
+ CONTENT
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,27 @@
1
+ require 'test_helper'
2
+ require 'tmpdir'
3
+ require 'rails/generators/test_case'
4
+ require 'generators/neo4j/devise_generator.rb'
5
+
6
+ class Neo4j::Generators::ModelGeneratorTest < Rails::Generators::TestCase
7
+ tests Neo4j::Generators::DeviseGenerator
8
+ destination File.join(Dir.tmpdir, File.dirname(__FILE__))
9
+ setup :prepare_destination
10
+
11
+ def assert_class(klass, content)
12
+ assert content =~ /class #{klass}(\(.+\))?(.*?)\nend/m, "Expected to have class #{klass}"
13
+ yield $2.strip if block_given?
14
+ end
15
+
16
+ test "invoke with model name" do
17
+ content = run_generator %w(Player)
18
+
19
+ assert_file "app/models/player.rb" do |player|
20
+ assert_class "Player", player do |klass|
21
+ assert_match /Neo4j::Rails::Model/, klass
22
+ assert_match /attr_accessible :email, :password, :password_confirmation, :remember_me/, klass
23
+ end
24
+ end
25
+ end
26
+
27
+ end
@@ -0,0 +1,13 @@
1
+ require 'fileutils'
2
+
3
+ Neo4j.shutdown
4
+ FileUtils.rm_rf Neo4j::Config[:storage_path]
5
+ Neo4j.start
6
+
7
+ class ActiveSupport::TestCase
8
+ teardown do
9
+ Neo4j::Transaction.run do
10
+ Neo4j._all_nodes.each { |n| n.del unless n == Neo4j.ref_node }
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ require "test_helper"
2
+
3
+ if DEVISE_ORM == :neo4j
4
+
5
+ class RecoverableTest < ActiveSupport::TestCase
6
+ undef :test_should_save_the_model_when_the_reset_password_sent_at_doesnt_exist
7
+
8
+ test 'should save the model when the reset_password_sent_at doesnt exist' do
9
+ user = create_user
10
+ user.stubs(:respond_to?)
11
+ user.stubs(:respond_to?).with("email=").returns(true)
12
+ user.stubs(:respond_to?).with(:updated_at).returns(false)
13
+ user.stubs(:respond_to?).with(:reset_password_sent_at=).returns(false)
14
+ user.stubs(:respond_to?).with(:headers_for).returns(false)
15
+ user.send_reset_password_instructions
16
+ user.reload
17
+ assert_not_nil user.reset_password_token
18
+ end
19
+ end
20
+
21
+ end
@@ -0,0 +1,9 @@
1
+ require 'shared_admin'
2
+
3
+ class Admin < Neo4j::Rails::Model
4
+ include Shim
5
+ include SharedAdmin
6
+
7
+ index :remember_token
8
+ property :remember_token
9
+ end
@@ -0,0 +1,2 @@
1
+ module Shim
2
+ end
@@ -0,0 +1,11 @@
1
+ require 'shared_user'
2
+
3
+ class User < Neo4j::Rails::Model
4
+ include Shim
5
+ include SharedUser
6
+
7
+ index :username
8
+ property :username
9
+
10
+ attr_accessible :username, :email, :password, :password_confirmation, :remember_me
11
+ end
@@ -0,0 +1,46 @@
1
+ APP_ROOT = File.expand_path("#{DEVISE_PATH}/test/rails_app")
2
+ require "#{APP_ROOT}/config/boot"
3
+
4
+ require "action_controller/railtie"
5
+ require "action_mailer/railtie"
6
+ require "active_resource/railtie"
7
+ require "rails/test_unit/railtie"
8
+
9
+ Bundler.require :default, DEVISE_ORM
10
+
11
+ begin
12
+ require "#{DEVISE_ORM}/railtie"
13
+ rescue LoadError
14
+ end
15
+
16
+ require "tmpdir"
17
+
18
+ module RailsApp
19
+ class Application < Rails::Application
20
+ # Add additional load paths for your own custom dirs
21
+ config.root = APP_ROOT
22
+ config.autoload_paths.reject!{ |p| p =~ /\/app\/(\w+)$/ && !%w(controllers helpers views).include?($1) }
23
+ config.autoload_paths += [ File.expand_path("#{File.dirname(__FILE__)}/../app/#{DEVISE_ORM}") ]
24
+
25
+ # Configure generators values. Many other options are available, be sure to check the documentation.
26
+ # config.generators do |g|
27
+ # g.orm :active_record
28
+ # g.template_engine :erb
29
+ # g.test_framework :test_unit, :fixture => true
30
+ # end
31
+
32
+ # Configure sensitive parameters which will be filtered from the log file.
33
+ config.filter_parameters << :password
34
+
35
+ config.action_mailer.default_url_options = { :host => "localhost:3000" }
36
+
37
+ config.active_support.deprecation = :stderr
38
+ config.paths.log = File.join(Dir.tmpdir, 'devise-neo4j-tests', 'rails_app', 'log', 'test.log')
39
+ config.neo4j.storage_path = File.join(Dir.tmpdir, 'devise-neo4j-tests', 'rails_app', 'tmp', 'neo4j', 'test')
40
+
41
+ # This was used to break devise in some situations
42
+ config.to_prepare do
43
+ Devise::SessionsController.layout "application"
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,5 @@
1
+ # Load the rails application
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the rails application
5
+ RailsApp::Application.initialize!
@@ -0,0 +1,12 @@
1
+ require 'neo4j'
2
+
3
+ class Neo4j::Rails::Model
4
+ # Hack to get around the fact that Neo4j doesn't support :order (currently)
5
+ def self.last(*args)
6
+ if args == [{ :order => "id" }]
7
+ last
8
+ else
9
+ super
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,32 @@
1
+ ENV["RAILS_ENV"] = "test"
2
+ DEVISE_ORM = (ENV["DEVISE_ORM"] || :neo4j).to_sym
3
+ DEVISE_PATH = ENV['DEVISE_PATH']
4
+
5
+ $:.unshift File.dirname(__FILE__)
6
+ puts "\n==> Devise.orm = #{DEVISE_ORM.inspect}"
7
+
8
+ require "rails_app/config/environment"
9
+ require "rails/test_help"
10
+ require "orm/#{DEVISE_ORM}"
11
+
12
+ I18n.load_path << "#{DEVISE_PATH}/config/locales/en.yml"
13
+
14
+ require 'mocha'
15
+ require 'webrat'
16
+ Webrat.configure do |config|
17
+ config.mode = :rails
18
+ config.open_error_files = false
19
+ end
20
+
21
+ # Devise test support
22
+ $:.unshift "#{DEVISE_PATH}/test/support"
23
+ Dir["#{DEVISE_PATH}/test/support/**/*.rb"].each { |f| require f }
24
+
25
+ # Devise-neo4j test support
26
+ $:.unshift "#{File.dirname(__FILE__)}/support"
27
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
28
+
29
+ # For generators
30
+ require "rails/generators/test_case"
31
+ require "generators/devise/install_generator"
32
+ require "generators/devise/views_generator"
metadata ADDED
@@ -0,0 +1,168 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: devise-neo4j
3
+ version: !ruby/object:Gem::Version
4
+ prerelease:
5
+ version: 1.0.0
6
+ platform: ruby
7
+ authors:
8
+ - Ben Jackson
9
+ - Bobby Calderwood
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+
14
+ date: 2011-05-25 00:00:00 +01:00
15
+ default_executable:
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: rails
19
+ version_requirements: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - "="
23
+ - !ruby/object:Gem::Version
24
+ version: 3.0.4
25
+ requirement: *id001
26
+ prerelease: false
27
+ type: :runtime
28
+ - !ruby/object:Gem::Dependency
29
+ name: oa-oauth
30
+ version_requirements: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ~>
34
+ - !ruby/object:Gem::Version
35
+ version: 0.2.0
36
+ requirement: *id002
37
+ prerelease: false
38
+ type: :runtime
39
+ - !ruby/object:Gem::Dependency
40
+ name: oa-openid
41
+ version_requirements: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: 0.2.0
47
+ requirement: *id003
48
+ prerelease: false
49
+ type: :runtime
50
+ - !ruby/object:Gem::Dependency
51
+ name: devise
52
+ version_requirements: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - "="
56
+ - !ruby/object:Gem::Version
57
+ version: 1.3.4
58
+ requirement: *id004
59
+ prerelease: false
60
+ type: :runtime
61
+ - !ruby/object:Gem::Dependency
62
+ name: ruby-debug
63
+ version_requirements: &id005 !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: 0.10.3
69
+ requirement: *id005
70
+ prerelease: false
71
+ type: :runtime
72
+ - !ruby/object:Gem::Dependency
73
+ name: jeweler
74
+ version_requirements: &id006 !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: "0"
80
+ requirement: *id006
81
+ prerelease: false
82
+ type: :development
83
+ - !ruby/object:Gem::Dependency
84
+ name: neo4j
85
+ version_requirements: &id007 !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ~>
89
+ - !ruby/object:Gem::Version
90
+ version: 1.1.0
91
+ requirement: *id007
92
+ prerelease: false
93
+ type: :runtime
94
+ - !ruby/object:Gem::Dependency
95
+ name: devise
96
+ version_requirements: &id008 !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - "="
100
+ - !ruby/object:Gem::Version
101
+ version: 1.3.4
102
+ requirement: *id008
103
+ prerelease: false
104
+ type: :runtime
105
+ description: Neo4j integration with the Devise authentication framework
106
+ email: ben.jackson1@gmail.com
107
+ executables: []
108
+
109
+ extensions: []
110
+
111
+ extra_rdoc_files:
112
+ - LICENSE
113
+ - README.rdoc
114
+ files:
115
+ - .document
116
+ - .rdebugrc
117
+ - Gemfile
118
+ - Gemfile.lock
119
+ - LICENSE
120
+ - README.rdoc
121
+ - Rakefile
122
+ - VERSION
123
+ - devise-neo4j.gemspec
124
+ - lib/devise-neo4j.rb
125
+ - lib/devise/orm/neo4j.rb
126
+ - lib/devise/orm/neo4j/hook.rb
127
+ - lib/devise/orm/neo4j/schema.rb
128
+ - lib/generators/neo4j/devise_generator.rb
129
+ - test/generators/neo4j/devise_generator_test.rb
130
+ - test/orm/neo4j.rb
131
+ - test/overrides/models/recoverable_test.rb
132
+ - test/rails_app/app/neo4j/admin.rb
133
+ - test/rails_app/app/neo4j/shim.rb
134
+ - test/rails_app/app/neo4j/user.rb
135
+ - test/rails_app/config/application.rb
136
+ - test/rails_app/config/environment.rb
137
+ - test/support/fix_last.rb
138
+ - test/test_helper.rb
139
+ has_rdoc: true
140
+ homepage: http://github.com/benjackson/devise-neo4j
141
+ licenses: []
142
+
143
+ post_install_message:
144
+ rdoc_options: []
145
+
146
+ require_paths:
147
+ - lib
148
+ required_ruby_version: !ruby/object:Gem::Requirement
149
+ none: false
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ version: "0"
154
+ required_rubygems_version: !ruby/object:Gem::Requirement
155
+ none: false
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: "0"
160
+ requirements: []
161
+
162
+ rubyforge_project:
163
+ rubygems_version: 1.5.1
164
+ signing_key:
165
+ specification_version: 3
166
+ summary: Devise ORM for Neo4j
167
+ test_files: []
168
+