activegraph 10.0.0.pre.alpha.11 → 10.0.0.pre.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/{neo4j.gemspec → activegraph.gemspec} +7 -9
  4. data/config/neo4j/config.yml +4 -4
  5. data/lib/active_graph.rb +120 -0
  6. data/lib/{neo4j → active_graph}/ansi.rb +1 -1
  7. data/lib/{neo4j → active_graph}/attribute_set.rb +3 -3
  8. data/lib/{neo4j/active_base.rb → active_graph/base.rb} +18 -12
  9. data/lib/{neo4j → active_graph}/class_arguments.rb +5 -5
  10. data/lib/{neo4j → active_graph}/config.rb +10 -10
  11. data/lib/active_graph/core.rb +14 -0
  12. data/lib/{neo4j → active_graph}/core/connection_failed_error.rb +1 -1
  13. data/lib/{neo4j → active_graph}/core/cypher_error.rb +1 -1
  14. data/lib/{neo4j → active_graph}/core/driver.rb +5 -5
  15. data/lib/{neo4j → active_graph}/core/has_uri.rb +1 -1
  16. data/lib/{neo4j → active_graph}/core/instrumentable.rb +4 -4
  17. data/lib/{neo4j → active_graph}/core/label.rb +13 -13
  18. data/lib/{neo4j → active_graph}/core/logging.rb +2 -2
  19. data/lib/{neo4j → active_graph}/core/node.rb +2 -2
  20. data/lib/{neo4j → active_graph}/core/querable.rb +7 -7
  21. data/lib/{neo4j → active_graph}/core/query.rb +16 -16
  22. data/lib/{neo4j → active_graph}/core/query_builder.rb +3 -3
  23. data/lib/{neo4j → active_graph}/core/query_clauses.rb +1 -1
  24. data/lib/{neo4j → active_graph}/core/query_ext.rb +5 -5
  25. data/lib/{neo4j → active_graph}/core/query_find_in_batches.rb +2 -2
  26. data/lib/{neo4j → active_graph}/core/relationship.rb +2 -2
  27. data/lib/{neo4j → active_graph}/core/responses.rb +3 -3
  28. data/lib/{neo4j → active_graph}/core/result.rb +1 -1
  29. data/lib/{neo4j → active_graph}/core/schema.rb +1 -1
  30. data/lib/{neo4j → active_graph}/core/schema_errors.rb +1 -1
  31. data/lib/{neo4j → active_graph}/core/wrappable.rb +1 -1
  32. data/lib/{neo4j → active_graph}/errors.rb +1 -1
  33. data/lib/{neo4j → active_graph}/lazy_attribute_hash.rb +1 -1
  34. data/lib/{neo4j → active_graph}/migration.rb +11 -11
  35. data/lib/{neo4j → active_graph}/migrations.rb +5 -5
  36. data/lib/{neo4j → active_graph}/migrations/base.rb +7 -7
  37. data/lib/{neo4j → active_graph}/migrations/check_pending.rb +3 -3
  38. data/lib/{neo4j → active_graph}/migrations/helpers.rb +4 -4
  39. data/lib/{neo4j → active_graph}/migrations/helpers/id_property.rb +3 -3
  40. data/lib/{neo4j → active_graph}/migrations/helpers/relationships.rb +1 -1
  41. data/lib/{neo4j → active_graph}/migrations/helpers/schema.rb +7 -7
  42. data/lib/{neo4j → active_graph}/migrations/migration_file.rb +1 -1
  43. data/lib/{neo4j → active_graph}/migrations/runner.rb +3 -3
  44. data/lib/{neo4j → active_graph}/migrations/schema.rb +1 -1
  45. data/lib/{neo4j → active_graph}/migrations/schema_migration.rb +2 -2
  46. data/lib/{neo4j → active_graph}/model_schema.rb +8 -8
  47. data/lib/{neo4j/active_node.rb → active_graph/node.rb} +32 -32
  48. data/lib/{neo4j/active_node → active_graph/node}/callbacks.rb +3 -3
  49. data/lib/{neo4j/active_node → active_graph/node}/dependent.rb +2 -2
  50. data/lib/{neo4j/active_node → active_graph/node}/dependent/association_methods.rb +2 -2
  51. data/lib/{neo4j/active_node → active_graph/node}/dependent/query_proxy_methods.rb +4 -4
  52. data/lib/{neo4j/active_node → active_graph/node}/dependent_callbacks.rb +4 -4
  53. data/lib/{neo4j/active_node → active_graph/node}/enum.rb +3 -3
  54. data/lib/{neo4j/active_node → active_graph/node}/has_n.rb +20 -20
  55. data/lib/{neo4j/active_node → active_graph/node}/has_n/association.rb +8 -8
  56. data/lib/{neo4j/active_node → active_graph/node}/has_n/association/rel_factory.rb +4 -4
  57. data/lib/{neo4j/active_node → active_graph/node}/has_n/association/rel_wrapper.rb +4 -4
  58. data/lib/{neo4j/active_node → active_graph/node}/has_n/association_cypher_methods.rb +2 -2
  59. data/lib/{neo4j/active_node → active_graph/node}/id_property.rb +7 -7
  60. data/lib/{neo4j/active_node → active_graph/node}/id_property/accessor.rb +1 -1
  61. data/lib/{neo4j/active_node → active_graph/node}/initialize.rb +3 -3
  62. data/lib/{neo4j/active_node → active_graph/node}/labels.rb +18 -18
  63. data/lib/{neo4j/active_node → active_graph/node}/labels/index.rb +6 -6
  64. data/lib/{neo4j/active_node → active_graph/node}/labels/reloading.rb +1 -1
  65. data/lib/{neo4j/active_node → active_graph/node}/node_list_formatter.rb +1 -1
  66. data/lib/{neo4j/active_node → active_graph/node}/node_wrapper.rb +5 -5
  67. data/lib/{neo4j/active_node → active_graph/node}/orm_adapter.rb +2 -2
  68. data/lib/{neo4j/active_node → active_graph/node}/persistence.rb +7 -7
  69. data/lib/{neo4j/active_node → active_graph/node}/property.rb +3 -3
  70. data/lib/{neo4j/active_node → active_graph/node}/query.rb +9 -9
  71. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy.rb +19 -19
  72. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_eager_loading.rb +3 -3
  73. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_eager_loading/association_tree.rb +2 -2
  74. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_enumerable.rb +4 -4
  75. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_find_in_batches.rb +2 -2
  76. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_link.rb +3 -3
  77. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_methods.rb +12 -12
  78. data/lib/{neo4j/active_node → active_graph/node}/query/query_proxy_methods_of_mass_updating.rb +4 -4
  79. data/lib/{neo4j/active_node → active_graph/node}/query_methods.rb +4 -4
  80. data/lib/{neo4j/active_node → active_graph/node}/reflection.rb +3 -3
  81. data/lib/{neo4j/active_node → active_graph/node}/rels.rb +1 -1
  82. data/lib/{neo4j/active_node → active_graph/node}/scope.rb +4 -4
  83. data/lib/{neo4j/active_node → active_graph/node}/unpersisted.rb +2 -2
  84. data/lib/{neo4j/active_node → active_graph/node}/validations.rb +3 -3
  85. data/lib/{neo4j → active_graph}/paginated.rb +1 -1
  86. data/lib/{neo4j → active_graph}/railtie.rb +18 -18
  87. data/lib/{neo4j/active_rel.rb → active_graph/relationship.rb} +19 -19
  88. data/lib/active_graph/relationship/callbacks.rb +21 -0
  89. data/lib/{neo4j/active_rel → active_graph/relationship}/initialize.rb +5 -5
  90. data/lib/{neo4j/active_rel → active_graph/relationship}/persistence.rb +6 -6
  91. data/lib/{neo4j/active_rel → active_graph/relationship}/persistence/query_factory.rb +7 -7
  92. data/lib/{neo4j/active_rel → active_graph/relationship}/property.rb +6 -6
  93. data/lib/{neo4j/active_rel → active_graph/relationship}/query.rb +7 -7
  94. data/lib/{neo4j/active_rel → active_graph/relationship}/rel_wrapper.rb +5 -5
  95. data/lib/{neo4j/active_rel → active_graph/relationship}/related_node.rb +7 -7
  96. data/lib/{neo4j/active_rel → active_graph/relationship}/types.rb +6 -6
  97. data/lib/active_graph/relationship/validations.rb +8 -0
  98. data/lib/{neo4j → active_graph}/schema/operation.rb +5 -5
  99. data/lib/{neo4j → active_graph}/shared.rb +7 -7
  100. data/lib/{neo4j → active_graph}/shared/attributes.rb +10 -10
  101. data/lib/{neo4j → active_graph}/shared/callbacks.rb +3 -3
  102. data/lib/{neo4j → active_graph}/shared/cypher.rb +1 -1
  103. data/lib/{neo4j → active_graph}/shared/declared_properties.rb +8 -8
  104. data/lib/{neo4j → active_graph}/shared/declared_property.rb +9 -9
  105. data/lib/{neo4j → active_graph}/shared/declared_property/index.rb +3 -3
  106. data/lib/{neo4j → active_graph}/shared/enum.rb +6 -6
  107. data/lib/{neo4j → active_graph}/shared/filtered_hash.rb +2 -2
  108. data/lib/{neo4j → active_graph}/shared/identity.rb +2 -2
  109. data/lib/{neo4j → active_graph}/shared/initialize.rb +3 -3
  110. data/lib/{neo4j → active_graph}/shared/marshal.rb +1 -1
  111. data/lib/{neo4j → active_graph}/shared/mass_assignment.rb +2 -2
  112. data/lib/{neo4j → active_graph}/shared/permitted_attributes.rb +1 -1
  113. data/lib/{neo4j → active_graph}/shared/persistence.rb +4 -4
  114. data/lib/{neo4j → active_graph}/shared/property.rb +10 -10
  115. data/lib/{neo4j → active_graph}/shared/query_factory.rb +5 -5
  116. data/lib/{neo4j → active_graph}/shared/rel_type_converters.rb +6 -6
  117. data/lib/{neo4j → active_graph}/shared/serialized_properties.rb +1 -1
  118. data/lib/{neo4j → active_graph}/shared/type_converters.rb +11 -13
  119. data/lib/{neo4j → active_graph}/shared/typecasted_attributes.rb +7 -7
  120. data/lib/{neo4j → active_graph}/shared/typecaster.rb +3 -3
  121. data/lib/{neo4j → active_graph}/shared/validations.rb +1 -1
  122. data/lib/{neo4j → active_graph}/tasks/migration.rake +25 -25
  123. data/lib/{neo4j → active_graph}/timestamps.rb +3 -3
  124. data/lib/{neo4j → active_graph}/timestamps/created.rb +1 -1
  125. data/lib/{neo4j → active_graph}/timestamps/updated.rb +1 -1
  126. data/lib/{neo4j → active_graph}/transaction.rb +9 -9
  127. data/lib/active_graph/transactions.rb +54 -0
  128. data/lib/{neo4j → active_graph}/type_converters.rb +2 -2
  129. data/lib/{neo4j → active_graph}/undeclared_properties.rb +1 -1
  130. data/lib/active_graph/version.rb +3 -0
  131. data/lib/{neo4j → active_graph}/wrapper.rb +1 -1
  132. data/lib/rails/generators/neo4j/migration/migration_generator.rb +4 -4
  133. data/lib/rails/generators/neo4j/migration/templates/migration.erb +2 -2
  134. data/lib/rails/generators/neo4j/model/model_generator.rb +4 -4
  135. data/lib/rails/generators/neo4j/model/templates/migration.erb +1 -1
  136. data/lib/rails/generators/neo4j/model/templates/model.erb +1 -1
  137. data/lib/rails/generators/neo4j/upgrade_v8/templates/migration.erb +1 -1
  138. data/lib/rails/generators/neo4j/upgrade_v8/upgrade_v8_generator.rb +6 -6
  139. data/lib/rails/generators/neo4j_generator.rb +4 -4
  140. metadata +134 -133
  141. data/lib/neo4j.rb +0 -119
  142. data/lib/neo4j/active_rel/callbacks.rb +0 -21
  143. data/lib/neo4j/active_rel/validations.rb +0 -8
  144. data/lib/neo4j/core.rb +0 -14
  145. data/lib/neo4j/version.rb +0 -3
