neo4apis-activerecord 0.4.0 → 0.4.1

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: ab9aecb11a9464f24fea4306dd70129fa149ef80
4
- data.tar.gz: 3dfa664c481fa064e3b4ecaee0db545849f5a494
3
+ metadata.gz: 60ef840a977637782af55407f5a3ef150e0dd871
4
+ data.tar.gz: 2dad3f4ba9eb9f56b07d919df2b2554670224f1e
5
5
  SHA512:
6
- metadata.gz: 9ee71960a9de10387b975fac9cb76948398f73e1599318f4e1ff7f2133be15ed47db5858c57f716cc5b4e2736ff5efed77a16ae3ae65e14256c4cce85e349608
7
- data.tar.gz: ea45c3c56cbbd9e114b5d2a5a46b833968d3a6cbabff9839ecc9fbaba1964ba7e555717f3eea962a883a9a181593171e115da2f9404c9729f4786feda51f9cc0
6
+ metadata.gz: 977ecd193e5ff8c9822f8600169c5807af583a386691e62384095cd47dc02976dd99140461cc28bee46cddd5f78b0333b4486349f3fc7ee9ddc0174c35db4e5c
7
+ data.tar.gz: 907f8975ad859187956b97b33c97c27753a0cd4944db905da92a84a8ac659a6290d2817e97d5432a064c05f5a4080dae6af755d52b21421a1843d3c65e56f80b
@@ -24,6 +24,34 @@ module Neo4Apis
24
24
  def tables(*models_or_table_names)
25
25
  setup
26
26
 
27
+ import_models_or_tables(*models_or_table_names)
28
+ end
29
+
30
+ desc 'models MODELS_OR_TABLE_NAMES', 'Import specified ActiveRecord models'
31
+ def models(*models_or_table_names)
32
+ setup
33
+
34
+ import_models_or_tables(*models_or_table_names)
35
+ end
36
+
37
+ desc 'all_tables', 'Import all SQL tables'
38
+ def all_tables
39
+ setup
40
+
41
+ import_models_or_tables(*::ActiveRecord::Base.connection.tables)
42
+ end
43
+
44
+ desc 'all_models', 'Import SQL tables using defined models'
45
+ def all_models
46
+ setup
47
+
48
+ Rails.application.eager_load!
49
+
50
+ import_models_or_tables(ActiveRecord::Base.descendants)
51
+ end
52
+
53
+
54
+ def import_models_or_tables(*models_or_table_names)
27
55
  model_classes = models_or_table_names.map(&method(:get_model))
28
56
 
29
57
  puts 'Importing tables: ' + model_classes.map(&:table_name).join(', ')
@@ -41,23 +69,6 @@ module Neo4Apis
41
69
  end
42
70
  end
43
71
 
44
- desc 'models MODELS_OR_TABLE_NAMES', 'Import specified ActiveRecord models'
45
- def models(*models_or_table_names)
46
- tables(*models_or_table_names)
47
- end
48
-
49
- desc 'all_tables', 'Import all SQL tables'
50
- def all_tables
51
- tables(*::ActiveRecord::Base.connection.tables)
52
- end
53
-
54
- desc 'all_models', 'Import SQL tables using defined '
55
- def all_models
56
- Rails.application.eager_load!
57
-
58
- tables(ActiveRecord::Base.descendants)
59
- end
60
-
61
72
  private
62
73
 
63
74
  def setup
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift lib unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'neo4apis-activerecord'
6
- s.version = '0.4.0'
6
+ s.version = '0.4.1'
7
7
  s.required_ruby_version = '>= 1.9.1'
8
8
 
9
9
  s.authors = 'Brian Underwood'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neo4apis-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Underwood