neo4j 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG +10 -0
- data/Gemfile +6 -16
- data/README.md +5 -2
- data/bin/neo4j-jars +6 -6
- data/lib/neo4j.rb +13 -9
- data/lib/neo4j/active_node.rb +9 -9
- data/lib/neo4j/active_node/dependent.rb +11 -0
- data/lib/neo4j/active_node/dependent/association_methods.rb +28 -0
- data/lib/neo4j/active_node/dependent/query_proxy_methods.rb +48 -0
- data/lib/neo4j/active_node/has_n.rb +124 -112
- data/lib/neo4j/active_node/has_n/association.rb +45 -30
- data/lib/neo4j/active_node/id_property.rb +22 -19
- data/lib/neo4j/active_node/initialize.rb +2 -4
- data/lib/neo4j/active_node/labels.rb +23 -22
- data/lib/neo4j/active_node/node_wrapper.rb +5 -8
- data/lib/neo4j/active_node/orm_adapter.rb +2 -4
- data/lib/neo4j/active_node/persistence.rb +5 -10
- data/lib/neo4j/active_node/property.rb +3 -4
- data/lib/neo4j/active_node/query.rb +27 -6
- data/lib/neo4j/active_node/query/query_proxy.rb +65 -110
- data/lib/neo4j/active_node/query/query_proxy_enumerable.rb +67 -0
- data/lib/neo4j/active_node/query/query_proxy_find_in_batches.rb +0 -1
- data/lib/neo4j/active_node/query/query_proxy_methods.rb +29 -28
- data/lib/neo4j/active_node/query_methods.rb +6 -6
- data/lib/neo4j/active_node/reflection.rb +3 -2
- data/lib/neo4j/active_node/rels.rb +1 -1
- data/lib/neo4j/active_node/scope.rb +13 -8
- data/lib/neo4j/active_node/validations.rb +5 -6
- data/lib/neo4j/active_rel.rb +1 -2
- data/lib/neo4j/active_rel/callbacks.rb +3 -3
- data/lib/neo4j/active_rel/persistence.rb +9 -7
- data/lib/neo4j/active_rel/property.rb +12 -4
- data/lib/neo4j/active_rel/query.rb +6 -8
- data/lib/neo4j/active_rel/rel_wrapper.rb +0 -2
- data/lib/neo4j/active_rel/related_node.rb +4 -5
- data/lib/neo4j/active_rel/types.rb +4 -6
- data/lib/neo4j/active_rel/validations.rb +0 -1
- data/lib/neo4j/config.rb +11 -23
- data/lib/neo4j/core/query.rb +1 -1
- data/lib/neo4j/migration.rb +17 -18
- data/lib/neo4j/paginated.rb +4 -4
- data/lib/neo4j/railtie.rb +19 -19
- data/lib/neo4j/shared.rb +7 -3
- data/lib/neo4j/shared/callbacks.rb +15 -4
- data/lib/neo4j/shared/identity.rb +2 -2
- data/lib/neo4j/shared/persistence.rb +10 -21
- data/lib/neo4j/shared/property.rb +17 -30
- data/lib/neo4j/shared/rel_type_converters.rb +1 -3
- data/lib/neo4j/shared/type_converters.rb +13 -25
- data/lib/neo4j/shared/validations.rb +3 -3
- data/lib/neo4j/tasks/migration.rake +7 -7
- data/lib/neo4j/type_converters.rb +1 -1
- data/lib/neo4j/version.rb +1 -1
- data/lib/rails/generators/neo4j/model/model_generator.rb +16 -12
- data/lib/rails/generators/neo4j_generator.rb +18 -18
- data/neo4j.gemspec +22 -18
- metadata +103 -1
@@ -1,16 +1,16 @@
|
|
1
1
|
require 'neo4j/migration'
|
2
2
|
|
3
3
|
namespace :neo4j do
|
4
|
-
desc
|
4
|
+
desc 'Run a script against the database to perform system-wide changes'
|
5
5
|
task :migrate, [:task_name, :subtask] => :environment do |_, args|
|
6
6
|
path = Rake.original_dir
|
7
7
|
migration_task = args[:task_name]
|
8
|
-
task_name_constant = migration_task.split('_').map
|
8
|
+
task_name_constant = migration_task.split('_').map(&:capitalize).join('')
|
9
9
|
begin
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
migration_class = "Neo4j::Migration::#{task_name_constant}".constantize
|
11
|
+
rescue NameError
|
12
|
+
load File.join(path, 'db', 'neo4j-migrate', "#{migration_task}.rb")
|
13
|
+
migration_class = "#{task_name_constant}".constantize
|
14
14
|
end
|
15
15
|
migration = migration_class.new(path)
|
16
16
|
|
@@ -21,4 +21,4 @@ namespace :neo4j do
|
|
21
21
|
migration.migrate
|
22
22
|
end
|
23
23
|
end
|
24
|
-
end
|
24
|
+
end
|
data/lib/neo4j/version.rb
CHANGED
@@ -1,21 +1,22 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), '..', '..', '..', '..','neo4j.rb')
|
1
|
+
require File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'neo4j.rb')
|
2
2
|
|
3
3
|
class Neo4j::Generators::ModelGenerator < Neo4j::Generators::Base #:nodoc:
|
4
|
-
argument :attributes, :
|
4
|
+
argument :attributes, type: :array, default: [], banner: 'field:type field:type'
|
5
5
|
|
6
6
|
check_class_collision
|
7
7
|
|
8
|
-
class_option :timestamps, :
|
9
|
-
class_option :parent, :
|
10
|
-
class_option :indices, :
|
11
|
-
class_option :has_one, :
|
12
|
-
class_option :has_many, :
|
8
|
+
class_option :timestamps, type: :boolean
|
9
|
+
class_option :parent, type: :string, desc: 'The parent class for the generated model'
|
10
|
+
class_option :indices, type: :array, desc: 'The properties which should be indexed'
|
11
|
+
class_option :has_one, type: :array, desc: 'A list of has_one relationships'
|
12
|
+
class_option :has_many, type: :array, desc: 'A list of has_many relationships'
|
13
13
|
|
14
14
|
def create_model_file
|
15
|
-
template
|
15
|
+
template 'model.erb', File.join('app/models', "#{singular_name}.rb")
|
16
16
|
end
|
17
17
|
|
18
18
|
protected
|
19
|
+
|
19
20
|
def migration?
|
20
21
|
false
|
21
22
|
end
|
@@ -24,12 +25,13 @@ class Neo4j::Generators::ModelGenerator < Neo4j::Generators::Base #:nodoc:
|
|
24
25
|
options[:timestamps]
|
25
26
|
end
|
26
27
|
|
28
|
+
# rubocop:disable Style/PredicateName
|
27
29
|
def has_many?
|
28
30
|
options[:has_many]
|
29
31
|
end
|
30
32
|
|
31
33
|
def has_many_statements
|
32
|
-
txt =
|
34
|
+
txt = ''
|
33
35
|
options[:has_many].each do |key|
|
34
36
|
txt << has_x('has_many', key)
|
35
37
|
end
|
@@ -46,12 +48,13 @@ class Neo4j::Generators::ModelGenerator < Neo4j::Generators::Base #:nodoc:
|
|
46
48
|
end
|
47
49
|
|
48
50
|
def has_one_statements
|
49
|
-
txt =
|
51
|
+
txt = ''
|
50
52
|
options[:has_one].each do |key|
|
51
53
|
txt << has_x('has_one', key)
|
52
54
|
end
|
53
55
|
txt
|
54
56
|
end
|
57
|
+
# rubocop:enable Style/PredicateName
|
55
58
|
|
56
59
|
def indices?
|
57
60
|
options[:indices]
|
@@ -69,13 +72,14 @@ class Neo4j::Generators::ModelGenerator < Neo4j::Generators::Base #:nodoc:
|
|
69
72
|
end
|
70
73
|
|
71
74
|
def timestamp_statements
|
72
|
-
|
75
|
+
'
|
73
76
|
property :created_at, type: DateTime
|
74
77
|
# property :created_on, type: Date
|
75
78
|
|
76
79
|
property :updated_at, type: DateTime
|
77
80
|
# property :updated_on, type: Date
|
78
|
-
|
81
|
+
|
82
|
+
'
|
79
83
|
end
|
80
84
|
|
81
85
|
hook_for :test_framework
|
@@ -19,11 +19,11 @@ class Neo4j::Generators::ActiveModel < Rails::Generators::ActiveModel #:nodoc:
|
|
19
19
|
"#{klass}.all"
|
20
20
|
end
|
21
21
|
|
22
|
-
def self.find(klass, params=nil)
|
22
|
+
def self.find(klass, params = nil)
|
23
23
|
"#{klass}.find(#{params})"
|
24
24
|
end
|
25
25
|
|
26
|
-
def self.build(klass, params=nil)
|
26
|
+
def self.build(klass, params = nil)
|
27
27
|
if params
|
28
28
|
"#{klass}.new(#{params})"
|
29
29
|
else
|
@@ -35,7 +35,7 @@ class Neo4j::Generators::ActiveModel < Rails::Generators::ActiveModel #:nodoc:
|
|
35
35
|
"#{name}.save"
|
36
36
|
end
|
37
37
|
|
38
|
-
def update_attributes(params=nil)
|
38
|
+
def update_attributes(params = nil)
|
39
39
|
"#{name}.update_attributes(#{params})"
|
40
40
|
end
|
41
41
|
|
@@ -53,22 +53,22 @@ module Rails
|
|
53
53
|
class GeneratedAttribute #:nodoc:
|
54
54
|
def type_class
|
55
55
|
case type.to_s.downcase
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
56
|
+
when 'any' then
|
57
|
+
'any'
|
58
|
+
when 'datetime' then
|
59
|
+
'DateTime'
|
60
|
+
when 'date' then
|
61
|
+
'Date'
|
62
|
+
when 'text' then
|
63
|
+
'String'
|
64
|
+
when 'integer', 'number', 'fixnum' then
|
65
|
+
'Integer'
|
66
|
+
when 'float' then
|
67
|
+
'Float'
|
68
|
+
else
|
69
|
+
'String'
|
70
70
|
end
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
74
|
-
end
|
74
|
+
end
|
data/neo4j.gemspec
CHANGED
@@ -1,39 +1,43 @@
|
|
1
1
|
lib = File.expand_path('../lib/', __FILE__)
|
2
|
-
|
2
|
+
$LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
|
3
3
|
|
4
4
|
require 'neo4j/version'
|
5
5
|
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
|
-
s.name =
|
8
|
+
s.name = 'neo4j'
|
9
9
|
s.version = Neo4j::VERSION
|
10
|
-
s.required_ruby_version =
|
10
|
+
s.required_ruby_version = '>= 1.9.1'
|
11
11
|
|
12
|
-
s.authors =
|
12
|
+
s.authors = 'Andreas Ronge, Brian Underwood, Chris Grigg'
|
13
13
|
s.email = 'andreas.ronge@gmail.com, brian@brian-underwood.codes, chris@subvertallmedia.com'
|
14
|
-
s.homepage =
|
14
|
+
s.homepage = 'https://github.com/neo4jrb/neo4j/'
|
15
15
|
s.rubyforge_project = 'neo4j'
|
16
|
-
s.summary =
|
16
|
+
s.summary = 'A graph database for Ruby'
|
17
17
|
s.license = 'MIT'
|
18
18
|
s.description = <<-EOF
|
19
19
|
A Neo4j OGM (Object-Graph-Mapper) for use in Ruby on Rails and Rack frameworks heavily inspired by ActiveRecord.
|
20
20
|
EOF
|
21
21
|
|
22
22
|
s.require_path = 'lib'
|
23
|
-
s.files = Dir.glob(
|
23
|
+
s.files = Dir.glob('{bin,lib,config}/**/*') + %w(README.md CHANGELOG CONTRIBUTORS Gemfile neo4j.gemspec)
|
24
24
|
s.executables = ['neo4j-jars']
|
25
25
|
s.has_rdoc = true
|
26
26
|
s.extra_rdoc_files = %w( README.md )
|
27
|
-
s.rdoc_options = [
|
27
|
+
s.rdoc_options = ['--quiet', '--title', 'Neo4j.rb', '--line-numbers', '--main', 'README.rdoc', '--inline-source']
|
28
28
|
|
29
|
-
s.add_dependency('orm_adapter',
|
30
|
-
s.add_dependency(
|
31
|
-
s.add_dependency(
|
32
|
-
s.add_dependency(
|
33
|
-
s.add_dependency('active_attr',
|
34
|
-
s.add_dependency(
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
29
|
+
s.add_dependency('orm_adapter', '~> 0.5.0')
|
30
|
+
s.add_dependency('activemodel', '~> 4')
|
31
|
+
s.add_dependency('activesupport', '~> 4')
|
32
|
+
s.add_dependency('railties', '~> 4')
|
33
|
+
s.add_dependency('active_attr', '~> 0.8')
|
34
|
+
s.add_dependency('neo4j-core', '~> 4.0.0')
|
35
|
+
s.add_dependency('neo4j-community', '~> 2.0') if RUBY_PLATFORM =~ /java/
|
36
|
+
s.add_development_dependency('pry')
|
37
|
+
s.add_development_dependency('os')
|
38
|
+
s.add_development_dependency('rake')
|
39
|
+
s.add_development_dependency('yard')
|
40
|
+
s.add_development_dependency('guard')
|
41
|
+
s.add_development_dependency('guard-rubocop')
|
42
|
+
s.add_development_dependency('guard-rspec')
|
39
43
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neo4j
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Ronge, Brian Underwood, Chris Grigg
|
@@ -94,6 +94,104 @@ dependencies:
|
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: 4.0.0
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: pry
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: os
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rake
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: yard
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: guard
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: guard-rubocop
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: guard-rspec
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :development
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
97
195
|
description: |
|
98
196
|
A Neo4j OGM (Object-Graph-Mapper) for use in Ruby on Rails and Rack frameworks heavily inspired by ActiveRecord.
|
99
197
|
email: andreas.ronge@gmail.com, brian@brian-underwood.codes, chris@subvertallmedia.com
|
@@ -114,6 +212,9 @@ files:
|
|
114
212
|
- lib/neo4j.rb
|
115
213
|
- lib/neo4j/active_node.rb
|
116
214
|
- lib/neo4j/active_node/callbacks.rb
|
215
|
+
- lib/neo4j/active_node/dependent.rb
|
216
|
+
- lib/neo4j/active_node/dependent/association_methods.rb
|
217
|
+
- lib/neo4j/active_node/dependent/query_proxy_methods.rb
|
117
218
|
- lib/neo4j/active_node/has_n.rb
|
118
219
|
- lib/neo4j/active_node/has_n/association.rb
|
119
220
|
- lib/neo4j/active_node/id_property.rb
|
@@ -125,6 +226,7 @@ files:
|
|
125
226
|
- lib/neo4j/active_node/property.rb
|
126
227
|
- lib/neo4j/active_node/query.rb
|
127
228
|
- lib/neo4j/active_node/query/query_proxy.rb
|
229
|
+
- lib/neo4j/active_node/query/query_proxy_enumerable.rb
|
128
230
|
- lib/neo4j/active_node/query/query_proxy_find_in_batches.rb
|
129
231
|
- lib/neo4j/active_node/query/query_proxy_methods.rb
|
130
232
|
- lib/neo4j/active_node/query_methods.rb
|