neo4j 1.1.0-java → 1.1.1-java

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.
data/CHANGELOG CHANGED
@@ -1,4 +1,9 @@
1
- == 1.1.0 / 2011-05-13
1
+ == 1.1.1 / 2011-06-26
2
+ * Made neo4j compatible with rails 3.1.0.rc1 [#170]
3
+ * Fix for neo4j-devise [#171]
4
+ * BUG: Neo4j::GraphAlgo shortest path does raise exception if two nodes are not connected [#172]
5
+
6
+ == 1.1.0 / 2011-05-13
2
7
  * Support for embedding neo4j.rb by providing an already running db instance (#168)
3
8
  * Neo4j::Rails::Relationships should be ActiveModel compliant (#156)
4
9
  * Support for incoming relationships in Neo4j::Rails::Model (#157)
data/README.rdoc CHANGED
@@ -92,6 +92,7 @@ Example of using Neo4j with Rails 3 (ActiveModel)
92
92
  ==== Generate a Rails Application
93
93
 
94
94
  Example of creating an Neo4j Application from scratch:
95
+ (make sure you have installed JRuby version >= 1.6.2)
95
96
 
96
97
  gem install rails
97
98
  rails new myapp -m http://andreasronge.github.com/rails3.rb
@@ -108,7 +109,7 @@ To run it with Tomcat instead of WEBrick
108
109
 
109
110
 
110
111
  === Presentation Materials and other URLs
111
- * {Intoduction to Neo4j.rb}[http://www.slideshare.net/andreasronge/neo4jrb]
112
+ * {Presentation: RailsConf 2011}[http://andreasronge.github.com/neo4j-railsconf.pdf]
112
113
  * {Nordic Ruby 2010 May 21-23}[http://nordicruby.org/speakers#user_29]
113
114
  * {Neo4j wiki, check the guidelines and domain modeling gallery pages}[http://wiki.neo4j.org/content/Main_Page]
114
115
 
data/lib/neo4j.rb CHANGED
@@ -6,11 +6,18 @@ require 'tmpdir'
6
6
 
7
7
  # Rails
8
8
  require 'rails/railtie'
9
+ require 'active_support/core_ext/class/inheritable_attributes'
10
+ require 'active_support/core_ext/hash/indifferent_access'
9
11
  require 'active_model'
10
12
 
11
13
  require 'will_paginate/collection'
12
14
  require 'will_paginate/finders/base'
13
15
 
16
+ # core extensions
17
+ require 'neo4j/core_ext/class/inheritable_attributes'
18
+
19
+ # Jars
20
+
14
21
  require 'neo4j/jars/core/geronimo-jta_1.1_spec-1.1.1.jar'
15
22
  require 'neo4j/jars/core/lucene-core-3.0.3.jar'
16
23
  require 'neo4j/jars/core/neo4j-lucene-index-1.3.jar'
@@ -187,7 +187,8 @@ module Neo4j
187
187
  if @single && @path_finder_method
188
188
  execute_algo.send(@path_finder_method).each &block
189
189
  else
190
- execute_algo.each &block
190
+ traversal = execute_algo
191
+ traversal.each &block if traversal
191
192
  end
192
193
  end
193
194
 
data/lib/neo4j/config.rb CHANGED
@@ -145,7 +145,7 @@ module Neo4j
145
145
  # The a new configuration using default values as a hash.
146
146
  #
147
147
  def setup()
148
- @configuration = ActiveSupport::HashWithIndifferentAccess.new(defaults)
148
+ @configuration = defaults.with_indifferent_access #nested_under_indifferent_access
149
149
  @configuration.merge!(defaults)
150
150
  @configuration
151
151
  end
@@ -0,0 +1,37 @@
1
+ # This is copied from Rails Active Support since it has been depricated and I still need it
2
+ class Class # :nodoc:
3
+ def class_inheritable_reader(*syms)
4
+ options = syms.extract_options!
5
+ syms.each do |sym|
6
+ next if sym.is_a?(Hash)
7
+ class_eval(<<-EOS, __FILE__, __LINE__ + 1)
8
+ def self.#{sym} # def self.after_add
9
+ read_inheritable_attribute(:#{sym}) # read_inheritable_attribute(:after_add)
10
+ end # end
11
+ #
12
+ #{" #
13
+ def #{sym} # def after_add
14
+ self.class.#{sym} # self.class.after_add
15
+ end # end
16
+ " unless options[:instance_reader] == false } # # the reader above is generated unless options[:instance_reader] == false
17
+ EOS
18
+ end
19
+ end
20
+
21
+ def class_inheritable_writer(*syms)
22
+ options = syms.extract_options!
23
+ syms.each do |sym|
24
+ class_eval(<<-EOS, __FILE__, __LINE__ + 1)
25
+ def self.#{sym}=(obj) # def self.color=(obj)
26
+ write_inheritable_attribute(:#{sym}, obj) # write_inheritable_attribute(:color, obj)
27
+ end # end
28
+ #
29
+ #{" #
30
+ def #{sym}=(obj) # def color=(obj)
31
+ self.class.#{sym} = obj # self.class.color = obj
32
+ end # end
33
+ " unless options[:instance_writer] == false } # # the writer above is generated unless options[:instance_writer] == false
34
+ EOS
35
+ end
36
+ end
37
+ end
@@ -107,10 +107,10 @@ module Neo4j
107
107
  end
108
108
  end unless c.respond_to?(:orig_new)
109
109
 
110
- c.class_inheritable_hash :_decl_props
110
+ c.class_inheritable_accessor :_decl_props
111
111
  c._decl_props ||= {}
112
112
 
113
- c.class_inheritable_hash :_decl_rels
113
+ c.class_inheritable_accessor :_decl_rels
114
114
  c._decl_rels ||= {}
115
115
 
116
116
  c.extend ClassMethods
@@ -15,7 +15,7 @@ module Neo4j
15
15
  include ActiveModel::Dirty # track changes to attributes
16
16
  include ActiveModel::MassAssignmentSecurity # handle attribute hash assignment
17
17
 
18
- class_inheritable_hash :attribute_defaults
18
+ class_inheritable_accessor :attribute_defaults
19
19
  self.attribute_defaults ||= {}
20
20
 
21
21
  # save the original [] and []= to use as read/write to Neo4j
@@ -36,7 +36,7 @@ module Neo4j
36
36
  # and callbacks are run to ensure correctness
37
37
  def write_local_property(key, value)
38
38
  key_s = key.to_s
39
- if @properties[key_s] != value
39
+ if !@properties.has_key?(key_s) || @properties[key_s] != value
40
40
  attribute_will_change!(key_s)
41
41
  @properties[key_s] = value
42
42
  end
@@ -4,13 +4,17 @@ module Neo4j
4
4
  extend ActiveSupport::Concern
5
5
 
6
6
  included do
7
- [:create_or_update, :create, :update, :destroy].each do |method|
7
+ [:valid?, :create_or_update, :create, :update, :destroy].each do |method|
8
8
  alias_method_chain method, :callbacks
9
9
  end
10
10
 
11
11
  extend ActiveModel::Callbacks
12
12
 
13
- define_model_callbacks :create, :save, :update, :destroy, :validation
13
+ define_model_callbacks :validation, :create, :save, :update, :destroy
14
+ end
15
+
16
+ def valid_with_callbacks?(*) #:nodoc:
17
+ _run_validation_callbacks { valid_without_callbacks? }
14
18
  end
15
19
 
16
20
  def destroy_with_callbacks #:nodoc:
@@ -123,7 +123,7 @@ module Neo4j
123
123
  end
124
124
  end
125
125
 
126
- c.class_inheritable_hash :_decl_props
126
+ c.class_inheritable_accessor :_decl_props
127
127
  c._decl_props ||= {}
128
128
 
129
129
  c.extend ClassMethods
@@ -135,7 +135,11 @@ module Neo4j
135
135
  # Only utc times are supported !
136
136
  def to_java(value)
137
137
  return nil if value.nil?
138
- Time.utc(value.year, value.month, value.day, value.hour, value.min, value.sec).to_i
138
+ if value.class == Date
139
+ Time.utc(value.year, value.month, value.day, 0, 0, 0).to_i
140
+ else
141
+ Time.utc(value.year, value.month, value.day, value.hour, value.min, value.sec).to_i
142
+ end
139
143
  end
140
144
 
141
145
  def to_ruby(value)
@@ -157,7 +161,11 @@ module Neo4j
157
161
  # Only utc times are supported !
158
162
  def to_java(value)
159
163
  return nil if value.nil?
160
- value.utc.to_i
164
+ if value.class == Date
165
+ Time.utc(value.year, value.month, value.day, 0, 0, 0).to_i
166
+ else
167
+ value.utc.to_i
168
+ end
161
169
  end
162
170
 
163
171
  def to_ruby(value)
data/lib/neo4j/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = "1.1.0"
2
+ VERSION = "1.1.1"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: neo4j
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.1.0
5
+ version: 1.1.1
6
6
  platform: java
7
7
  authors:
8
8
  - Andreas Ronge
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-13 00:00:00 +02:00
13
+ date: 2011-05-26 00:00:00 +02:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -107,6 +107,7 @@ files:
107
107
  - lib/neo4j/relationship_mixin/relationship_mixin.rb
108
108
  - lib/neo4j/relationship_mixin/class_methods.rb
109
109
  - lib/neo4j/type_converters/type_converters.rb
110
+ - lib/neo4j/core_ext/class/inheritable_attributes.rb
110
111
  - lib/neo4j/migrations/migrations.rb
111
112
  - lib/neo4j/migrations/lazy_node_mixin.rb
112
113
  - lib/neo4j/migrations/extensions.rb