neo4j 3.0.0.rc.3 → 3.0.0.rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG +10 -0
- data/Gemfile +5 -4
- data/README.md +1 -1
- data/config/neo4j/add_classnames.yml +1 -0
- data/lib/neo4j.rb +2 -0
- data/lib/neo4j/active_node.rb +4 -1
- data/lib/neo4j/active_node/has_n.rb +75 -9
- data/lib/neo4j/active_node/has_n/association.rb +5 -4
- data/lib/neo4j/active_node/id_property.rb +50 -5
- data/lib/neo4j/active_node/initialize.rb +1 -0
- data/lib/neo4j/active_node/labels.rb +15 -3
- data/lib/neo4j/active_node/orm_adapter.rb +1 -1
- data/lib/neo4j/active_node/persistence.rb +39 -0
- data/lib/neo4j/active_node/query/query_proxy.rb +29 -6
- data/lib/neo4j/active_node/query/query_proxy_find_in_batches.rb +20 -0
- data/lib/neo4j/active_node/query/query_proxy_methods.rb +24 -12
- data/lib/neo4j/active_node/query_methods.rb +21 -10
- data/lib/neo4j/active_node/reflection.rb +85 -0
- data/lib/neo4j/active_rel/callbacks.rb +3 -1
- data/lib/neo4j/active_rel/initialize.rb +2 -2
- data/lib/neo4j/active_rel/persistence.rb +23 -14
- data/lib/neo4j/active_rel/property.rb +9 -10
- data/lib/neo4j/active_rel/query.rb +51 -29
- data/lib/neo4j/active_rel/related_node.rb +2 -6
- data/lib/neo4j/migration.rb +185 -0
- data/lib/neo4j/paginated.rb +2 -1
- data/lib/neo4j/railtie.rb +13 -8
- data/lib/neo4j/shared/persistence.rb +10 -56
- data/lib/neo4j/shared/property.rb +15 -6
- data/lib/neo4j/tasks/migration.rake +23 -0
- data/lib/neo4j/version.rb +1 -1
- metadata +7 -2
@@ -39,16 +39,15 @@ module Neo4j::Shared
|
|
39
39
|
|
40
40
|
def default_properties=(properties)
|
41
41
|
keys = self.class.default_properties.keys
|
42
|
-
@default_properties = properties.
|
42
|
+
@default_properties = properties.select {|key| keys.include?(key) }
|
43
43
|
end
|
44
44
|
|
45
45
|
def default_property(key)
|
46
|
-
|
47
|
-
keys.include?(key.to_sym) ? default_properties[key.to_sym] : nil
|
46
|
+
default_properties[key.to_sym]
|
48
47
|
end
|
49
48
|
|
50
49
|
def default_properties
|
51
|
-
@default_properties ||=
|
50
|
+
@default_properties ||= Hash.new(nil)
|
52
51
|
# keys = self.class.default_properties.keys
|
53
52
|
# _persisted_obj.props.reject{|key| !keys.include?(key)}
|
54
53
|
end
|
@@ -153,6 +152,16 @@ module Neo4j::Shared
|
|
153
152
|
constraint_or_index(name, options)
|
154
153
|
end
|
155
154
|
|
155
|
+
def undef_property(name)
|
156
|
+
raise ArgumentError, "Argument `#{name}` not an attribute" if not attribute_names.include?(name.to_s)
|
157
|
+
|
158
|
+
attribute_methods(name).each do |method|
|
159
|
+
undef_method(method)
|
160
|
+
end
|
161
|
+
|
162
|
+
undef_constraint_or_index(name)
|
163
|
+
end
|
164
|
+
|
156
165
|
def default_property(name, &block)
|
157
166
|
default_properties[name] = block
|
158
167
|
end
|
@@ -163,8 +172,8 @@ module Neo4j::Shared
|
|
163
172
|
end
|
164
173
|
|
165
174
|
def default_property_values(instance)
|
166
|
-
default_properties.
|
167
|
-
result
|
175
|
+
default_properties.each_with_object({}) do |(key, block),result|
|
176
|
+
result[key] = block.call(instance)
|
168
177
|
end
|
169
178
|
end
|
170
179
|
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'neo4j/migration'
|
2
|
+
|
3
|
+
namespace :neo4j do
|
4
|
+
desc "Run a script against the database to perform system-wide changes"
|
5
|
+
task :migrate, [:task_name, :subtask] => :environment do |_, args|
|
6
|
+
migration_task = args[:task_name]
|
7
|
+
task_name_constant = migration_task.split('_').map { |word| word.capitalize }.join('')
|
8
|
+
begin
|
9
|
+
migration_class = "Neo4j::Migration::#{task_name_constant}".constantize
|
10
|
+
rescue NameError
|
11
|
+
load File.join(Rails.root.join('db', 'neo4j-migrate'), "#{migration_task}.rb")
|
12
|
+
migration_class = "#{task_name_constant}".constantize
|
13
|
+
end
|
14
|
+
migration = migration_class.new
|
15
|
+
|
16
|
+
subtask = args[:subtask]
|
17
|
+
if subtask
|
18
|
+
migration.send(subtask)
|
19
|
+
else
|
20
|
+
migration.migrate
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/neo4j/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: neo4j
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.0.rc.
|
4
|
+
version: 3.0.0.rc.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Ronge
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: orm_adapter
|
@@ -109,6 +109,7 @@ files:
|
|
109
109
|
- README.md
|
110
110
|
- bin/neo4j-jars
|
111
111
|
- config/locales/en.yml
|
112
|
+
- config/neo4j/add_classnames.yml
|
112
113
|
- config/neo4j/config.yml
|
113
114
|
- lib/neo4j.rb
|
114
115
|
- lib/neo4j/active_node.rb
|
@@ -124,8 +125,10 @@ files:
|
|
124
125
|
- lib/neo4j/active_node/property.rb
|
125
126
|
- lib/neo4j/active_node/query.rb
|
126
127
|
- lib/neo4j/active_node/query/query_proxy.rb
|
128
|
+
- lib/neo4j/active_node/query/query_proxy_find_in_batches.rb
|
127
129
|
- lib/neo4j/active_node/query/query_proxy_methods.rb
|
128
130
|
- lib/neo4j/active_node/query_methods.rb
|
131
|
+
- lib/neo4j/active_node/reflection.rb
|
129
132
|
- lib/neo4j/active_node/rels.rb
|
130
133
|
- lib/neo4j/active_node/scope.rb
|
131
134
|
- lib/neo4j/active_node/serialized_properties.rb
|
@@ -140,6 +143,7 @@ files:
|
|
140
143
|
- lib/neo4j/active_rel/related_node.rb
|
141
144
|
- lib/neo4j/active_rel/validations.rb
|
142
145
|
- lib/neo4j/config.rb
|
146
|
+
- lib/neo4j/migration.rb
|
143
147
|
- lib/neo4j/paginated.rb
|
144
148
|
- lib/neo4j/railtie.rb
|
145
149
|
- lib/neo4j/shared.rb
|
@@ -148,6 +152,7 @@ files:
|
|
148
152
|
- lib/neo4j/shared/persistence.rb
|
149
153
|
- lib/neo4j/shared/property.rb
|
150
154
|
- lib/neo4j/shared/validations.rb
|
155
|
+
- lib/neo4j/tasks/migration.rake
|
151
156
|
- lib/neo4j/type_converters.rb
|
152
157
|
- lib/neo4j/version.rb
|
153
158
|
- lib/neo4j/wrapper.rb
|