@@ -1,4 +1,4 @@
1
- module Neo4j
1
+ module ActiveGraph
2
2
  module Migrations
3
3
  extend ActiveSupport::Autoload
4
4
  autoload :Helpers
@@ -10,17 +10,17 @@ module Neo4j
10
10
 
11
11
  class << self
12
12
  def check_for_pending_migrations!
13
- return if Neo4j::Config.configuration['skip_migration_check']
13
+ return if ActiveGraph::Config.configuration['skip_migration_check']
14
14
 
15
- runner = Neo4j::Migrations::Runner.new
15
+ runner = ActiveGraph::Migrations::Runner.new
16
16
  pending = runner.pending_migrations
17
- fail ::Neo4j::PendingMigrationError, pending if pending.any?
17
+ fail ::ActiveGraph::PendingMigrationError, pending if pending.any?
18
18
  end
19
19
 
20
20
  attr_accessor :currently_running_migrations
21
21
 
22
22
  def maintain_test_schema!
23
- Neo4j::Migrations::Runner.new(silenced: true).all
23
+ ActiveGraph::Migrations::Runner.new(silenced: true).all
24
24
  end
25
25
  end
26
26
  end
@@ -1,10 +1,10 @@
1
- module Neo4j
1
+ module ActiveGraph
2
2
  module Migrations
