graphql-active_record_batcher 0.2.0 → 0.3.1

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/.travis.yml ADDED
@@ -0,0 +1,8 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.5
4
+ - 2.3.3
5
+ - 2.4.0
6
+ sudo: false
7
+ cache: bundler
8
+ env: CODECLIMATE_REPO_TOKEN=732c35e2a34d5320f2aec300b579358cde538a40567c34f06aeeb0c3d0f1060c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- graphql-active_record_batcher (0.2.0)
4
+ graphql-active_record_batcher (0.3.1)
5
5
  activerecord
6
6
  graphql
7
7
  graphql-batch
@@ -25,12 +25,16 @@ GEM
25
25
  arel (7.1.4)
26
26
  builder (3.2.3)
27
27
  byebug (9.0.6)
28
+ codeclimate-test-reporter (1.0.5)
29
+ simplecov
28
30
  concurrent-ruby (1.0.4)
29
- graphql (1.4.3)
31
+ docile (1.1.5)
32
+ graphql (1.4.4)
30
33
  graphql-batch (0.3.1)
31
34
  graphql (>= 0.8, < 2)
32
35
  promise.rb (~> 0.7.2)
33
36
  i18n (0.8.0)
37
+ json (2.0.3)
34
38
  minitest (5.10.1)
35
39
  minitest-focus (1.1.2)
36
40
  minitest (>= 4, < 6)
@@ -42,6 +46,11 @@ GEM
42
46
  promise.rb (0.7.2)
43
47
  rake (10.5.0)
44
48
  ruby-progressbar (1.8.1)
49
+ simplecov (0.13.0)
50
+ docile (~> 1.1.0)
51
+ json (>= 1.8, < 3)
52
+ simplecov-html (~> 0.10.0)
53
+ simplecov-html (0.10.0)
45
54
  sqlite3 (1.3.13)
46
55
  thread_safe (0.3.5)
47
56
  tzinfo (1.2.2)
@@ -51,15 +60,16 @@ PLATFORMS
51
60
  ruby
52
61
 
53
62
  DEPENDENCIES
54
- activerecord
55
63
  bundler (~> 1.11)
56
64
  byebug
65
+ codeclimate-test-reporter (~> 1.0.0)
57
66
  graphql-active_record_batcher!
58
67
  minitest (~> 5.10.1)
59
68
  minitest-focus (~> 1.1)
60
69
  minitest-reporters (~> 1.0)
61
70
  rake (~> 10.0)
71
+ simplecov
62
72
  sqlite3
63
73
 
64
74
  BUNDLED WITH
65
- 1.14.2
75
+ 1.14.4
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2017 TODO: Write your name
3
+ Copyright (c) 2017 Marc-Andre Giroux
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,4 +1,10 @@
1
- # Graphql::ActiveRecordBatcher
1
+ # GraphQL::ActiveRecordBatcher
2
+
3
+ [![Code Climate](https://codeclimate.com/github/xuorig/graphql-active_record_batcher/badges/gpa.svg)](https://codeclimate.com/github/xuorig/graphql-active_record_batcher)
4
+
5
+ [![Test Coverage](https://codeclimate.com/github/xuorig/graphql-active_record_batcher/badges/coverage.svg)](https://codeclimate.com/github/xuorig/graphql-active_record_batcher/coverage)
6
+
7
+ [![Issue Count](https://codeclimate.com/github/xuorig/graphql-active_record_batcher/badges/issue_count.svg)](https://codeclimate.com/github/xuorig/graphql-active_record_batcher)
2
8
 
3
9
  `GraphQL::ActiveRecordBatcher` is a toolkit to batch record loading as well as preload
4
10
  ActiveRecord association durings GraphQL Execution.
@@ -29,7 +35,7 @@ Or install it yourself as:
29
35
  ```ruby
30
36
  Schema = GraphQL::Schema.define do
31
37
  # Enable preloading on a per-schema basis
32
- use_preloading
38
+ enable_active_record_batching
33
39
  query Query
34
40
  mutation Mutation
35
41
  end
data/_test_.db CHANGED
Binary file
@@ -24,9 +24,10 @@ Gem::Specification.new do |spec|
24
24
  spec.add_development_dependency "minitest", "~> 5.10.1"
25
25
  spec.add_development_dependency "minitest-focus", "~> 1.1"
26
26
  spec.add_development_dependency "minitest-reporters", "~>1.0"
27
- spec.add_development_dependency "activerecord"
28
27
  spec.add_development_dependency "sqlite3"
29
28
  spec.add_development_dependency "byebug"
29
+ spec.add_development_dependency "simplecov"
30
+ spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
30
31
 
31
32
  spec.add_runtime_dependency "activerecord"
32
33
  spec.add_runtime_dependency "graphql"
@@ -14,7 +14,7 @@ GraphQL::Field.accepts_definitions(preloads: GraphQL::Define.assign_metadata_key
14
14
  GraphQL::ObjectType.accepts_definitions(model: GraphQL::Define.assign_metadata_key(:model))
15
15
 
16
16
  # A definition on schema lets us avoid documenting how to setup instrumenters
17
- GraphQL::Schema.accepts_definitions(use_preloading: ->(schema) {
17
+ GraphQL::Schema.accepts_definitions(enable_active_record_batching: ->(schema) {
18
18
  schema.lazy_methods.set(Promise, :sync)
19
19
  schema.instrument(:query, GraphQL::Batch::Setup)
20
20
  schema.instrument(:field, GraphQL::ActiveRecordBatcher::FieldInstrumenter.new)
@@ -34,8 +34,6 @@ module GraphQL
34
34
  attr_reader :model, :association
35
35
 
36
36
  def association_loaded?(record)
37
- puts record
38
- puts @association
39
37
  record.association(@association).loaded?
40
38
  end
41
39
  end
@@ -1,5 +1,5 @@
1
1
  module GraphQL
2
2
  module ActiveRecordBatcher
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: graphql-active_record_batcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc-Andre Giroux
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: activerecord
84
+ name: sqlite3
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="
@@ -95,7 +95,7 @@ dependencies:
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
- name: sqlite3
98
+ name: byebug
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - ">="
@@ -109,7 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
- name: byebug
112
+ name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
115
  - - ">="
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: codeclimate-test-reporter
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: 1.0.0
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: 1.0.0
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: activerecord
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -185,7 +199,10 @@ executables: []
185
199
  extensions: []
186
200
  extra_rdoc_files: []
187
201
  files:
202
+ - ".codeclimate.yml"
188
203
  - ".gitignore"
204
+ - ".rubocop.yml"
205
+ - ".travis.yml"
189
206
  - CODE_OF_CONDUCT.md
190
207
  - Gemfile
191
208
  - Gemfile.lock
@@ -220,7 +237,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
237
  version: '0'
221
238
  requirements: []
222
239
  rubyforge_project:
223
- rubygems_version: 2.6.10
240
+ rubygems_version: 2.5.1
224
241
  signing_key:
225
242
  specification_version: 4
226
243
  summary: Association Preloading and Query Batching for GraphQL