chewy 0.8.3 → 0.8.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +43 -11
  3. data/Appraisals +39 -12
  4. data/CHANGELOG.md +42 -0
  5. data/Gemfile +1 -1
  6. data/README.md +60 -7
  7. data/chewy.gemspec +12 -5
  8. data/gemfiles/{rails.4.0.mongoid.gemfile → rails.4.0.mongoid.4.0.0.gemfile} +1 -1
  9. data/gemfiles/{rails.4.0.mongoid.kaminari.gemfile → rails.4.0.mongoid.4.0.0.kaminari.gemfile} +1 -1
  10. data/gemfiles/{rails.4.0.mongoid.will_paginate.gemfile → rails.4.0.mongoid.4.0.0.will_paginate.gemfile} +1 -1
  11. data/gemfiles/rails.4.0.mongoid.5.1.0.gemfile +15 -0
  12. data/gemfiles/rails.4.0.mongoid.5.1.0.kaminari.gemfile +14 -0
  13. data/gemfiles/rails.4.0.mongoid.5.1.0.will_paginate.gemfile +14 -0
  14. data/gemfiles/{rails.4.1.mongoid.gemfile → rails.4.1.mongoid.4.0.0.gemfile} +1 -1
  15. data/gemfiles/{rails.4.1.mongoid.kaminari.gemfile → rails.4.1.mongoid.4.0.0.kaminari.gemfile} +1 -1
  16. data/gemfiles/{rails.4.1.mongoid.will_paginate.gemfile → rails.4.1.mongoid.4.0.0.will_paginate.gemfile} +1 -1
  17. data/gemfiles/rails.4.1.mongoid.5.1.0.gemfile +15 -0
  18. data/gemfiles/rails.4.1.mongoid.5.1.0.kaminari.gemfile +14 -0
  19. data/gemfiles/rails.4.1.mongoid.5.1.0.will_paginate.gemfile +14 -0
  20. data/gemfiles/{rails.4.2.mongoid.gemfile → rails.4.2.mongoid.4.0.0.gemfile} +1 -1
  21. data/gemfiles/{rails.4.2.mongoid.kaminari.gemfile → rails.4.2.mongoid.4.0.0.kaminari.gemfile} +1 -1
  22. data/gemfiles/{rails.4.2.mongoid.will_paginate.gemfile → rails.4.2.mongoid.4.0.0.will_paginate.gemfile} +1 -1
  23. data/gemfiles/rails.4.2.mongoid.5.1.0.gemfile +15 -0
  24. data/gemfiles/rails.4.2.mongoid.5.1.0.kaminari.gemfile +14 -0
  25. data/gemfiles/rails.4.2.mongoid.5.1.0.will_paginate.gemfile +14 -0
  26. data/gemfiles/rails.5.0.0.beta3.activerecord.gemfile +16 -0
  27. data/gemfiles/rails.5.0.0.beta3.activerecord.kaminari.gemfile +16 -0
  28. data/gemfiles/rails.5.0.0.beta3.activerecord.will_paginate.gemfile +15 -0
  29. data/gemfiles/{sequel.4.28.gemfile → sequel.4.31.gemfile} +1 -1
  30. data/lib/chewy.rb +7 -1
  31. data/lib/chewy/errors.rb +6 -0
  32. data/lib/chewy/fields/base.rb +12 -8
  33. data/lib/chewy/fields/root.rb +1 -1
  34. data/lib/chewy/index.rb +17 -8
  35. data/lib/chewy/index/actions.rb +4 -4
  36. data/lib/chewy/query.rb +8 -13
  37. data/lib/chewy/query/compose.rb +2 -2
  38. data/lib/chewy/query/criteria.rb +2 -2
  39. data/lib/chewy/query/loading.rb +1 -1
  40. data/lib/chewy/query/nodes/bool.rb +1 -1
  41. data/lib/chewy/query/nodes/regexp.rb +2 -2
  42. data/lib/chewy/railtie.rb +15 -3
  43. data/lib/chewy/rake_helper.rb +5 -2
  44. data/lib/chewy/rspec/update_index.rb +17 -6
  45. data/lib/chewy/strategy.rb +7 -3
  46. data/lib/chewy/strategy/active_job.rb +2 -2
  47. data/lib/chewy/strategy/resque.rb +2 -2
  48. data/lib/chewy/strategy/sidekiq.rb +2 -2
  49. data/lib/chewy/type.rb +14 -0
  50. data/lib/chewy/type/adapter/active_record.rb +11 -1
  51. data/lib/chewy/type/adapter/orm.rb +13 -11
  52. data/lib/chewy/type/adapter/sequel.rb +10 -12
  53. data/lib/chewy/type/import.rb +53 -22
  54. data/lib/chewy/type/witchcraft.rb +208 -0
  55. data/lib/chewy/type/wrapper.rb +25 -7
  56. data/lib/chewy/version.rb +1 -1
  57. data/lib/tasks/chewy.rake +22 -14
  58. data/spec/chewy/fields/base_spec.rb +6 -2
  59. data/spec/chewy/fields/time_fields_spec.rb +4 -4
  60. data/spec/chewy/index/actions_spec.rb +32 -18
  61. data/spec/chewy/index_spec.rb +19 -0
  62. data/spec/chewy/query/pagination_spec.rb +1 -1
  63. data/spec/chewy/query_spec.rb +77 -21
  64. data/spec/chewy/rspec/update_index_spec.rb +75 -62
  65. data/spec/chewy/runtime_spec.rb +1 -1
  66. data/spec/chewy/strategy/active_job_spec.rb +6 -1
  67. data/spec/chewy/strategy/atomic_spec.rb +5 -5
  68. data/spec/chewy/strategy/resque_spec.rb +7 -2
  69. data/spec/chewy/strategy/sidekiq_spec.rb +6 -1
  70. data/spec/chewy/strategy_spec.rb +13 -1
  71. data/spec/chewy/type/actions_spec.rb +4 -1
  72. data/spec/chewy/type/import_spec.rb +71 -2
  73. data/spec/chewy/type/observe_spec.rb +9 -9
  74. data/spec/chewy/type/witchcraft_spec.rb +154 -0
  75. data/spec/chewy/type/wrapper_spec.rb +30 -5
  76. data/spec/chewy/type_spec.rb +10 -0
  77. data/spec/chewy_spec.rb +29 -5
  78. data/spec/spec_helper.rb +2 -0
  79. data/spec/support/class_helpers.rb +15 -0
  80. data/spec/support/mongoid.rb +5 -0
  81. metadata +64 -21