3
3
  class Base
4
- include Neo4j::Migrations::Helpers
5
- include Neo4j::Migrations::Helpers::Schema
6
- include Neo4j::Migrations::Helpers::IdProperty
7
- include Neo4j::Migrations::Helpers::Relationships
4
+ include ActiveGraph::Migrations::Helpers
5
+ include ActiveGraph::Migrations::Helpers::Schema
6
+ include ActiveGraph::Migrations::Helpers::IdProperty
7
+ include ActiveGraph::Migrations::Helpers::Relationships
8
8
 
9
9
  def initialize(migration_id, options = {})
10
10
  @migration_id = migration_id
@@ -63,11 +63,11 @@ module Neo4j
63
63
  end
64
64
 
65
65
  def migration_transaction(&block)
66
- ActiveBase.run_transaction(transactions?, &block)
66
+ ActiveGraph::Base.run_transaction(transactions?, &block)
67
67
  end
68
68
 
69
69
  def log_queries
70
- subscriber = Neo4j::Transaction.subscribe_to_query(&method(:output))
70
+ subscriber = ActiveGraph::Transaction.subscribe_to_query(&method(:output))
71
71
  yield
72
72
  ensure
73
73
  ActiveSupport::Notifications.unsubscribe(subscriber) if subscriber
@@ -1,4 +1,4 @@
1
- module Neo4j
1
+ module ActiveGraph
2
2
  module Migrations
