worker_plugins 0.0.6 → 0.0.8

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45f9e6adbbcb13324a929a4acae8113a369f940bc737fa7656c7a98f9d4d4c4b
4
- data.tar.gz: fcadd8920cbabc6f9bc183782a65aa3fabbb902dd6e6bcd44ab31ee0bf7e42ef
3
+ metadata.gz: e84dd175df29b54e897c3419a3651eaad8720a7448d6b6ae1213e04512257814
4
+ data.tar.gz: ab7a00dbe5b64bad121b082dab5e21f577070ef64c65cf8e5bc612d348b98f64
5
5
  SHA512:
6
- metadata.gz: f758a4bf34e0f0970cab4051e1688883dbf52014cb75303ed91f5d95c387ac8631ee9643df41e07c7fcd75e50726d4be3fd90ac46b7c3ab24c1901f120827009
7
- data.tar.gz: 6f32eb60a99eccb55f3da1881e314a31a5d53e838795482f4e2389afc9e8af1679e41f32eae97aced2c3f2121017b8cbf477a5e53637d2ea2a658b29bc87db91
6
+ metadata.gz: 34f102da30a84f0372d49a97f523587674e1aac79cc7f439e0c9214edcdc52751613d9844efa75baa60e3c2b4c4cc252e219a9a61ad8da56d1204744a2d96e55
7
+ data.tar.gz: a3f2d50025aa0ea2b4672d222a11c6068f960fe3481c5a3ce5cdbe012817ea34071f67f6626134a6ff1a17f16c228d55bc2d15a0051f968d6ab61006ea9c4388
@@ -16,7 +16,7 @@ class WorkerPlugins::Workplace < WorkerPlugins::ApplicationRecord
16
16
  workplace_links.each do |workplace_link|
17
17
  yield workplace_link.resource
18
18
  count += 1
19
- return if limit && count >= limit # rubocop:disable Lint/NonLocalExitFromIterator:
19
+ return if limit && count >= limit # rubocop:disable Lint/NonLocalExitFromIterator
20
20
  end
21
21
  end
22
22
  end
@@ -30,7 +30,7 @@ class WorkerPlugins::Workplace < WorkerPlugins::ApplicationRecord
30
30
  ids.each_slice(500) do |ids_slice|
31
31
  query = constant.where(id: ids_slice)
32
32
 
33
- yield(query: query, resource_type: resource_type)
33
+ yield(query:, resource_type:)
34
34
  end
35
35
  end
36
36
  end
@@ -41,11 +41,11 @@ class WorkerPlugins::Workplace < WorkerPlugins::ApplicationRecord
41
41
 
42
42
  private
43
43
 
44
- def stream_each(list, &blk)
44
+ def stream_each(list, &)
45
45
  if list.respond_to?(:find_each)
46
- list.find_each(&blk)
46
+ list.find_each(&)
47
47
  else
48
- list.each(&blk)
48
+ list.each(&)
49
49
  end
50
50
  end
51
51
 
@@ -10,7 +10,7 @@ class WorkerPlugins::AddQuery < WorkerPlugins::ApplicationService
10
10
  def perform
11
11
  created # Cache which are about to be created
12
12
  add_query_to_workplace
13
- succeed!(created: created)
13
+ succeed!(created:)
14
14
  end
15
15
 
16
16
  def add_query_to_workplace
@@ -47,7 +47,7 @@ class WorkerPlugins::AddQuery < WorkerPlugins::ApplicationService
47
47
  WorkerPlugins::SelectColumnWithTypeCast.execute!(
48
48
  column_name_to_select: :id,
49
49
  column_to_compare_with: WorkerPlugins::WorkplaceLink.column_for_attribute(:resource_id),
50
- query: query
50
+ query:
51
51
  )
52
52
  end
53
53
 
@@ -11,8 +11,8 @@ class WorkerPlugins::QueryLinksStatus < WorkerPlugins::ApplicationService
11
11
 
12
12
  succeed!(
13
13
  all_checked: query_count == checked_count,
14
- checked_count: checked_count,
15
- query_count: query_count,
14
+ checked_count:,
15
+ query_count:,
16
16
  some_checked: checked_count.positive? && checked_count < query_count
17
17
  )
18
18
  end
@@ -5,7 +5,7 @@ class WorkerPlugins::RemoveQuery < WorkerPlugins::ApplicationService
5
5
 
6
6
  def perform
7
7
  remove_query_from_workplace
8
- succeed!(destroyed: destroyed, mode: :destroyed)
8
+ succeed!(destroyed:, mode: :destroyed)
9
9
  end
10
10
 
11
11
  def remove_query_from_workplace
@@ -3,13 +3,13 @@ class WorkerPlugins::SwitchQuery < WorkerPlugins::ApplicationService
3
3
 
4
4
  def perform
5
5
  if resources_to_add.count.zero?
6
- result = WorkerPlugins::RemoveQuery.execute!(query: query, workplace: workplace)
6
+ result = WorkerPlugins::RemoveQuery.execute!(query:, workplace:)
7
7
  succeed!(
8
8
  destroyed: result.fetch(:destroyed),
9
9
  mode: :destroyed
10
10
  )
11
11
  else
12
- result = WorkerPlugins::AddQuery.execute!(query: query, workplace: workplace)
12
+ result = WorkerPlugins::AddQuery.execute!(query:, workplace:)
13
13
  succeed!(
14
14
  created: result.fetch(:created),
15
15
  mode: :created
@@ -39,7 +39,7 @@ class WorkerPlugins::SwitchQuery < WorkerPlugins::ApplicationService
39
39
  WorkerPlugins::SelectColumnWithTypeCast.execute!(
40
40
  column_name_to_select: :id,
41
41
  column_to_compare_with: WorkerPlugins::WorkplaceLink.column_for_attribute(:resource_id),
42
- query: query
42
+ query:
43
43
  )
44
44
  end
45
45
 
@@ -1,9 +1,9 @@
1
1
  class WorkerPlugins::UserRelationshipPolymorphic
2
2
  def self.execute!
3
3
  WorkerPlugins::Workplace.columns_hash.key?("user_type")
4
- rescue ActiveRecord::StatementInvalid => e
4
+ rescue StandardError => e
5
5
  # Fall back to true if we are in the middle of a migration or something
6
- return true if e.message.start_with?("Could not find table")
6
+ return true if e.message.start_with?("Could not find table") || e.message.match(/Table '(.+)' doesn't exist/)
7
7
 
8
8
  raise e
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module WorkerPlugins
2
- VERSION = "0.0.6".freeze
2
+ VERSION = "0.0.8".freeze
3
3
  end
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: worker_plugins
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
- - Kasper Johanmsen
7
+ - Kasper Stöckel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-12-27 00:00:00.000000000 Z
11
+ date: 2025-04-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Rails framework for easily choosing and creating lists of objects and
14
14
  execute plugins against them.
15
15
  email:
16
- - kaspernj@gmail.com
16
+ - kasper@diestoeckels.de
17
17
  executables: []
18
18
  extensions: []
19
19
  extra_rdoc_files: []
@@ -56,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: 2.7.8
59
+ version: 3.2.2
60
60
  required_rubygems_version: !ruby/object:Gem::Requirement
61
61
  requirements:
62
62
  - - ">="