workarea-core 3.4.33 → 3.4.34

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: 9380a926427872b88a127eeca3d80b734d8679e297cd691a409b2125d181b210
4
- data.tar.gz: 37b763327a0a0f7eec7d34b4f744eae59580a8717f1e0bac3b4fadc830c62f61
3
+ metadata.gz: 314c6ea37c26a932c59db1704e58543674eaf44df1751825d2141a7466c9069a
4
+ data.tar.gz: fc6e14cb1bb9c8cfc0d4d2c884847b30bba2c7a9bb62cbc15b722abbb71f90e8
5
5
  SHA512:
6
- metadata.gz: 6da8af3694f295513a48512a0fd51f2309c04f33b400461dfb90727c8d4b083a7e291e0e66edb69ae23ba9a55a4f8eb5351b34434da153ed915bada8ccdabe7d
7
- data.tar.gz: f15b4a14d8e5a44f0acbc71c2c780731b0f9b3c3f07c8223e5aa15ba5d9ad48f8a779d81a10dd33b2561503fff5da37f7478ed3dedb7cfd6bfee5e6931b47a37
6
+ metadata.gz: 4970592a6e9a7bfee84f97b2bd5f9a3ad8d361f76af3c7ba537d870bb23f714e1aff417c6ed1e2694d65b0b0be993753fce7a34b9f18557900ece6dcfa90f9b6
7
+ data.tar.gz: 05cf391954ee8613ff48071f7f66ea68178e78f07b41a91ab545de6ed22f53feb721d11f56014aa21dd3e0d365c5aafc1839b142cbeaaa4f4a65a4d787a5a025
@@ -21,7 +21,7 @@ module Workarea
21
21
  end
22
22
 
23
23
  def keywords
24
- super + model.promo_codes
24
+ super + Array.wrap(model.try(:promo_codes))
25
25
  end
26
26
 
27
27
  def facets
@@ -8,7 +8,12 @@ module Workarea
8
8
  url += ":#{uri.port}" unless uri.port.in? [80, 443]
9
9
  id = "direct_upload_#{url}"
10
10
 
11
- response = Workarea.s3.get_bucket_cors(Configuration::S3.bucket)
11
+ response = begin
12
+ Workarea.s3.get_bucket_cors(Configuration::S3.bucket)
13
+ rescue Excon::Error::NotFound
14
+ Excon::Response.new(body: { 'CORSConfiguration' => [] })
15
+ end
16
+
12
17
  cors = response.data[:body]
13
18
 
14
19
  unless cors['CORSConfiguration'].pluck('ID').include?(id)
@@ -12,7 +12,9 @@ namespace :workarea do
12
12
  require 'sidekiq/testing/inline' unless ENV['INLINE'] == 'false'
13
13
  puts 'Indexing admin...'
14
14
 
15
- Workarea::Search::Admin.reset_indexes!
15
+ Workarea::QueuesPauser.with_paused_queues do
16
+ Workarea::Search::Admin.reset_indexes!
17
+ end
16
18
 
17
19
  Mongoid.models.each do |klass|
18
20
  next unless Workarea::Search::Admin.for(klass.first).present?
@@ -32,8 +34,10 @@ namespace :workarea do
32
34
  require 'sidekiq/testing/inline' unless ENV['INLINE'] == 'false'
33
35
  puts 'Indexing storefront...'
34
36
 
35
- Workarea::Search::Storefront.reset_indexes!
36
- Workarea::Search::Storefront.ensure_dynamic_mappings
37
+ Workarea::QueuesPauser.with_paused_queues do
38
+ Workarea::Search::Storefront.reset_indexes!
39
+ Workarea::Search::Storefront.ensure_dynamic_mappings
40
+ end
37
41
 
38
42
  # This code finds all unique filters for products so we can index a sample
39
43
  # product for each to ensure the dynamic mappings get created.
@@ -79,7 +83,9 @@ namespace :workarea do
79
83
  require 'sidekiq/testing/inline' unless ENV['INLINE'] == 'false'
80
84
  puts 'Indexing help...'
81
85
 
82
- Workarea::Search::Help.reset_indexes!
86
+ Workarea::QueuesPauser.with_paused_queues do
87
+ Workarea::Search::Help.reset_indexes!
88
+ end
83
89
 
84
90
  Workarea::Help::Article.all.each_by(100) do |help_article|
85
91
  Workarea::Search::Help.new(help_article).save
@@ -208,6 +208,7 @@ require 'workarea/cache'
208
208
  require 'workarea/scheduled_jobs'
209
209
  require 'workarea/string_id'
210
210
  require 'workarea/mail_interceptor'
211
+ require 'workarea/queues_pauser'
211
212
 
212
213
  #
213
214
  # Engines
@@ -0,0 +1,26 @@
1
+ module Workarea
2
+ module QueuesPauser
3
+ extend self
4
+
5
+ def pause_queues!
6
+ pauser = Sidekiq::Throttled::QueuesPauser.instance
7
+ queues.each { |queue| pauser.pause!(queue) }
8
+ end
9
+
10
+ def resume_queues!
11
+ pauser = Sidekiq::Throttled::QueuesPauser.instance
12
+ queues.each { |queue| pauser.resume!(queue) }
13
+ end
14
+
15
+ def with_paused_queues(&block)
16
+ pause_queues!
17
+ yield
18
+ ensure
19
+ resume_queues!
20
+ end
21
+
22
+ def queues
23
+ Configuration::Sidekiq.queues
24
+ end
25
+ end
26
+ end
@@ -2,7 +2,7 @@ module Workarea
2
2
  module VERSION
