neo4j 6.0.0.alpha.5 → 6.0.0.alpha.7

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: 51e7f7f2111156aec6a405435bfb1d54ba872b21
4
- data.tar.gz: 25ff673e9f3baf99812fdf9a9cf090e7071004b7
3
+ metadata.gz: b0ca6a12d1708b86d03c1c5932a4f251e365c005
4
+ data.tar.gz: 26bc7938b51f0c998ab7065df9db84cccf60a9dc
5
5
  SHA512:
6
- metadata.gz: 510aa9f0861552d70b27a5e15c765ed24c7ee47d6a74a80d11daf402a616da286fb69d4456159c34e3d9c52f8928ae6ad8de85e168592fa1ded6ea8b28340da4
7
- data.tar.gz: b5a78ff50ce7b9815687f7e9dcc619dae0f21dbf68668f0190c7b1b83328948db39bd3eeccb64d0aaefe219e9d3e2af997fff8a8934b81e98518eb659d50a45c
6
+ metadata.gz: 75f1ec8c3a3c26a6047d0257da2652f0e51c4b198cffeff15bd847797cd5a94928788e5010f9c57a3a81693628b5ec7ac0e4fa16190b9d8b58b39b2b61e2e6c5
7
+ data.tar.gz: ba64cd70f047f933e47a0aed2d9daa4b1b39876589fe432537c20c85bdf6f13fdd74e14794d53a9304aaf5a44df573dac7e9933455ccccb28204f9fae4b73330
@@ -3,12 +3,29 @@ 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
+ ## [6.0.0.alpha.7] - 10-19-2015
7
+
8
+ - Remove uniqueness validation for `id_property` because we already have Neo4j constraints
9
+ - Support `config/neo4j.ya?ml`
10
+
11
+ ## [6.0.0.alpha.6] - 10-18-2015
12
+
13
+ ### Changed
14
+
15
+ - Improved eager loading when no with_associations is specified (see #905)
16
+
6
17
  ## [6.0.0.alpha.5] - 10-18-2015
7
18
 
8
19
  ### Changed
9
20
 
10
21
  - Change size and length so that they match expected Ruby / ActiveRecord behavior (see http://stackoverflow.com/questions/6083219/activerecord-size-vs-count and #875)
11
22
 
23
+ ## [6.0.0.alpha.4] - 10-17-2015
24
+
25
+ ### Fixed
26
+
27
+ - `QueryProxy` was not converting Boolean properties correctly
28
+
12
29
  ## [6.0.0.alpha.3] - 10-14-2015
13
30
 
14
31
  ### Removed
@@ -46,6 +63,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
46
63
  - Certain actions that were intended as once-in-the-app's-lifetime events, notably schema operations, will only occur immediately upon the first session's establishment.
47
64
  - Context now set for Model.all QueryProxy so that logs can reflect that it wasn't just a raw Cypher query
48
65
 
66
+ ## [5.2.11] - 10-18-2015
67
+
68
+ ### Fixed
69
+ - Unable to give additional options as first argument to chained QueryProxy method
70
+
49
71
  ## [5.2.10] - 10-14-2015
50
72
 
51
73
  ### Fixed
@@ -158,7 +158,7 @@ module Neo4j::ActiveNode
158
158
  name = name.to_sym
159
159
  hash = association_proxy_hash(name, options)
160
160
  association_proxy_cache_fetch(hash) do
161
- if result_cache = self.instance_variable_get('@source_query_proxy_result_cache')
161
+ if result_cache = self.instance_variable_get('@source_proxy_result_cache')
162
162
  result_by_previous_id = previous_proxy_results_by_previous_id(result_cache, name)
163
163
 
164
164
  result_cache.inject(nil) do |proxy_to_return, object|
@@ -184,7 +184,11 @@ module Neo4j::ActiveNode
184
184
  query_proxy = self.class.as(:previous).where(neo_id: result_cache.map(&:neo_id))
185
185
  query_proxy = self.class.send(:association_query_proxy, association_name, previous_query_proxy: query_proxy, node: :next, optional: true)
186
186
 
187
- Hash[*query_proxy.pluck('ID(previous)', 'collect(next)').flatten(1)]
187
+ Hash[*query_proxy.pluck('ID(previous)', 'collect(next)').flatten(1)].each do |_, records|
188
+ records.each do |record|
189
+ record.instance_variable_set('@source_proxy_result_cache', records)
190
+ end
191
+ end
188
192
  end
189
193
 
190
194
  module ClassMethods
@@ -332,10 +336,7 @@ module Neo4j::ActiveNode
332
336
  define_method(name) do |node = nil, rel = nil, options = {}|
333
337
  # return [].freeze unless self._persisted_obj
334
338
 
335
- if node.is_a?(Hash)
336
- options = node
337
- node = nil
338
- end
339
+ options, node = node, nil if node.is_a?(Hash)
339
340
 
340
341
  association_proxy(name, {node: node, rel: rel, source_object: self, labels: options[:labels]}.merge!(options))
341
342
  end
@@ -345,6 +346,8 @@ module Neo4j::ActiveNode
345
346
  define_has_many_id_methods(name)
346
347
 
347
348
  define_class_method(name) do |node = nil, rel = nil, options = {}|
349
+ options, node = node, nil if node.is_a?(Hash)
350
+
348
351
  association_proxy(name, {node: node, rel: rel, labels: options[:labels]}.merge!(options))
349
352
  end
350
353
  end
@@ -383,6 +386,8 @@ module Neo4j::ActiveNode
383
386
  define_has_one_id_methods(name)
384
387
 
385
388
  define_class_method(name) do |node = nil, rel = nil, options = {}|
389
+ options, node = node, nil if node.is_a?(Hash)
390
+
386
391
  association_proxy(name, {node: node, rel: rel, labels: options[:labels]}.merge!(options))
387
392
  end
388
393
  end
@@ -403,10 +408,7 @@ module Neo4j::ActiveNode
403
408
 
404
409
  def define_has_one_getter(name)
405
410
  define_method(name) do |node = nil, rel = nil, options = {}|
406
- if node.is_a?(Hash)
407
- options = node
408
- node = nil
409
- end
411
+ options, node = node, nil if node.is_a?(Hash)
410
412
 
411
413
  # Return all results if a variable-length relationship length was given
412
414
  association_proxy = association_proxy(name, {node: node, rel: rel}.merge!(options))
@@ -74,8 +74,6 @@ module Neo4j::ActiveNode
74
74
  _persisted_obj ? #{name.to_sym == :id ? 'attribute(\'id\')' : name} : nil
75
75
  end
76
76
 
77
- validates_uniqueness_of :#{name}
78
-
79
77
  property :#{name}
80
78
  ), __FILE__, __LINE__)