@@ -30,6 +30,8 @@ Chewy.settings = {
30
30
  RSpec.configure do |config|
31
31
  config.mock_with :rspec
32
32
  config.order = :random
33
+ config.filter_run focus: true
34
+ config.run_all_when_everything_filtered = true
33
35
 
34
36
  config.include FailHelpers
35
37
  config.include ClassHelpers
@@ -13,4 +13,19 @@ module ClassHelpers
13
13
  def stub_model name, superclass = nil, &block
14
14
  raise NotImplementedError, 'Seems like no ORM/ODM are loaded, please check your Gemfile'
15
15
  end
16
+
17
+ def skip_on_version_gte version, message = "Removed from elasticsearch #{version}"
18
+ skip message if Chewy::Runtime.version >= version
19
+ end
20
+
21
+ def skip_on_version_lt version, message = "Only for elasticsearch #{version} and greater"
22
+ skip message if Chewy::Runtime.version < version
23
+ end
24
+
25
+ def skip_on_plugin_missing_from_version plugin, version, message = "Plugin '#{plugin}' is missing on elasticsearch > #{version}"
26
+ if Chewy::Runtime.version >= version
27
+ plugins = Chewy.client.nodes.info(plugins: true)["nodes"].values.map { |item| item["plugins"] }.flatten
28
+ skip message unless plugins.find { |item| item["name"] == plugin }
29
+ end
30
+ end
16
31
  end
@@ -5,6 +5,11 @@ CONFIG = {
5
5
  default: {
6
6
  uri: 'mongodb://127.0.0.1:27017/chewy_mongoid_test'
7
7
  }
8
+ },
9
+ clients: {
10
+ default: {
11
+ uri: 'mongodb://127.0.0.1:27017/chewy_mongoid_test'
12
+ }
8
13
  }
9
14
  }
10
15
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chewy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - pyromaniac
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-08 00:00:00.000000000 Z
11
+ date: 2016-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: 3.4.0
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: 3.4.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec-its
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -98,16 +98,16 @@ dependencies:
98
98
  name: database_cleaner
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
- version: 1.3.0
103
+ version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
- version: 1.3.0
110
+ version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: elasticsearch-extensions
113
113
  requirement: !ruby/object:Gem::Requirement
@@ -136,6 +136,34 @@ dependencies:
136
136
  - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: method_source
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ">="
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: unparser
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ">="
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
139
167
  - !ruby/object:Gem::Dependency
140
168
  name: activesupport
141
169
  requirement: !ruby/object:Gem::Requirement
@@ -190,22 +218,34 @@ files:
190
218
  - gemfiles/rails.4.0.activerecord.gemfile
191
219
  - gemfiles/rails.4.0.activerecord.kaminari.gemfile
192
220
  - gemfiles/rails.4.0.activerecord.will_paginate.gemfile
