devise-neo4j 2.0.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ffc34ede7035e57480328a141cc838e84219e0fb
4
- data.tar.gz: 36d99219072251c85b4aa752a944d0acf6bd1708
3
+ metadata.gz: 1d06629713351f2ac2ccc575ec685ce42f84c6e0
4
+ data.tar.gz: 16f4bad9a75f8de9c7a910ead4f5d1ee2169cf45
5
5
  SHA512:
6
- metadata.gz: d0220d1729e55714e5f1cdf9d4783f3e467a46562aa06a1a506827f4c1744174bfccfaa0934e84da5de2c585f0a9f30441f9ef17fe76e74da535b8ba2d94e3f7
7
- data.tar.gz: a63c77b5e5b359a0e834b76f5e681364501b9e8b123132961efd3771746dd009abfe1b3a17645ff5affb6d23d615d124ef02e4004015198072dc9090d1966f97
6
+ metadata.gz: fe84a5eabd313d7ac532e353df0c69e0d209cb9482df3710514d8a2c79866b142d3f9dcad907758ec72e5642284268682b603ceb47e2aa417fed814de83b0608
7
+ data.tar.gz: b59a41c7e5892f2b841c1234172efd58da32df04f844b4d219467c9614b82e601663907a751e96deefc25bf826bc8eaec17fc5c27492dd3ca44e95108b88458e
data/.travis.yml CHANGED
@@ -1,5 +1,19 @@
1
- script: "bundle exec rake neo4j:install['community-latest'] neo4j:start default --trace"
1
+ before_script:
2
+ - "bin/rake neo4j:install[community-latest] --trace"
3
+ - "bin/rake neo4j:config[development,7474] --trace"
4
+ - "echo 'dbms.memory.pagecache.size=600m' >> ./db/neo4j/development/conf/neo4j.conf"
5
+ - "echo 'dbms.memory.heap.max_size=600' >> ./db/neo4j/development/conf/neo4j-wrapper.conf"
6
+ - "echo 'dbms.memory.heap.initial_size=600' >> ./db/neo4j/development/conf/neo4j-wrapper.conf"
7
+ - "bin/rake neo4j:start --trace"
8
+ - "sleep 20"
9
+ script:
10
+ - "travis_retry bin/rake default --trace"
2
11
  language: ruby
12
+ cache: bundler
13
+ jdk: oraclejdk8
3
14
  sudo: false
15
+ env:
16
+ global:
17
+ - JRUBY_OPTS="-J-Xmx1280m -Xcompile.invokedynamic=false -J-XX:+TieredCompilation -J-XX:TieredStopAtLevel=1 -J-noverify -Xcompile.mode=OFF"
4
18
  rvm:
5
19
  - 2.2.3