81
79
  end
@@ -14,9 +14,8 @@ module Neo4j
14
14
  end
15
15
 
16
16
  def result(node = true, rel = nil)
17
- puts '@result_cache', @result_cache.inspect
18
17
  @result_cache ||= {}
19
- return result_cache_for(node, rel) if has_result_cache?(node, rel)
18
+ return result_cache_for(node, rel) if result_cache?(node, rel)
20
19
 
21
20
  pluck_vars = []
22
21
  pluck_vars << identity if node
@@ -26,13 +25,13 @@ module Neo4j
26
25
 
27
26
  result.each do |object|
28
27
  object.instance_variable_set('@source_query_proxy', self)
29
- object.instance_variable_set('@source_query_proxy_result_cache', result)
28
+ object.instance_variable_set('@source_proxy_result_cache', result)
30
29
  end
31
30
 
32
31
  @result_cache[[node, rel]] ||= result
33
32
  end
34
33
 
35
- def has_result_cache?(node = true, rel = nil)
34
+ def result_cache?(node = true, rel = nil)
36
35
  !!result_cache_for(node, rel)
37
36
  end
38
37
 
@@ -64,17 +64,10 @@ module Neo4j
64
64
  end
65
65
 
66
66
  def size
67
- puts 'size'
68
- if has_result_cache?
69
- result_cache_for.length
70
- else
71
- count
72
- end
67
+ result_cache? ? result_cache_for.length : count
73
68
  end
74
69
 
75
- def length
76
- to_a.length
77
- end
70
+ delegate :length, to: :to_a
78
71
 
79
72
  # TODO: update this with public API methods if/when they are exposed
80
73
  def limit_value
@@ -250,10 +243,8 @@ module Neo4j
250
243
 
251
244
  def exists_query_start(condition, target)
252
245
  case condition
253
- when Integer
254
- self.where("ID(#{target}) = {exists_condition}").params(exists_condition: condition)
255
- when Hash
256
- self.where(condition.keys.first => condition.values.first)
246
+ when Integer then self.where("ID(#{target}) = {exists_condition}").params(exists_condition: condition)
247
+ when Hash then self.where(condition.keys.first => condition.values.first)
257
248
  else
258
249
  self
259
250
  end
@@ -40,12 +40,32 @@ module Neo4j
40
40
  cfg.sessions ||= []
41
41
  end
42
42
 
43
+ def config_data
44
+ @config_data ||= if yaml_path
45
+ HashWithIndifferentAccess.new(YAML.load(yaml_path.read)[Rails.env])
46
+ else
47
+ {}
48
+ end
49
+ end
50
+
51
+ def yaml_path
52
+ @yaml_path ||= %w(config/neo4j.yml config/neo4j.yaml).map do |path|
53
+ Rails.root.join(path)
54
+ end.detect(&:exist?)
55
+ end
56
+
43
57
  def default_session_type
44
- ENV['NEO4J_PATH'] ? :embedded_db : :server_db
58
+ if ENV['NEO4J_PATH']
59
+ :embedded_db
60
+ else
61
+ config_data[:type] || :server_db
62
+ end.to_sym
45
63
  end
46
64
 
47
65
  def default_session_path
48
- ENV['NEO4J_URL'] || ENV['NEO4J_PATH'] || 'http://localhost:7474'
66
+ ENV['NEO4J_URL'] || ENV['NEO4J_PATH'] ||
67
+ config_data[:url] || config_data[:path] ||
68
+ 'http://localhost:7474'
49
69
  end
50
70
 
51
71
  def start_embedded_session(session)
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = '6.0.0.alpha.5'
2
+ VERSION = '6.0.0.alpha.7'
3
3
  end
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: 6.0.0.alpha.5
4
+ version: 6.0.0.alpha.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andreas Ronge, Brian Underwood, Chris Grigg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-18 00:00:00.000000000 Z
11
+ date: 2015-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: orm_adapter