neo4j 6.0.0.alpha.8 → 6.0.0.alpha.9

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: 715265763c28f04acb9e54f3dc25dbffc1257df8
4
- data.tar.gz: 4947537ea67beca1ffa59d22837079129425562b
3
+ metadata.gz: 5e9a0580979b896fd0ff1da7bdb6e42e8dc5a3dd
4
+ data.tar.gz: 9709fe48514ff2aad702b9e8606ca25f9afb0e64
5
5
  SHA512:
6
- metadata.gz: 8d6b66ede21482b9183f5276654c66e88daedae44f20befa26b6b8c4206f6ed9e49c76e2fdf7ff88f4c2bafbba521ac25b29194368f7dccaddf25c6ee01736e5
7
- data.tar.gz: 6caec430e130b5810a20c57c5fe8874b97d77e295cda0e191cdd08d362d8f10a6359b517889af7dcfad5f2d769e8979ce713f3faff702005970be3da349cfab0
6
+ metadata.gz: 96781c2cb44acf832b0eb205ffa25dd7a7fa86ea058d45ef647be8dc02bb5a8d0c2ce242a5d9ff75a4143c86f59a55ae7d4c4bd279c00a752c109eb3cef7057e
7
+ data.tar.gz: 46ebc2cf7bf7a7b0883eb36c46ed327762bba6e77a3d17a6dbb74e7d80b255225ae2ac64b149f8d662bf35263643364ee2d386cc390611cb56dbe9956c796d01
@@ -3,7 +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
- ## [Unreleased]
6
+ ## [6.0.0.alpha.9] - 10-27-2015
7
+
8
+ ### Fixed
9
+ - `uninitialized constant Neo4j::Core::CypherSession` error
10
+
11
+ ## [6.0.0.alpha.8] - 10-19-2015
7
12
 
8
13
  ### Added
9
14
 