3
3
  class CheckPending
4
4
  def initialize(app)
@@ -7,10 +7,10 @@ module Neo4j
7
7
  end
8
8
 
9
9
  def call(env)
10
- latest_migration = Neo4j::Migrations::Runner.latest_migration
10
+ latest_migration = ActiveGraph::Migrations::Runner.latest_migration
11
11
  mtime = latest_migration ? latest_migration.version.to_i : 0
12
12
  if @last_check < mtime
13
- Neo4j::Migrations.check_for_pending_migrations!
13
+ ActiveGraph::Migrations.check_for_pending_migrations!
14
14
  @last_check = mtime
15
15
  end
16
16
  @app.call(env)
@@ -1,6 +1,6 @@
1
1
  require 'benchmark'
2
2
 
3
- module Neo4j
3
+ module ActiveGraph
4
4
  module Migrations
5
5
  module Helpers
6
6
  extend ActiveSupport::Concern
@@ -18,7 +18,7 @@ module Neo4j
18
18
  end
19
19
 
20
20
  def rename_property(label, old_property, new_property)
21
- fail Neo4j::MigrationError, format(PROPERTY_ALREADY_DEFINED, new_property: new_property, label: label) if property_exists?(label, new_property)
21
+ fail ActiveGraph::MigrationError, format(PROPERTY_ALREADY_DEFINED, new_property: new_property, label: label) if property_exists?(label, new_property)
22
22
  by_label(label).set("n.#{new_property} = n.#{old_property}")