3
3
  MAJOR = 3
4
4
  MINOR = 4
5
- PATCH = 33
5
+ PATCH = 34
6
6
  PRE = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join('.')
@@ -112,6 +112,26 @@ module Workarea
112
112
  assert(DirectUpload.ensure_cors!('https://example.com/admin/direct_uploads'))
113
113
  end
114
114
 
115
+ def test_ensure_cors_with_no_existing_configuration
116
+ Workarea.s3.expects(:get_bucket_cors)
117
+ .raises(Excon::Errors::NotFound.new('CORS configuration does not exist'))
118
+
119
+
120
+ Workarea.s3.expects(:put_bucket_cors).with(
121
+ Configuration::S3.bucket,
122
+ 'CORSConfiguration' => [
123
+ {
124
+ 'ID' => "direct_upload_http://test.host",
125
+ 'AllowedMethod' => 'PUT',
126
+ 'AllowedOrigin' => 'http://test.host',
127
+ 'AllowedHeader' => '*'
128
+ }
129
+ ]
130
+ ).returns(true)
131
+
132
+ assert(DirectUpload.ensure_cors!('http://test.host/admin/content_assets'))
133
+ end
134
+
115
135
  private
116
136
 
117
137
  def upload_file
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
  s.add_dependency 'mongoid-tree', '~> 2.1.0'
25
25
  s.add_dependency 'mongoid-sample', '~> 0.1.0'
26
26
  s.add_dependency 'elasticsearch', '~> 5.0.1'
27
- s.add_dependency 'kaminari', '~> 0.17.0'
27
+ s.add_dependency 'kaminari', '~> 1.2.1'
28
28
  s.add_dependency 'kaminari-mongoid', '~> 0.1.2'
29
29
  s.add_dependency 'activemerchant', '~> 1.52'
30
30
  s.add_dependency 'dragonfly', '~> 1.1.2'
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.add_dependency 'sidekiq-cron', '~> 0.6.3'
33
33
  s.add_dependency 'sidekiq-unique-jobs', '~> 6.0.6'
34
34
  s.add_dependency 'sidekiq-throttled', '~> 0.8.2'
35
- s.add_dependency 'geocoder', '~> 1.4.4'
35
+ s.add_dependency 'geocoder', '~> 1.6.3'
36
36
  s.add_dependency 'redis-rails', '~> 5.0.0'
37
37
  s.add_dependency 'redis-rack-cache', '~> 2.2.0'
38
38
  s.add_dependency 'easymon', '~> 1.4.0'
@@ -65,7 +65,7 @@ Gem::Specification.new do |s|
65
65
  s.add_dependency 'chart-horizontalbar-rails', '~> 1.0.4' # TODO remove v4
66
66
  s.add_dependency 'select2-rails', '~> 4.0.3'
67
67
  s.add_dependency 'wysihtml-rails', '~> 0.6.0.beta2'
68
- s.add_dependency 'rack-attack', '~> 5.0.1'
68
+ s.add_dependency 'rack-attack', '~> 6.3.1'
69
69
  s.add_dependency 'jquery-livetype-rails', '~> 0.1.0' # TODO remove v4
70
70
  s.add_dependency 'redcarpet', '~> 3.4.0'
71
71
  s.add_dependency 'jquery-unique-clone-rails', '~> 1.0.0'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.4.33
4
+ version: 3.4.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Crouse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-26 00:00:00.000000000 Z
11
+ date: 2020-06-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: 0.17.0
159
+ version: 1.2.1
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: 0.17.0
166
+ version: 1.2.1
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: kaminari-mongoid
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -268,14 +268,14 @@ dependencies:
268
268
  requirements:
269
269
  - - "~>"
270
270
  - !ruby/object:Gem::Version
271
- version: 1.4.4
271
+ version: 1.6.3
272
272
  type: :runtime
273
273
  prerelease: false
274
274
  version_requirements: !ruby/object:Gem::Requirement
275
275
  requirements:
276
276
  - - "~>"
277
277
  - !ruby/object:Gem::Version
278
- version: 1.4.4
278
+ version: 1.6.3
279
279
  - !ruby/object:Gem::Dependency
280
280
  name: redis-rails
281
281
  requirement: !ruby/object:Gem::Requirement
@@ -730,14 +730,14 @@ dependencies:
730
730
  requirements:
731
731
  - - "~>"
732
732
  - !ruby/object:Gem::Version
733
- version: 5.0.1
733
+ version: 6.3.1
734
734
  type: :runtime
735
735
  prerelease: false
736
736
  version_requirements: !ruby/object:Gem::Requirement
737
737
  requirements:
738
738
  - - "~>"
739
739
  - !ruby/object:Gem::Version
740
- version: 5.0.1
740
+ version: 6.3.1
741
741
  - !ruby/object:Gem::Dependency
742
742
  name: jquery-livetype-rails
743
743
  requirement: !ruby/object:Gem::Requirement
@@ -1895,6 +1895,7 @@ files:
1895
1895
  - lib/workarea/ping_home_base.rb
1896
1896
  - lib/workarea/plugin.rb
1897
1897
  - lib/workarea/plugin/asset_appends_helper.rb
1898
+ - lib/workarea/queues_pauser.rb
1898
1899
  - lib/workarea/robots.rb
1899
1900
  - lib/workarea/routes_constraints/redirect.rb
1900
1901
  - lib/workarea/routes_constraints/super_admin.rb