neo4j 3.0.0.rc.3 → 3.0.0.rc.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -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.reject{|key| !keys.include?(key)}
42
+ @default_properties = properties.select {|key| keys.include?(key) }
43
43
  end
44
44
 
45
45
  def default_property(key)
46
- keys = self.class.default_properties.keys
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.inject({}) do |result,pair|
167
- result.tap{|obj| obj[pair[0]] = pair[1].call(instance)}
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
@@ -1,3 +1,3 @@
1
1
  module Neo4j
2
- VERSION = "3.0.0.rc.3"
2
+ VERSION = "3.0.0.rc.4"
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: 3.0.0.rc.3
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-08-31 00:00:00.000000000 Z
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