data/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@ All notable changes to this project will be documented in this file.
3
3
  This file should follow the standards specified on [http://keepachangelog.com/]
4
4
  This project adheres to [Semantic Versioning](http://semver.org/).
5
5
 
6
+ ## [2.1.0] - 12-23-2016
7
+
8
+ ### Fixed
9
+
10
+ - Various problems with the model generator with newer version of Neo4j (see #28)
11
+
6
12
  ## [2.0.2] - 11-29-2015
7
13
 
8
14
  ### Fixed
data/Gemfile CHANGED
@@ -2,14 +2,18 @@ source "http://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- gem "rails", "~> 4.2.3"
5
+ gem "rails", ">= 4.2.3"
6
6
  gem "omniauth"
7
7
  gem "omniauth-oauth2"
8
8
  gem "rdoc"
9
9
 
10
- gem 'neo4j', '~> 5.0.0'
11
- gem 'neo4j-core', '~> 5.0.0'
12
- gem "devise", '3.5.2'
10
+ gem 'neo4j', '>= 7.0.0'
11
+ gem 'neo4j-core', '>= 6.0.0'
12
+ gem "devise"
13
+
14
+ group :development do
15
+ gem 'pry'
16
+ end
13
17
 
14
18
  group :test do
15
19
  gem "omniauth-facebook"
data/Gemfile.lock CHANGED
@@ -1,12 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- devise-neo4j (2.0.2)
4
+ devise-neo4j (2.1.0)
5
5
  bcrypt (>= 3.0)
6
- devise (>= 3.0)
6
+ devise (>= 3.5.2)
7
7
  neo4j (>= 3.0.0)
8
8
  orm_adapter (~> 0.5.0)
9
- railties (>= 3.1)
9
+ railties (>= 4.2)
10
10
  warden (>= 1.2.1)
11
11
 
12
12
  GEM
@@ -31,9 +31,6 @@ GEM
31
31
  erubis (~> 2.7.0)
32
32
  rails-dom-testing (~> 1.0, >= 1.0.5)
33
33
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
34
- active_attr (0.8.5)
35
- activemodel (>= 3.0.2, < 5.0)
36
- activesupport (>= 3.0.2, < 5.0)
37
34
  activejob (4.2.3)
38
35
  activesupport (= 4.2.3)
39
36
  globalid (>= 0.3.0)
@@ -51,35 +48,34 @@ GEM
51
48
  thread_safe (~> 0.3, >= 0.3.4)
52
49
  tzinfo (~> 1.1)
53
50
  arel (6.0.3)
54
- bcrypt (3.1.10)
55
- bcrypt (3.1.10-java)
51
+ bcrypt (3.1.11)
52
+ bcrypt (3.1.11-java)
56
53
  bson (3.2.1)
57
54
  bson_ext (1.3.1)
58
55
  builder (3.2.2)
56
+ coderay (1.1.1)
57
+ colored (1.2)
59
58
  columnize (0.9.0)
60
59
  connection_pool (2.2.0)
61
- devise (3.5.2)
60
+ devise (4.2.0)
62
61
  bcrypt (~> 3.0)
63
62
  orm_adapter (~> 0.1)
64
- railties (>= 3.2.6, < 5)
63
+ railties (>= 4.1.0, < 5.1)
65
64
  responders
66
- thread_safe (~> 0.1)
67
65
  warden (~> 1.2.3)
68
66
  erubis (2.7.0)
69
67
  faraday (0.9.2)
70
68
  multipart-post (>= 1.2, < 3)
71
- faraday_middleware (0.9.2)
72
- faraday (>= 0.7.4, < 0.10)
69
+ faraday_middleware (0.10.1)
70
+ faraday (>= 0.7.4, < 1.0)
73
71
  faraday_middleware-multi_json (0.0.6)
74
72
  faraday_middleware
75
73
  multi_json
74
+ ffi (1.9.14-java)
76
75
  globalid (0.3.6)
77
76
  activesupport (>= 4.1.0)
78
77
  hashie (3.4.2)
79
- httparty (0.13.7)
80
- json (~> 1.8)
81
- multi_xml (>= 0.5.2)
82
- httpclient (2.7.0.1)
78
+ httpclient (2.8.3)
83
79
  i18n (0.7.0)
84
80
  jruby-openssl (0.9.8-java)
85
81
  json (1.8.3)
@@ -87,14 +83,15 @@ GEM
87
83
  jwt (1.5.1)
88
84
  linecache (0.46)
89
85
  rbx-require-relative (> 0.0.4)
90
- loofah (2.0.2)
86
+ loofah (2.0.3)
91
87
  nokogiri (>= 1.5.9)
92
88
  mail (2.6.3)
93
89
  mime-types (>= 1.16, < 3)
94
90
  metaclass (0.0.4)
91
+ method_source (0.8.2)
95
92
  mime-types (2.6.1)
96
- mini_portile (0.6.2)
97
- minitest (5.8.3)
93
+ mini_portile2 (2.1.0)
94
+ minitest (5.10.1)
98
95
  mocha (1.1.0)
99
96
  metaclass (~> 0.0.1)
100
97
  mongo (2.0.6)
@@ -108,31 +105,34 @@ GEM
108
105
  bson (~> 3.0)
109
106
  connection_pool (~> 2.0)
110
107
  optionable (~> 0.2.0)
111
- multi_json (1.11.2)
112
- multi_xml (0.5.5)
108
+ multi_json (1.12.1)
109
+ multi_xml (0.6.0)
113
110
  multipart-post (2.0.0)
114
- neo4j (5.0.15)
115
- active_attr (~> 0.8)
116
- activemodel (~> 4)
117
- activesupport (~> 4)
118
- neo4j-core (~> 5.0.1)
111
+ neo4j (8.0.0)
112
+ activemodel (>= 4.0, < 5.1)
113
+ activesupport (>= 4.0, < 5.1)
114
+ neo4j-core (>= 7.0.0)
119
115
  orm_adapter (~> 0.5.0)
120
- neo4j-core (5.0.10)
121
- activesupport
116
+ neo4j-core (7.0.0)
117
+ activesupport (>= 4.0)
122
118
  faraday (~> 0.9.0)
123
- faraday_middleware (~> 0.9.1)
119
+ faraday_middleware (~> 0.10.0)
124
120
  faraday_middleware-multi_json
125
- httparty
126
121
  httpclient
127
122
  json
128
123
  multi_json
129
- net-http-persistent
124
+ neo4j-rake_tasks (>= 0.3.0)
125
+ net-http-persistent (~> 2.9.4)
126
+ neo4j-rake_tasks (0.7.9)
127
+ colored
130
128
  os
131
- zip
129
+ rake
130
+ ruby-progressbar
131
+ rubyzip (>= 1.1.7)
132
132
  net-http-persistent (2.9.4)
133
- nokogiri (1.6.6.2)
134
- mini_portile (~> 0.6.0)
135
- nokogiri (1.6.6.2-java)
133
+ nokogiri (1.6.8.1)
134
+ mini_portile2 (~> 2.1.0)
135
+ nokogiri (1.6.8.1-java)
136
136
  oauth2 (1.0.0)
137
137
  faraday (>= 0.8, < 0.10)
138
138
  jwt (~> 1.0)
@@ -154,7 +154,16 @@ GEM
154
154
  origin (2.1.1)
155
155
  orm_adapter (0.5.0)
156
156
  os (0.9.6)
157
- rack (1.6.4)
157
+ pry (0.10.4)
158
+ coderay (~> 1.1.0)
159
+ method_source (~> 0.8.1)
160
+ slop (~> 3.4)
161
+ pry (0.10.4-java)
162
+ coderay (~> 1.1.0)
163
+ method_source (~> 0.8.1)
164
+ slop (~> 3.4)
165
+ spoon (~> 0.0)
166
+ rack (1.6.5)
158
167
  rack-openid (1.3.1)
159
168
  rack (>= 1.1.0)
160
169
  ruby-openid (>= 2.1.8)
@@ -173,28 +182,33 @@ GEM
173
182
  sprockets-rails
174
183
  rails-deprecated_sanitizer (1.0.3)
175
184
  activesupport (>= 4.2.0.alpha)
176
- rails-dom-testing (1.0.6)
185
+ rails-dom-testing (1.0.7)
177
186
  activesupport (>= 4.2.0.beta, < 5.0)
178
187
  nokogiri (~> 1.6.0)
179
188
  rails-deprecated_sanitizer (>= 1.0.1)
180
- rails-html-sanitizer (1.0.2)
189
+ rails-html-sanitizer (1.0.3)
181
190
  loofah (~> 2.0)
182
191
  railties (4.2.3)
183
192
  actionpack (= 4.2.3)
184
193
  activesupport (= 4.2.3)
185
194
  rake (>= 0.8.7)
186
195
  thor (>= 0.18.1, < 2.0)
187
- rake (10.4.2)
196
+ rake (12.0.0)
188
197
  rbx-require-relative (0.0.9)
189
198
  rdoc (4.2.0)
190
- responders (2.1.0)
191
- railties (>= 4.2.0, < 5)
199
+ responders (2.3.0)
200
+ railties (>= 4.2.0, < 5.1)
192
201
  ruby-debug (0.10.4)
193
202
  columnize (>= 0.1)
194
203
  ruby-debug-base (~> 0.10.4.0)
195
204
  ruby-debug-base (0.10.4)
196
205
  linecache (>= 0.3)
197
206
  ruby-openid (2.7.0)
207
+ ruby-progressbar (1.8.1)
208
+ rubyzip (1.2.0)
209
+ slop (3.6.0)
210
+ spoon (0.0.6)
211
+ ffi
198
212
  sprockets (3.3.0)
199
213
  rack (~> 1.0)
200
214
  sprockets-rails (2.3.2)
@@ -202,18 +216,17 @@ GEM
202
216
  activesupport (>= 3.0)
203
217
  sprockets (>= 2.8, < 4.0)
204
218
  sqlite3 (1.3.10)
205
- thor (0.19.1)
219
+ thor (0.19.4)
206
220
  thread_safe (0.3.5)
207
221
  thread_safe (0.3.5-java)
208
222
  tzinfo (1.2.2)
209
223
  thread_safe (~> 0.1)
210
- warden (1.2.3)
224
+ warden (1.2.6)
211
225
  rack (>= 1.0)
212
226
  webrat (0.7.2)
213
227
  nokogiri (>= 1.2.0)
214
228
  rack (>= 1.0)
215
229
  rack-test (>= 0.5.3)
216
- zip (2.0.2)
217
230
 
218
231
  PLATFORMS
219
232
  java
@@ -221,23 +234,24 @@ PLATFORMS
221
234
 
222
235
  DEPENDENCIES
223
236
  bson_ext (~> 1.3.0)
224
- devise (= 3.5.2)
237
+ devise
225
238
  devise-neo4j!
226
239
  jruby-openssl
227
240
  mocha
228
241
  mongo
229
242
  mongoid
230
- neo4j (~> 5.0.0)
231
- neo4j-core (~> 5.0.0)
243
+ neo4j (>= 7.0.0)
244
+ neo4j-core (>= 6.0.0)
232
245
  omniauth
233
246
  omniauth-facebook
234
247
  omniauth-oauth2
235
248
  omniauth-openid (~> 1.0.1)
236
- rails (~> 4.2.3)
249
+ pry
250
+ rails (>= 4.2.3)
237
251
  rdoc
238
252
  ruby-debug (>= 0.10.3)
239
253
  sqlite3
240
254
  webrat (= 0.7.2)
241
255
 
242
256
  BUNDLED WITH
243
- 1.10.6
257
+ 1.13.6
data/README.md CHANGED
@@ -11,7 +11,7 @@ https://github.com/plataformatec/devise
11
11
 
12
12
  Add the neo4j and devise-neo4j gems to your Gemfile:
13
13
 
14
- gem "neo4j", "~> 4.2.1"
14
+ gem "neo4j"
15
15
  gem "devise-neo4j"
16
16
 
17
17
  Run the bundle install command:
@@ -23,7 +23,7 @@ devise-neo4j model:
23
23
 
24
24
  rails g devise:install --orm=neo4j
25
25
  # Make sure the model file is created ahead of time!
26
- rails g neo4j:devise MODEL
26
+ rails g neo4j:devise MODEL # (Where MODEL is something like User)
27
27
 
28
28
  Add the Devise route to your config/routes.rb:
29
29
 
data/bin/rake ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ #
4
+ # This file was generated by Bundler.
5
+ #
6
+ # The application 'rake' is installed as part of a gem, and
7
+ # this file is here to facilitate running it.
8
+ #
9
+
10
+ require "pathname"
11
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath)
12
+
13
+ require "rubygems"
14
+ require "bundler/setup"
15
+
16
+ load Gem.bin_path("rake", "rake")
data/devise-neo4j.gemspec CHANGED
@@ -20,8 +20,8 @@ Gem::Specification.new do |s|
20
20
  s.add_dependency("warden", ">= 1.2.1")
21
21
  s.add_dependency("orm_adapter", "~> 0.5.0")
22
22
  s.add_dependency("bcrypt", ">= 3.0")
23
- s.add_dependency("railties", ">= 3.1")
23
+ s.add_dependency("railties", ">= 4.2")
24
24
  s.add_dependency("neo4j", ">= 3.0.0")
25
- s.add_dependency("devise", ">= 3.0")
25
+ s.add_dependency("devise", ">= 3.5.2")
26
26
 
27
27
  end
@@ -1,5 +1,5 @@
1
1
  module Devise
2
2
  module Neo4j
3
- VERSION = "2.0.2"
3
+ VERSION = "2.1.0"
4
4
  end
5
5
  end
@@ -4,81 +4,86 @@ module Neo4j
4
4
  module Generators
5
5
  class DeviseGenerator < ::Rails::Generators::NamedBase
6
6
  include ::Devise::Generators::OrmHelpers
7
-
7
+
8
+ def copy_devise_migration
9
+ create_file "db/neo4j/migrate/#{Time.now.utc.strftime('%Y%m%d%H%M%S')}_devise_create_user_constraints_and_indexes.rb", File.read(File.expand_path('./templates/migration.rb', File.dirname(__FILE__)))
10
+ end
11
+
8
12
  def generate_model
9
- invoke "neo4j:model", [name] unless model_exists? && behavior == :invoke
13
+ invoke 'neo4j:model', [name] unless model_exists? && behavior == :invoke
10
14
  end
11
-
12
15
 
13
16
  def inject_field_types
14
- inject_into_file model_path, model_contents , :after => /Neo4j::ActiveNode\n/ if model_exists?
17
+ inject_into_file model_path, model_contents , after: /Neo4j::ActiveNode\n/ if model_exists?
15
18
  end
16
19
 
17
20
  def inject_devise_content
18
- inject_into_file model_path, migration_data , :after => /Neo4j::ActiveNode\n/ if model_exists?
21
+ inject_into_file model_path, migration_data , after: /Neo4j::ActiveNode\n/ if model_exists?
19
22
  end
20
-
21
-
22
- def migration_data
23
+
24
+ def migration_data
23
25
  <<RUBY
24
- #
25
- # Neo4j.rb needs to have property definitions before any validations. So, the property block needs to come before
26
- # loading your devise modules.
27
- #
28
- # If you add another devise module (such as :lockable, :confirmable, or :token_authenticatable), be sure to
29
- # uncomment the property definitions for those modules. Otherwise, the unused property definitions can be deleted.
30
- #
31
-
32
- property :username, type: String
33
- property :facebook_token, type: String
34
- index :facebook_token
35
-
36
- property :created_at, type: DateTime
37
- property :updated_at, type: DateTime
38
-
39
- ## Database authenticatable
40
- property :email, type: String, null: false, default: ""
41
- index :email
42
-
43
- property :encrypted_password
44
-
45
- ## If you include devise modules, uncomment the properties below.
46
-
47
- ## Rememberable
48
- property :remember_created_at, type: DateTime
49
- property :remember_token
50
- index :remember_token
51
-
52
-
53
- ## Recoverable
54
- property :reset_password_token
55
- index :reset_password_token
56
- property :reset_password_sent_at, type: DateTime
57
-
58
- ## Trackable
59
- property :sign_in_count, type: Integer, default: 0
60
- property :current_sign_in_at, type: DateTime
61
- property :last_sign_in_at, type: DateTime
62
- property :current_sign_in_ip, type: String
63
- property :last_sign_in_ip, type: String
64
-
65
- ## Confirmable
66
- # property :confirmation_token
67
- # index :confirmation_token
68
- # property :confirmed_at, type: DateTime
69
- # property :confirmation_sent_at, type: DateTime
70
-
71
- ## Lockable
72
- # property :failed_attempts, type: Integer, default: 0
73
- # property :locked_at, type: DateTime
74
- # property :unlock_token, type: String,
75
- # index :unlock_token
76
-
77
- ## Token authenticatable
78
- # property :authentication_token, type: String, null: true, index: :exact
26
+ #
27
+ # Neo4j.rb needs to have property definitions before any validations. So, the property block needs to come before
28
+ # loading your devise modules.
29
+ #
30
+ # If you add another devise module (such as :lockable, :confirmable, or :token_authenticatable), be sure to
31
+ # uncomment the property definitions for those modules. Otherwise, the unused property definitions can be deleted.
32
+ #
33
+
34
+ property :created_at, type: DateTime
35
+ property :updated_at, type: DateTime
36
+
37
+ ## Database authenticatable
38
+ property :email, type: String, default: ''
39
+ validates :email, presence: true
40
+
41
+ property :encrypted_password
42
+
43
+ ## If you include devise modules, uncomment the properties below.
44
+
45
+ ## Recoverable
46
+ property :reset_password_token
47
+ property :reset_password_sent_at, type: DateTime
48
+
49
+ ## Rememberable
50
+ property :remember_created_at, type: DateTime
51
+
52
+ ## Trackable
53
+ property :sign_in_count, type: Integer, default: 0
54
+ validates :sign_in_count, presence: true
55
+ property :current_sign_in_at, type: DateTime
56
+ property :last_sign_in_at, type: DateTime
57
+ property :current_sign_in_ip, type: String
58
+ property :last_sign_in_ip, type: String
59
+
60
+ ## Confirmable
61
+ # property :confirmation_token
62
+ # property :confirmed_at, type: DateTime
63
+ # property :confirmation_sent_at, type: DateTime
64
+ # property :unconfirmed_email # Only if using reconfirmable
65
+
66
+ ## Lockable
67
+ # property :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
68
+ # validates :failed_attempts, presence: true
69
+ # property :unlock_token, type: String # Only if unlock strategy is :email or :both
70
+ # property :locked_at, type: DateTime
71
+
72
+ ## Token authenticatable
73
+ # property :authentication_token, type: String
79
74
 
80
75
  RUBY
81
76
  end
77
+
78
+ def rails5?
79
+ Rails.version.start_with? '5'
80
+ end
81
+
82
+ def migration_version
83
+ if rails5?
84
+ "[#{Rails::VERSION::MAJOR}.#{Rails::VERSION::MINOR}]"
85
+ end
86
+ end
82
87
  end
83
88
  end
84
89
  end
@@ -0,0 +1,10 @@
1
+ class DeviseCreateUserConstraintsAndIndexes < Neo4j::Migrations::Base
2
+ def change
3
+ add_index :<%= table_name %>, :email, force: true
4
+ add_index :<%= table_name %>, :remember_token, force: true
5
+ add_index :<%= table_name %>, :reset_password_token, force: true
6
+ # add_index :<%= table_name %>, :confirmation_token, force: true
7
+ # add_index :<%= table_name %>, :unlock_token, force: true
8
+ # add_index :<%= table_name %>, :authentication_token, force: true
9
+ end
10
+ end
@@ -12,7 +12,7 @@ class Neo4j::Generators::ModelGeneratorTest < Rails::Generators::TestCase
12
12
  assert content =~ /class #{klass}(\(.+\))?(.*?)\nend/m, "Expected to have class #{klass}"
13
13
  yield $2.strip if block_given?
14
14
  end
15
-
15
+
16
16
  test "invoke with model name" do
17
17
  content = run_generator %w(Player)
18
18
 
@@ -22,5 +22,4 @@ class Neo4j::Generators::ModelGeneratorTest < Rails::Generators::TestCase
22
22
  end
23
23
  end
24
24
  end
25
-
26
25
  end
data/test/orm/neo4j.rb CHANGED
@@ -34,12 +34,17 @@ def create_session
34
34
  end
35
35
 
36
36
  def create_embedded_session
37
+ # TODO: Replace with new stuff
37
38
  session = Neo4j::Session.open(:impermanent_db, EMBEDDED_DB_PATH, auto_commit: true)
38
39
  session.start
39
40
  end
40
41
 
42
+ NEO4J_ADAPTOR = Neo4j::Core::CypherSession::Adaptors::HTTP.new(ENV['NEO4J_URL'] || 'http://localhost:7474')
41
43
  def create_server_session
42
- Neo4j::Session.open(:server_db, "http://localhost:7474")
44
+ Neo4j::ActiveBase.current_session = Neo4j::Core::CypherSession.new(NEO4J_ADAPTOR)
45
+ Neo4j::ActiveBase.on_establish_session do
46
+ Neo4j::Core::CypherSession.new(NEO4J_ADAPTOR)
47
+ end
43
48
  end
44
49
 
45
50
  FileUtils.rm_rf(EMBEDDED_DB_PATH)
@@ -47,12 +52,20 @@ FileUtils.rm_rf(EMBEDDED_DB_PATH)
47
52
  Dir["#{File.dirname(__FILE__)}/shared_examples/**/*.rb"].each { |f| require f }
48
53
 
49
54
  def delete_db
50
- Neo4j::Session.current._query('MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r')
55
+ Neo4j::ActiveBase.current_session.query('MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE n,r')
51
56
  end
52
57
 
53
58
  class ActiveSupport::TestCase
54
59
  setup do
55
- create_session unless Neo4j::Session.current
60
+ create_session unless Neo4j::ActiveBase.current_session
61
+
62
+ session = Neo4j::ActiveBase.current_session
63
+ session.query('CREATE CONSTRAINT ON (n:User) ASSERT n.uuid IS UNIQUE')
64
+ session.query('CREATE CONSTRAINT ON (n:Admin) ASSERT n.uuid IS UNIQUE')
65
+ session.query('CREATE CONSTRAINT ON (n:UserOnMainApp) ASSERT n.uuid IS UNIQUE')
66
+ session.query('CREATE CONSTRAINT ON (n:UserOnEngine) ASSERT n.uuid IS UNIQUE')
67
+ session.query('CREATE CONSTRAINT ON (n:UserWithoutEmail) ASSERT n.uuid IS UNIQUE')
68
+
56
69
  delete_db
57
70
  end
58
71
  end
@@ -1,13 +1,14 @@
1
1
  require 'test_helper'
2
+ require 'integration/authenticatable_test'
2
3
 
3
- class AuthenticationOthersTest < ActionDispatch::IntegrationTest
4
+ class AuthenticationOthersTest < Devise::IntegrationTest
4
5
  undef :test_sign_in_stub_in_xml_format
5
6
  test 'sign in stub in xml format' do
6
7
  get new_user_session_path(:format => 'xml')
7
8
  assert_match '<?xml version="1.0" encoding="UTF-8"?>', response.body
8
9
  assert_match /<user>.*<\/user>/m, response.body
9
10
  assert_match '<email></email>', response.body
10
- # slight/lame format different in XML.
11
+ # slight/lame format different in XML.
11
12
  #assert_match '<password nil="true"/></password>', response.body
12
13
  assert_match '<password nil="true"/>', response.body
13
14
  end
@@ -1,8 +1,8 @@
1
1
  require 'test_helper'
2
2
  require 'digest/sha1'
3
+ require 'models/database_authenticatable_test'
3
4
 
4
5
  class DatabaseAuthenticatableTest < ActiveSupport::TestCase
5
-
6
6
  undef :test_should_run_validations_even_when_current_password_is_invalid_or_blank
7
7
  # looks like neo4j wants to run the password validation first
8
8
  test 'should run validations even when current password is invalid or blank' do
@@ -14,4 +14,4 @@ class DatabaseAuthenticatableTest < ActiveSupport::TestCase
14
14
  assert_match "can't be blank", user.errors[:current_password].join
15
15
  end
16
16
 
17
- end
17
+ end
@@ -1,9 +1,9 @@
1
1
  require 'test_helper'
2
+ require 'mapping_test'
2
3
 
3
4
  class MappingTest < ActiveSupport::TestCase
4
-
5
5
  undef :test_find_scope_works_with_single_table_inheritance
6
-
6
+
7
7
  test 'find scope works with single table inheritance' do
8
8
  assert_equal :user, Devise::Mapping.find_scope!(Class.new(User))
9
9
  end
@@ -4,11 +4,9 @@ class Admin
4
4
  include Neo4j::ActiveNode
5
5
  include SharedAdmin
6
6
 
7
- index :email
8
-
9
7
  ## Database authenticatable
10
- property :email, type: String, null: true
11
- property :encrypted_password, type: String, null: true
8
+ property :email, type: String
9
+ property :encrypted_password, type: String
12
10
 
13
11
  ## Recoverable
14
12
  property :reset_password_token, type: String
@@ -16,25 +14,24 @@ class Admin
16
14
 
17
15
  ## Rememberable
18
16
  property :remember_created_at, type: DateTime
19
-
17
+
20
18
  ## Confirmable
21
- property :confirmation_token, type: String, null: true, index: :exact
19
+ property :confirmation_token, type: String
22
20
  property :confirmed_at, type: DateTime
23
21
  property :confirmation_sent_at, type: DateTime
24
22
  property :unconfirmed_email, type: String
25
23
 
26
24
  ## Lockable
27
25
  property :locked_at, type: DateTime
28
-
26
+
29
27
  property :active, type: Boolean, default: false
30
-
28
+
31
29
  property :created_at, type: DateTime
32
30
  property :updated_at, type: DateTime
33
31
 
34
32
  # def active?
35
33
  # return self.active
36
34
  # end
37
-
38
35
  end
39
36
 
40
37
  AdminAdapter = Admin.to_adapter unless Admin.is_a?(OrmAdapter::Base)
@@ -4,17 +4,16 @@ class User
4
4
  include Neo4j::ActiveNode
5
5
  include SharedUser
6
6
 
7
-
8
7
  property :username, type: String
9
- property :facebook_token, type: String, index: :exact
8
+ property :facebook_token, type: String
10
9
  # property :id
11
10
 
12
11
  ## Database authenticatable
13
- property :email, type: String, default: '', null: false, index: :exact
12
+ property :email, type: String, default: ''
14
13
  property :encrypted_password, type: String, default: ''
15
-
14
+
16
15
  ## Recoverable
17
- property :reset_password_token, type: String, index: :exact
16
+ property :reset_password_token, type: String
18
17
  property :reset_password_sent_at, type: DateTime
19
18
 
20
19
  ## Rememberable
@@ -28,14 +27,14 @@ class User
28
27
  property :last_sign_in_ip, type: String
29
28
 
30
29
  ## Confirmable
31
- property :confirmation_token, type: String, index: :exact
30
+ property :confirmation_token, type: String
32
31
  property :confirmed_at, type: DateTime
33
32
  property :confirmation_sent_at, type: DateTime
34
33
  # property :unconfirmed_email, type: String # Only if using reconfirmable
35
34
 
36
35
  ## Lockable
37
36
  property :failed_attempts, type: Integer, default: 0
38
- property :unlock_token, type: String, index: :exact
37
+ property :unlock_token, type: String
39
38
  property :locked_at, type: DateTime
40
39
 
41
40
  property :created_at, type: DateTime
@@ -2,15 +2,17 @@ require 'shared_user_without_omniauth'
2
2
 
3
3
  class UserOnEngine
4
4
  include Neo4j::ActiveNode
5
- # self.table_name = 'users'
6
5
  include SharedUserWithoutOmniauth
7
6
 
7
+ property :username, type: String
8
+ property :facebook_token, type: String
9
+
8
10
  ## Database authenticatable
9
- property :email, type: String, default: '', null: false, index: :exact
11
+ property :email, type: String, default: ''
10
12
  property :encrypted_password, type: String, default: ''
11
13
 
12
14
  ## Recoverable
13
- property :reset_password_token, type: String, index: :exact
15
+ property :reset_password_token, type: String
14
16
  property :reset_password_sent_at, type: DateTime
15
17
 
16
18
  ## Rememberable
@@ -24,14 +26,14 @@ class UserOnEngine
24
26
  property :last_sign_in_ip, type: String
25
27
 
26
28
  ## Confirmable
27
- property :confirmation_token, type: String, index: :exact
29
+ property :confirmation_token, type: String
28
30
  property :confirmed_at, type: DateTime
29
31
  property :confirmation_sent_at, type: DateTime
30
32
  # property :unconfirmed_email, type: String # Only if using reconfirmable
31
33
 
32
34
  ## Lockable
33
35
  property :failed_attempts, type: Integer, default: 0
34
- property :unlock_token, type: String, index: :exact
36
+ property :unlock_token, type: String
35
37
  property :locked_at, type: DateTime
36
38
 
37
39
  property :created_at, type: DateTime
@@ -4,12 +4,15 @@ class UserOnMainApp
4
4
  include Neo4j::ActiveNode
5
5
  include SharedUserWithoutOmniauth
6
6
 
7
- ## Database authenticatable
8
- property :email, type: String, default: '', null: false, index: :exact
7
+ property :username, type: String
8
+ property :facebook_token, type: String
9
+
10
+ ## Database authenticatable
11
+ property :email, type: String, default: ''
9
12
  property :encrypted_password, type: String, default: ''
10
13
 
11
14
  ## Recoverable
12
- property :reset_password_token, type: String, index: :exact
15
+ property :reset_password_token, type: String
13
16
  property :reset_password_sent_at, type: DateTime
14
17
 
15
18
  ## Rememberable
@@ -23,14 +26,14 @@ class UserOnMainApp
23
26
  property :last_sign_in_ip, type: String
24
27
 
25
28
  ## Confirmable
26
- property :confirmation_token, type: String, index: :exact
29
+ property :confirmation_token, type: String
27
30
  property :confirmed_at, type: DateTime
28
31
  property :confirmation_sent_at, type: DateTime
29
32
  # property :unconfirmed_email, type: String # Only if using reconfirmable
30
33
 
31
34
  ## Lockable
32
35
  property :failed_attempts, type: Integer, default: 0
33
- property :unlock_token, type: String, index: :exact
36
+ property :unlock_token, type: String
34
37
  property :locked_at, type: DateTime
35
38
 
36
39
  property :created_at, type: DateTime
@@ -0,0 +1,32 @@
1
+ require "shared_user_without_email"
2
+
3
+ class UserWithoutEmail
4
+ include Neo4j::ActiveNode
5
+ include SharedUserWithoutEmail
6
+
7
+ property :username, type: String
8
+ property :facebook_token, type: String
9
+
10
+ ## Database authenticatable
11
+ property :email, type: String, default: ''
12
+ property :encrypted_password, type: String, default: ''
13
+
14
+ ## Recoverable
15
+ property :reset_password_token, type: String
16
+ property :reset_password_sent_at, type: DateTime
17
+
18
+ ## Rememberable
19
+ property :remember_created_at, type: DateTime
20
+
21
+ ## Trackable
22
+ property :sign_in_count, type: Integer, default: 0
23
+ property :current_sign_in_at, type: DateTime
24
+ property :last_sign_in_at, type: DateTime
25
+ property :current_sign_in_ip, type: String
26
+ property :last_sign_in_ip, type: String
27
+
28
+ ## Lockable
29
+ property :failed_attempts, type: Integer, default: 0 # Only if lock strategy is :failed_attempts
30
+ property :unlock_token, type: String # Only if unlock strategy is :email or :both
31
+ property :locked_at, type: DateTime
32
+ end
data/test/test_helper.rb CHANGED
@@ -30,7 +30,9 @@ $:.unshift "#{File.dirname(__FILE__)}/support"
30
30
  Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
31
31
 
32
32
  # For generators
33
- require "rails/generators/test_case"
34
- require "generators/devise/install_generator"
35
- require "generators/devise/controllers_generator"
36
- require "generators/devise/views_generator"
33
+ require 'rails/generators/test_case'
34
+ require 'generators/devise/install_generator'
35
+ require 'generators/devise/controllers_generator'
36
+ require 'generators/devise/views_generator'
37
+ require 'test_models'
38
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise-neo4j
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Jackson
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-29 00:00:00.000000000 Z
12
+ date: 2016-12-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: warden
@@ -59,14 +59,14 @@ dependencies:
59
59
  requirements:
60
60
  - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: '3.1'
62
+ version: '4.2'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '3.1'
69
+ version: '4.2'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: neo4j
72
72
  requirement: !ruby/object:Gem::Requirement
@@ -87,18 +87,19 @@ dependencies:
87
87
  requirements:
88
88
  - - ">="
89
89
  - !ruby/object:Gem::Version
90
- version: '3.0'
90
+ version: 3.5.2
91
91
  type: :runtime
92
92
  prerelease: false
93
93
  version_requirements: !ruby/object:Gem::Requirement
94
94
  requirements:
95
95
  - - ">="
96
96
  - !ruby/object:Gem::Version
97
- version: '3.0'
97
+ version: 3.5.2
98
98
  description: Neo4j integration with the Devise authentication framework
99
99
  email:
100
100
  - ben@lissomsolutions.com
101
- executables: []
101
+ executables:
102
+ - rake
102
103
  extensions: []
103
104
  extra_rdoc_files: []
104
105
  files:
@@ -113,6 +114,7 @@ files:
113
114
  - README.md
114
115
  - Rakefile
115
116
  - Vagrantfile
117
+ - bin/rake
116
118
  - devise-neo4j.gemspec
117
119
  - lib/devise-neo4j.rb
118
120
  - lib/devise-neo4j/version.rb
@@ -121,6 +123,7 @@ files:
121
123
  - lib/devise/orm/neo4j/hook.rb
122
124
  - lib/devise/orm/neo4j/nil_class_converter.rb
123
125
  - lib/generators/neo4j/devise_generator.rb
126
+ - lib/generators/neo4j/templates/migration.rb
124
127
  - provisioning/roles/common/tasks/main.yml
125
128
  - provisioning/roles/java/README.md
126
129
  - provisioning/roles/java/files/.gitkeep
@@ -148,11 +151,11 @@ files:
148
151
  - test/rails_app/app/neo4j/user.rb
149
152
  - test/rails_app/app/neo4j/user_on_engine.rb
150
153
  - test/rails_app/app/neo4j/user_on_main_app.rb
154
+ - test/rails_app/app/neo4j/user_without_email.rb
151
155
  - test/rails_app/config/application.rb
152
156
  - test/rails_app/config/environment.rb
153
157
  - test/support/i18n.rb
154
158
  - test/test_helper.rb
155
- - test/test_models.rb
156
159
  homepage: http://github.com/benjackson/devise-neo4j
157
160
  licenses: []
158
161
  metadata: {}
@@ -172,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
175
  version: '0'
173
176
  requirements: []
174
177
  rubyforge_project:
175
- rubygems_version: 2.4.5.1
178
+ rubygems_version: 2.6.8
176
179
  signing_key:
177
180
  specification_version: 4
178
181
  summary: Devise ORM for Neo4j
@@ -186,9 +189,8 @@ test_files:
186
189
  - test/rails_app/app/neo4j/user.rb
187
190
  - test/rails_app/app/neo4j/user_on_engine.rb
188
191
  - test/rails_app/app/neo4j/user_on_main_app.rb
192
+ - test/rails_app/app/neo4j/user_without_email.rb
189
193
  - test/rails_app/config/application.rb
190
194
  - test/rails_app/config/environment.rb
191
195
  - test/support/i18n.rb
192
196
  - test/test_helper.rb
193
- - test/test_models.rb
194
- has_rdoc:
data/test/test_models.rb DELETED
@@ -1,33 +0,0 @@
1
- class Configurable < User
2
- devise :database_authenticatable, :confirmable, :rememberable, :timeoutable, :lockable,
3
- :stretches => 15, :pepper => 'abcdef', :allow_unconfirmed_access_for => 5.days,
4
- :remember_for => 7.days, :timeout_in => 15.minutes, :unlock_in => 10.days
5
- end
6
-
7
- class WithValidation < Admin
8
- devise :database_authenticatable, :validatable, :password_length => 2..6
9
- end
10
-
11
- class UserWithValidation < User
12
- validates_presence_of :username
13
- end
14
-
15
- class UserWithCustomEncryption < User
16
- protected
17
- def password_digest(password)
18
- password.reverse
19
- end
20
- end
21
-
22
- class UserWithVirtualAttributes < User
23
- devise :case_insensitive_keys => [ :email, :email_confirmation ]
24
- validates :email, :presence => true, :confirmation => {:on => :create}
25
- end
26
-
27
- class Several < Admin
28
- devise :validatable
29
- devise :lockable
30
- end
31
-
32
- class Inheritable < Admin
33
- end