@@ -74,6 +79,17 @@ This project adheres to [Semantic Versioning](http://semver.org/).
74
79
  - 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.
75
80
  - Context now set for Model.all QueryProxy so that logs can reflect that it wasn't just a raw Cypher query
76
81
 
82
+ ## [5.2.13] - 10-26-2015
83
+
84
+ ### Fixed
85
+ - Fixed `#after_initialize` and `#after_find` callbacks.
86
+ - The `#touch` method should to raise errors when unsuccessful and avoid `#attributes` for performance.
87
+
88
+ ## [5.2.12] - 10-25-2015
89
+
90
+ ### Fixed
91
+ - Fix the `#touch` method for `ActiveNode` and `ActiveRel`
92
+
77
93
  ## [5.2.11] - 10-18-2015
78
94
 
79
95
  ### Fixed
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source 'http://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'neo4j-core', github: 'neo4jrb/neo4j-core', branch: 'master'
5
+ # gem 'neo4j-core', github: 'neo4jrb/neo4j-core', branch: 'master'
6
6
  # gem 'neo4j-core', path: '../neo4j-core'
7
7
 
8
8
  # gem 'active_attr', github: 'neo4jrb/active_attr', branch: 'performance'
data/README.md CHANGED
@@ -48,12 +48,15 @@ Neo4j.rb v4.1.0 was released in January of 2015. Its changes are outlined [here]
48
48
 
49
49
  ## Neo4j version support
50
50
 
51
- | **Neo4j Version** | v2.x | v3.x | >= v4.x |
52
- |-------------------|------|------|---------|
53
- | 1.9.x | Yes | No | No |
54
- | 2.0.x | No | Yes | No |
55
- | 2.1.x | No | Yes | Yes |
56
- | 2.2.x | No | No | Yes |
51
+ | **Neo4j Version** | v2.x | v3.x | >= v4.x |
52
+ |-------------------|------|-------|---------|
53
+ | 1.9.x | Yes | No | No |
54
+ | 2.0.x | No | Yes | No |
55
+ | 2.1.x | No | Yes | Yes * |
56
+ | 2.2.x | No | No | Yes |
57
+ | 2.3.x | No | No | Yes |
58
+
59
+ `*` Neo4j.rb >= 4.x doesn't support Neo4j versions before 2.1.5. To use 2.1.x you should upgrade to a version >= 2.1.5
57
60
 
58
61
  ## Neo4j feature support
59
62
 
@@ -10,6 +10,7 @@ require 'neo4j/version'
10
10
  # require "active_support/time_with_zone"
11
11
 
12
12
  require 'neo4j-core'
13
+ require 'neo4j/core/cypher_session'
13
14
  require 'neo4j/core/query'
14
15
  require 'active_model'
15
16
  require 'active_support/concern'
@@ -47,19 +47,19 @@ module Neo4j
47
47
  @_persisted_obj.remove_label(*label)
48
48
  end
49
49
 
50
- def self.add_wrapped_class(model)
51
- _wrapped_classes << model
50
+ def self._wrapped_classes
51
+ WRAPPED_CLASSES
52
52
  end
53
53
 
54
- def self._wrapped_classes
55
- Neo4j::ActiveNode::Labels::WRAPPED_CLASSES
54
+ def self.add_wrapped_class(model)
55
+ _wrapped_classes << model
56
56
  end
57
57
 
58
+ # Finds an appropriate matching model given a set of labels
59
+ # which are assigned to a node
58
60
  def self.model_for_labels(labels)
59
- MODELS_FOR_LABELS_CACHE[labels] || model_cache(labels)
60
- end
61
+ return MODELS_FOR_LABELS_CACHE[labels] if MODELS_FOR_LABELS_CACHE[labels]
61
62
 
62
- def self.model_cache(labels)
63
63
  models = WRAPPED_CLASSES.select do |model|
64
64
  (model.mapped_label_names - labels).size == 0
65
65
  end
@@ -69,12 +69,10 @@ module Neo4j
69
69
  end
70
70
  end
71
71
 
72
- def self.clear_model_for_label_cache
73
- MODELS_FOR_LABELS_CACHE.clear
74
- end
75
-
76
72
  def self.clear_wrapped_models
77
73
  WRAPPED_CLASSES.clear
74
+ MODELS_FOR_LABELS_CACHE.clear
75
+ Neo4j::Node::Wrapper::CONSTANTS_FOR_LABELS_CACHE.clear
78
76
  end
79
77
 
80
78
  module ClassMethods
@@ -91,7 +89,7 @@ module Neo4j
91
89
  find_by_id(map_id.call(id))
92
90
  end
93
91
  fail Neo4j::RecordNotFound if result.blank?
94
- result
92
+ result.tap { |r| find_callbacks!(r) }
95
93
  end
96
94
 
97
95
  # Finds the first record matching the specified conditions. There is no implied ordering so if order matters, you should specify it yourself.
@@ -164,6 +162,17 @@ module Neo4j
164
162
 
165
163
  private
166
164
 
165
+ def find_callbacks!(result)
166
+ case result
167
+ when Neo4j::ActiveNode
168
+ result.run_callbacks(:find)
169
+ when Array
170
+ result.each { |r| find_callbacks!(r) }
171
+ else
172
+ result
173
+ end
174
+ end
175
+
167
176
  def label_for_model
168
177
  (self.name.nil? ? object_id.to_s.to_sym : decorated_label_name)
169
178
  end
@@ -59,13 +59,13 @@ module Neo4j
59
59
  end
60
60
  end
61
61
 
62
- def add_wrapped_class(type)
63
- # _wrapped_classes[type.to_sym.downcase] = self.name
64
- _wrapped_classes[type.to_sym] = self.name
62
+ def _wrapped_classes
63
+ WRAPPED_CLASSES
65
64
  end
66
65
 
67
- def _wrapped_classes
68
- Neo4j::ActiveRel::Types::WRAPPED_CLASSES
66
+ def add_wrapped_class(type)
67
+ # WRAPPED_CLASSES[type.to_sym.downcase] = self.name
68
+ _wrapped_classes[type.to_sym] = self.name
69
69
  end
70
70
 
71
71
  def rel_type?
@@ -9,8 +9,13 @@ module Neo4j
9
9
 
10
10
  included do
11
11
  include ActiveModel::Validations::Callbacks
12
+ # after_find is triggered by the `find` method defined in lib/neo4j/active_node/id_property.rb
12
13
  define_model_callbacks :initialize, :find, only: :after
13
- define_model_callbacks :save, :create, :update, :destroy
14
+ define_model_callbacks :save, :create, :update, :destroy, :touch
15
+ end
16
+
17
+ def initialize(args = nil)
18
+ run_callbacks(:initialize) { super }
14
19
  end
15
20
 
16
21
  def destroy #:nodoc:
@@ -25,7 +30,7 @@ module Neo4j
25
30
  tx.close if tx
26
31
  end
27
32
 
28
- def touch(*) #:nodoc:
33
+ def touch #:nodoc:
29
34
  run_callbacks(:touch) { super }
30
35
  end
31
36
 
@@ -82,6 +82,11 @@ module Neo4j::Shared
82
82
  end
83
83
  end
84
84
 
85
+ def touch
86
+ fail 'Cannot touch on a new record object' unless persisted?
87
+ update_attribute!(:updated_at, Time.now) if respond_to?(:updated_at=)
88
+ end
89
+
85
90
  # Returns +true+ if the record is persisted, i.e. it's not a new record and it was not destroyed
86
91
  def persisted?
87
92
  !new_record? && !destroyed?
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = '6.0.0.alpha.8'
2
+ VERSION = '6.0.0.alpha.9'
3
3
  end
@@ -30,7 +30,7 @@ A Neo4j OGM (Object-Graph-Mapper) for use in Ruby on Rails and Rack frameworks h
30
30
  s.add_dependency('activemodel', '~> 4')
31
31
  s.add_dependency('activesupport', '~> 4')
32
32
  s.add_dependency('active_attr', '~> 0.8')
33
- s.add_dependency('neo4j-core', '~> 6.0.0.alpha.1')
33
+ s.add_dependency('neo4j-core', '~> 6.0.0.alpha.5')
34
34
  s.add_dependency('neo4j-community', '~> 2.0') if RUBY_PLATFORM =~ /java/
35
35
  s.add_development_dependency('railties', '~> 4')
36
36
  s.add_development_dependency('pry')
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.8
4
+ version: 6.0.0.alpha.9
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-19 00:00:00.000000000 Z
11
+ date: 2015-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: orm_adapter
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 6.0.0.alpha.1
75
+ version: 6.0.0.alpha.5
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 6.0.0.alpha.1
82
+ version: 6.0.0.alpha.5
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: railties
85
85
  requirement: !ruby/object:Gem::Requirement