chewy 7.3.2 → 7.3.3

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
  SHA256:
3
- metadata.gz: 4fce5e949350a7256e302f88e4f085e186b41b947944bfca3278bc6b63d308f7
4
- data.tar.gz: 1454ca0cb5550ce118de31b37bbd05dca8c7c0a07c0cc78cd75552e6fbcead30
3
+ metadata.gz: 60e69fe04eed332db4c9ce826c821609a19745f093a12d396d30a25e7785ae4a
4
+ data.tar.gz: fe8112b8ff752725b4535ad32ffac4483fc210bd4250de92c26251a04e94890b
5
5
  SHA512:
6
- metadata.gz: c4ec988d938d54bcb934007bf43d1f6035c474b425718cc3ad38e092aebc46213da79e911d8bd8861fa3af8fa36200d4e05b351cb01b6f647aac36a172123b39
7
- data.tar.gz: 674648b1ace4d6f72d54a1e4efdc5984e49b270da1a89e52cf42f6b8b4f539a9e55f6ca5e9970ac494208f67b970cc0c280241d560067f79c238ffce5ad680f4
6
+ metadata.gz: 78188a2f073d618aafc5b5677694196c9f4102be5530873a49514bc1bddd93fef87394238ea4220746671a9ea112c9df8b9ada89b41ca56d32b7bc2dfe72f451
7
+ data.tar.gz: 207b683ccfc886536cf626e8621b1b6dece73bb155251109d9a226e2a9583516bdc7cfedcc140ddbc1c0e2b4893965668a9c4a803baa5e0907c1dfa20dd0fe27
data/CHANGELOG.md CHANGED
@@ -8,6 +8,16 @@
8
8
 
9
9
  ### Bugs Fixed
10
10
 
11
+ ## 7.3.3 (2023-07-07)
12
+
13
+ ### New Features
14
+
15
+ * [#888](https://github.com/toptal/chewy/pull/888/files): Skip journal creation on import ([@konalegi](https://github.com/konalegi))
16
+
17
+ ### Changes
18
+
19
+ ### Bugs Fixed
20
+
11
21
  ## 7.3.2 (2023-04-20)
12
22
 
13
23
  ### New Features
@@ -64,7 +64,7 @@ module Chewy
64
64
  # Creates the journal index and the corresponding index if necessary.
65
65
  # @return [Object] whatever
66
66
  def create_indexes!
67
- Chewy::Stash::Journal.create if @options[:journal]
67
+ Chewy::Stash::Journal.create if @options[:journal] && !Chewy.configuration[:skip_journal_creation_on_import]
68
68
  return if Chewy.configuration[:skip_index_creation_on_import]
69
69
 
70
70
  @index.create!(**@bulk_options.slice(:suffix)) unless @index.exists?
@@ -197,6 +197,19 @@ module Chewy
197
197
  end
198
198
  end
199
199
 
200
+ # Creates journal index.
201
+ #
202
+ # @example
203
+ # Chewy::RakeHelper.journal_create # creates journal
204
+ #
205
+ # @param output [IO] output io for logging
206
+ # @return Chewy::Index Returns instance of chewy index
207
+ def journal_create(output: $stdout)
208
+ subscribed_task_stats(output) do
209
+ Chewy::Stash::Journal.create!
210
+ end
211
+ end
212
+
200
213
  # Eager loads and returns all the indexes defined in the application
201
214
  # except Chewy::Stash::Specification and Chewy::Stash::Journal.
202
215
  #
data/lib/chewy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Chewy
2
- VERSION = '7.3.2'.freeze
2
+ VERSION = '7.3.3'.freeze
3
3
  end
data/lib/tasks/chewy.rake CHANGED
@@ -87,6 +87,11 @@ namespace :chewy do
87
87
  end
88
88
 
89
89
  namespace :journal do
90
+ desc 'Create manually journal, useful when `skip_journal_creation_on_import` is used'
91
+ task create: :environment do |_task, _args|
92
+ Chewy::RakeHelper.journal_create
93
+ end
94
+
90
95
  desc 'Applies changes that were done after the specified time for the specified indexes/types or all of them'
91
96
  task apply: :environment do |_task, args|
92
97
  Chewy::RakeHelper.journal_apply(**parse_journal_args(args.extras))
@@ -60,6 +60,19 @@ describe Chewy::Index::Import do
60
60
  CitiesIndex.import(dummy_city)
61
61
  end
62
62
  end
63
+
64
+ context 'skip journal creation on import' do
65
+ before do
66
+ Chewy::Stash::Journal.create!
67
+ Chewy.config.settings[:skip_journal_creation_on_import] = true
68
+ end
69
+ after { Chewy.config.settings[:skip_journal_creation_on_import] = nil }
70
+
71
+ specify do
72
+ expect(Chewy::Stash::Journal).not_to receive(:create!)
73
+ CitiesIndex.import(dummy_city, journal: true)
74
+ end
75
+ end
63
76
  end
64
77
 
65
78
  shared_examples 'importing' do
@@ -470,6 +470,17 @@ Total: \\d+s\\Z
470
470
  end
471
471
  end
472
472
 
473
+ describe '.journal_create' do
474
+ specify do
475
+ output = StringIO.new
476
+ described_class.journal_create(output: output)
477
+ expect(Chewy::Stash::Journal.exists?).to be_truthy
478
+ expect(output.string).to match(Regexp.new(<<-OUTPUT, Regexp::MULTILINE))
479
+ Total: \\d+s\\Z
480
+ OUTPUT
481
+ end
482
+ end
483
+
473
484
  describe '.reindex' do
474
485
  before do
475
486
  journal
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chewy
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.3.2
4
+ version: 7.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toptal, LLC
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-04-21 00:00:00.000000000 Z
12
+ date: 2023-07-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: database_cleaner
@@ -482,7 +482,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
482
482
  - !ruby/object:Gem::Version
483
483
  version: '0'
484
484
  requirements: []
485
- rubygems_version: 3.3.26
485
+ rubygems_version: 3.4.10
486
486
  signing_key:
487
487
  specification_version: 4
488
488
  summary: Elasticsearch ODM client wrapper