23
23
  .remove("n.#{old_property}").exec
24
24
  end
@@ -50,7 +50,7 @@ module Neo4j
50
50
  end
51
51
 
52
52
  def execute(string, params = {})
53
- ActiveBase.query(string, params).to_a
53
+ ActiveGraph::Base.query(string, params).to_a
54
54
  end
55
55
 
56
56
  def say_with_time(message)
@@ -67,7 +67,7 @@ module Neo4j
67
67
  end
68
68
 
69
69
  def query(*args)
70
- ActiveBase.new_query(*args)
70
+ ActiveGraph::Base.new_query(*args)
71
71
  end
72
72
 
73
73
  protected
@@ -1,4 +1,4 @@
1
- module Neo4j
1
+ module ActiveGraph
2
2
  module Migrations
3
3
  module Helpers
4
4
  module IdProperty
@@ -27,7 +27,7 @@ module Neo4j
27
27
  end
28
28
 
29
29
  def id_batch_set(label, id_property, new_ids, count)
30
- tx = ActiveBase.new_transaction
30
+ tx = ActiveGraph::Base.new_transaction
31
31
 
32
32
  execute("MATCH (n:`#{label}`) WHERE NOT EXISTS(n.#{id_property})
33
33
  with COLLECT(n) as nodes, #{new_ids} as ids
@@ -38,7 +38,7 @@ module Neo4j
38
38
  LIMIT #{count}")
39
39
 
40
40
  count
41
- rescue Neo4j::Server::CypherResponse::ResponseError, Faraday::TimeoutError
41
+ rescue ActiveGraph::Server::CypherResponse::ResponseError, Faraday::TimeoutError
42
42
  new_max_per_batch = (max_per_batch * 0.8).round
43
43
  output "Error querying #{max_per_batch} nodes. Trying #{new_max_per_batch}"
44
44
  new_max_per_batch
@@ -1,4 +1,4 @@
1
- module Neo4j
1
+ module ActiveGraph
2
2
  module Migrations
3
3
  module Helpers
4
4
  module Relationships
@@ -1,4 +1,4 @@
1
- module Neo4j
1
+ module ActiveGraph
2
2
  module Migrations
3
3
  module Helpers
4
4
  module Schema
@@ -9,7 +9,7 @@ module Neo4j
9
9
  def add_constraint(label, property, options = {})
10
10
  force = options[:force] || false
11
11
  type = options[:type] || :uniqueness
12
- label_object = ActiveBase.label_object(label)
12
+ label_object = ActiveGraph::Base.label_object(label)
13
13
  if label_object.constraint?(property)
14
14
  if force
15
15
  label_object.drop_constraint(property, type: type)
@@ -22,7 +22,7 @@ module Neo4j
22
22
 
23
23
  def add_index(label, property, options = {})
24
24
  force = options[:force] || false
25
- label_object = ActiveBase.label_object(label)
25
+ label_object = ActiveGraph::Base.label_object(label)
26
26
  if label_object.index?(property)
27
27
  if force
28
28
  label_object.drop_index(property)
@@ -35,13 +35,13 @@ module Neo4j
35
35
 
36
36
  def drop_constraint(label, property, options = {})
37
37
  type = options[:type] || :uniqueness
38
- label_object = ActiveBase.label_object(label)
38
+ label_object = ActiveGraph::Base.label_object(label)
39
39
  fail_missing_constraint_or_index!(:constraint, label, property) if !options[:force] && !label_object.constraint?(property)
40
40
  label_object.drop_constraint(property, type: type)
41
41
  end
42
42
 
43
43
  def drop_index(label, property, options = {})
44
- label_object = ActiveBase.label_object(label)
44
+ label_object = ActiveGraph::Base.label_object(label)
45
45
  fail_missing_constraint_or_index!(:index, label, property) if !options[:force] && !label_object.index?(property)
46
46
  label_object.drop_index(property)
47
47
  end
@@ -49,12 +49,12 @@ module Neo4j
49
49
  protected
50
50
 
51
51
  def fail_missing_constraint_or_index!(type, label, property)
52
- fail Neo4j::MigrationError,
52
+ fail ActiveGraph::MigrationError,
53
53
  format(MISSING_CONSTRAINT_OR_INDEX, type: type, label: label, property: property)
54
54
  end
55
55
 
56
56
  def fail_duplicate_constraint_or_index!(type, label, property)
57
- fail Neo4j::MigrationError,
57
+ fail ActiveGraph::MigrationError,
58
58
  format(DUPLICATE_CONSTRAINT_OR_INDEX, type: type, label: label, property: property)
59
59
  end
60
60
  end
@@ -1,4 +1,4 @@
1
- module Neo4j
1
+ module ActiveGraph
2
2
  module Migrations
3
3
  class MigrationFile
4
4
  attr_reader :file_name, :symbol_name, :class_name, :version
@@ -1,4 +1,4 @@
1
- module Neo4j
1
+ module ActiveGraph
2
2
  module Migrations
3
3
  class Runner
4
4
  STATUS_TABLE_FORMAT = '%-10s %-20s %s'.freeze
@@ -57,10 +57,10 @@ module Neo4j
57
57
  end
58
58
 
59
59
  def mark_versions_as_complete(versions)
60
- Neo4j::ActiveBase.new_query
60
+ ActiveGraph::Base.new_query
61
61
  .with('$versions AS versions').params(versions: versions).break
62
62
  .unwind(version: :versions).break
63
- .merge('(:`Neo4j::Migrations::SchemaMigration` {migration_id: version})')
63
+ .merge('(:`ActiveGraph::Migrations::SchemaMigration` {migration_id: version})')
64
64
  .exec
65
65
  end
66
66
 
@@ -1,4 +1,4 @@
1
- module Neo4j
1
+ module ActiveGraph
2
2
  module Migrations
3
3
  module Schema
4
4
  class << self
@@ -1,7 +1,7 @@
1
- module Neo4j
1
+ module ActiveGraph
2
2
  module Migrations
3
3
  class SchemaMigration
4
- include Neo4j::ActiveNode
4
+ include ActiveGraph::Node
5
5
  id_property :migration_id
6
6
  property :migration_id, type: String
7
7
  property :incomplete, type: Boolean
@@ -1,5 +1,5 @@
1
1
  require 'set'
2
- module Neo4j
2
+ module ActiveGraph
3
3
  # This is here to support the removed functionality of being able to
4
4
  # defined indexes and constraints on models
5
5
  # This code should be removed later
@@ -32,7 +32,7 @@ module Neo4j
32
32
  def model_constraints
33
33
  return @model_constraints if @model_constraints
34
34
 
35
- constraints = Neo4j::Transaction.constraints.each_with_object({}) do |row, result|
35
+ constraints = ActiveGraph::Transaction.constraints.each_with_object({}) do |row, result|
36
36
  result[row[:label]] ||= []
37
37
  result[row[:label]] << row[:properties]
38
38
  end
@@ -43,7 +43,7 @@ module Neo4j
43
43
  def model_indexes
44
44
  return @model_indexes if @model_indexes
45
45
 
46
- indexes = Neo4j::Transaction.indexes.each_with_object({}) do |row, result|
46
+ indexes = ActiveGraph::Transaction.indexes.each_with_object({}) do |row, result|
47
47
  result[row[:label]] ||= []
48
48
  result[row[:label]] << row[:properties]
49
49
  end
@@ -66,16 +66,16 @@ module Neo4j
66
66
 
67
67
  def ensure_model_data_state!
68
68
  # If we load a new model, reset everything
69
- if @previously_loaded_models_count != Neo4j::ActiveNode.loaded_classes.size
69
+ if @previously_loaded_models_count != ActiveGraph::Node.loaded_classes.size
70
70
  # Make sure we've finalized id_property details and have called
71
71
  # add_ constraint/index methods above
72
- Neo4j::ActiveNode.loaded_classes.each(&:ensure_id_property_info!)
72
+ ActiveGraph::Node.loaded_classes.each(&:ensure_id_property_info!)
73
73
  reload_models_data!
74
74
  end
75
75
  end
76
76
 
77
77
  def reload_models_data!
78
- @previously_loaded_models_count = Neo4j::ActiveNode.loaded_classes.size
78
+ @previously_loaded_models_count = ActiveGraph::Node.loaded_classes.size
79
79
  @model_indexes = @model_constraints = nil
80
80
  end
81
81
 
@@ -101,7 +101,7 @@ module Neo4j
101
101
 
102
102
  return if messages.values.all?(&:empty?)
103
103
 
104
- fail ::Neo4j::DeprecatedSchemaDefinitionError, validation_error_message(messages)
104
+ fail ::ActiveGraph::DeprecatedSchemaDefinitionError, validation_error_message(messages)
105
105
  end
106
106
 
107
107
  def validation_error_message(messages)
@@ -122,7 +122,7 @@ MSG
122
122
  end
123
123
 
124
124
  def log_warning!(index_or_constraint, model, property_name)
125
- Neo4j::ActiveBase.logger.warn "WARNING: The #{index_or_constraint} option is no longer supported (Defined on #{model.name} for #{property_name})"
125
+ ActiveGraph::Base.logger.warn "WARNING: The #{index_or_constraint} option is no longer supported (Defined on #{model.name} for #{property_name})"
126
126
  end
127
127
 
128
128
  private
@@ -1,4 +1,4 @@
1
- module Neo4j
1
+ module ActiveGraph
2
2
  # Makes Neo4j nodes and relationships behave like ActiveRecord objects.
3
3
  # By including this module in your class it will create a mapping for the node to your ruby class
4
4
  # by using a Neo4j Label with the same name as the class. When the node is loaded from the database it
@@ -7,45 +7,45 @@ module Neo4j
7
7
  # in a new object of that class.
8
8
  #
9
9
  # = ClassMethods
10
- # * {Neo4j::ActiveNode::Labels::ClassMethods} defines methods like: <tt>index</tt> and <tt>find</tt>
11
- # * {Neo4j::ActiveNode::Persistence::ClassMethods} defines methods like: <tt>create</tt> and <tt>create!</tt>
12
- # * {Neo4j::ActiveNode::Property::ClassMethods} defines methods like: <tt>property</tt>.
10
+ # * {ActiveGraph::Node::Labels::ClassMethods} defines methods like: <tt>index</tt> and <tt>find</tt>
11
+ # * {ActiveGraph::Node::Persistence::ClassMethods} defines methods like: <tt>create</tt> and <tt>create!</tt>
12
+ # * {ActiveGraph::Node::Property::ClassMethods} defines methods like: <tt>property</tt>.
13
13
  #
14
14
  # @example Create a Ruby wrapper for a Neo4j Node
15
15
  # class Company
16
- # include Neo4j::ActiveNode
16
+ # include ActiveGraph::Node
17
17
  # property :name
18
18
  # end
19
19
  # company = Company.new
20
20
  # company.name = 'My Company AB'
21
21
  # Company.save
22
22
  #
23
- module ActiveNode
23
+ module Node
24
24
  extend ActiveSupport::Concern
25
25
 
26
26
  MARSHAL_INSTANCE_VARIABLES = [:@attributes, :@_persisted_obj, :@default_property_value]
27
27
 
28
- include Neo4j::Shared
29
- include Neo4j::Shared::Identity
30
- include Neo4j::Shared::Marshal
31
- include Neo4j::ActiveNode::Initialize
32
- include Neo4j::ActiveNode::IdProperty
33
- include Neo4j::Shared::SerializedProperties
34
- include Neo4j::ActiveNode::Property
35
- include Neo4j::ActiveNode::Reflection
36
- include Neo4j::ActiveNode::Persistence
37
- include Neo4j::ActiveNode::Validations
38
- include Neo4j::ActiveNode::Callbacks
39
- include Neo4j::ActiveNode::Query
40
- include Neo4j::ActiveNode::Labels
41
- include Neo4j::ActiveNode::Rels
42
- include Neo4j::ActiveNode::Unpersisted
43
- include Neo4j::ActiveNode::HasN
44
- include Neo4j::ActiveNode::Scope
45
- include Neo4j::ActiveNode::Dependent
46
- include Neo4j::ActiveNode::Enum
47
- include Neo4j::Shared::PermittedAttributes
48
- include Neo4j::ActiveNode::DependentCallbacks
28
+ include ActiveGraph::Shared
29
+ include ActiveGraph::Shared::Identity
30
+ include ActiveGraph::Shared::Marshal
31
+ include ActiveGraph::Node::Initialize
32
+ include ActiveGraph::Node::IdProperty
33
+ include ActiveGraph::Shared::SerializedProperties
34
+ include ActiveGraph::Node::Property
35
+ include ActiveGraph::Node::Reflection
36
+ include ActiveGraph::Node::Persistence
37
+ include ActiveGraph::Node::Validations
38
+ include ActiveGraph::Node::Callbacks
39
+ include ActiveGraph::Node::Query
40
+ include ActiveGraph::Node::Labels
41
+ include ActiveGraph::Node::Rels
42
+ include ActiveGraph::Node::Unpersisted
43
+ include ActiveGraph::Node::HasN
44
+ include ActiveGraph::Node::Scope
45
+ include ActiveGraph::Node::Dependent
46
+ include ActiveGraph::Node::Enum
47
+ include ActiveGraph::Shared::PermittedAttributes
48
+ include ActiveGraph::Node::DependentCallbacks
49
49
 
50
50
  def initialize(args = nil)
51
51
  self.class.ensure_id_property_info! # So that we make sure all objects have an id_property
@@ -66,7 +66,7 @@ module Neo4j
66
66
 
67
67
  module ClassMethods
68
68
  def nodeify(object)
69
- if object.is_a?(::Neo4j::ActiveNode) || object.nil?
69
+ if object.is_a?(::ActiveGraph::Node) || object.nil?
70
70
  object
71
71
  else
72
72
  self.find(object)
@@ -75,7 +75,7 @@ module Neo4j
75
75
  end
76
76
 
77
77
  included do
78
- include Neo4j::Timestamps if Neo4j::Config[:record_timestamps]
78
+ include ActiveGraph::Timestamps if ActiveGraph::Config[:record_timestamps]
79
79
  LOADED_CLASSES << self
80
80
 
81
81
  def self.inherited?
@@ -83,7 +83,7 @@ module Neo4j
83
83
  end
84
84
 
85
85
  def self.inherited(other)
86
- Neo4j::ActiveNode::Labels.clear_wrapped_models
86
+ ActiveGraph::Node::Labels.clear_wrapped_models
87
87
 
88
88
  LOADED_CLASSES << other
89
89
  other.instance_variable_set('@inherited', true)
@@ -92,7 +92,7 @@ module Neo4j
92
92
  other.inherit_property k.to_sym, v.clone, declared_properties[k].options
93
93
  end
94
94
 
95
- Neo4j::ActiveNode::Labels.add_wrapped_class(other)
95
+ ActiveGraph::Node::Labels.add_wrapped_class(other)
96
96
  super
97
97
  end
98
98
 
@@ -104,6 +104,6 @@ module Neo4j
104
104
  end
105
105
  end
106
106
 
107
- ActiveSupport.run_load_hooks(:active_node, self)
107
+ ActiveSupport.run_load_hooks(:node, self)
108
108
  end
109
109
  end
@@ -1,8 +1,8 @@
1
- module Neo4j
2
- module ActiveNode
1
+ module ActiveGraph
2
+ module Node
3
3
  module Callbacks #:nodoc:
4
4
  extend ActiveSupport::Concern
5
- include Neo4j::Shared::Callbacks
5
+ include ActiveGraph::Shared::Callbacks
6
6
  end
7
7
  end
8
8
  end
@@ -1,5 +1,5 @@
1
- module Neo4j
2
- module ActiveNode
1
+ module ActiveGraph
2
+ module Node
3
3
  module Dependent
4
4
  def dependent_children
5
5
  @dependent_children ||= []
@@ -1,5 +1,5 @@
1
- module Neo4j
2
- module ActiveNode
1
+ module ActiveGraph
2
+ module Node
3
3
  module Dependent
4
4
  module AssociationMethods
5
5
  def validate_dependent(value)