193
- - gemfiles/rails.4.0.mongoid.gemfile
194
- - gemfiles/rails.4.0.mongoid.kaminari.gemfile
195
- - gemfiles/rails.4.0.mongoid.will_paginate.gemfile
221
+ - gemfiles/rails.4.0.mongoid.4.0.0.gemfile
222
+ - gemfiles/rails.4.0.mongoid.4.0.0.kaminari.gemfile
223
+ - gemfiles/rails.4.0.mongoid.4.0.0.will_paginate.gemfile
224
+ - gemfiles/rails.4.0.mongoid.5.1.0.gemfile
225
+ - gemfiles/rails.4.0.mongoid.5.1.0.kaminari.gemfile
226
+ - gemfiles/rails.4.0.mongoid.5.1.0.will_paginate.gemfile
196
227
  - gemfiles/rails.4.1.activerecord.gemfile
197
228
  - gemfiles/rails.4.1.activerecord.kaminari.gemfile
198
229
  - gemfiles/rails.4.1.activerecord.will_paginate.gemfile
199
- - gemfiles/rails.4.1.mongoid.gemfile
200
- - gemfiles/rails.4.1.mongoid.kaminari.gemfile
201
- - gemfiles/rails.4.1.mongoid.will_paginate.gemfile
230
+ - gemfiles/rails.4.1.mongoid.4.0.0.gemfile
231
+ - gemfiles/rails.4.1.mongoid.4.0.0.kaminari.gemfile
232
+ - gemfiles/rails.4.1.mongoid.4.0.0.will_paginate.gemfile
233
+ - gemfiles/rails.4.1.mongoid.5.1.0.gemfile
234
+ - gemfiles/rails.4.1.mongoid.5.1.0.kaminari.gemfile
235
+ - gemfiles/rails.4.1.mongoid.5.1.0.will_paginate.gemfile
202
236
  - gemfiles/rails.4.2.activerecord.gemfile
203
237
  - gemfiles/rails.4.2.activerecord.kaminari.gemfile
204
238
  - gemfiles/rails.4.2.activerecord.will_paginate.gemfile
205
- - gemfiles/rails.4.2.mongoid.gemfile
206
- - gemfiles/rails.4.2.mongoid.kaminari.gemfile
207
- - gemfiles/rails.4.2.mongoid.will_paginate.gemfile
208
- - gemfiles/sequel.4.28.gemfile
239
+ - gemfiles/rails.4.2.mongoid.4.0.0.gemfile
240
+ - gemfiles/rails.4.2.mongoid.4.0.0.kaminari.gemfile
241
+ - gemfiles/rails.4.2.mongoid.4.0.0.will_paginate.gemfile
242
+ - gemfiles/rails.4.2.mongoid.5.1.0.gemfile
243
+ - gemfiles/rails.4.2.mongoid.5.1.0.kaminari.gemfile
244
+ - gemfiles/rails.4.2.mongoid.5.1.0.will_paginate.gemfile
245
+ - gemfiles/rails.5.0.0.beta3.activerecord.gemfile
246
+ - gemfiles/rails.5.0.0.beta3.activerecord.kaminari.gemfile
247
+ - gemfiles/rails.5.0.0.beta3.activerecord.will_paginate.gemfile
248
+ - gemfiles/sequel.4.31.gemfile
209
249
  - lib/chewy.rb
210
250
  - lib/chewy/backports/deep_dup.rb
211
251
  - lib/chewy/backports/duplicable.rb
@@ -275,6 +315,7 @@ files:
275
315
  - lib/chewy/type/import.rb
276
316
  - lib/chewy/type/mapping.rb
277
317
  - lib/chewy/type/observe.rb
318
+ - lib/chewy/type/witchcraft.rb
278
319
  - lib/chewy/type/wrapper.rb
279
320
  - lib/chewy/version.rb
280
321
  - lib/generators/chewy/install_generator.rb
@@ -330,6 +371,7 @@ files:
330
371
  - spec/chewy/type/import_spec.rb
331
372
  - spec/chewy/type/mapping_spec.rb
332
373
  - spec/chewy/type/observe_spec.rb
374
+ - spec/chewy/type/witchcraft_spec.rb
333
375
  - spec/chewy/type/wrapper_spec.rb
334
376
  - spec/chewy/type_spec.rb
335
377
  - spec/chewy_spec.rb
@@ -359,7 +401,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
359
401
  version: '0'
360
402
  requirements: []
361
403
  rubyforge_project:
362
- rubygems_version: 2.4.5.1
404
+ rubygems_version: 2.4.8
363
405
  signing_key:
364
406
  specification_version: 4
365
407
  summary: Elasticsearch ODM client wrapper
@@ -413,6 +455,7 @@ test_files:
413
455
  - spec/chewy/type/import_spec.rb
414
456
  - spec/chewy/type/mapping_spec.rb
415
457
  - spec/chewy/type/observe_spec.rb
458
+ - spec/chewy/type/witchcraft_spec.rb
416
459
  - spec/chewy/type/wrapper_spec.rb
417
460
  - spec/chewy/type_spec.rb
418
461
  - spec/chewy_spec.rb