worker_plugins 0.0.2 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +6 -1
- data/Rakefile +12 -12
- data/app/models/worker_plugins/workplace.rb +15 -45
- data/app/models/worker_plugins/workplace_link.rb +4 -2
- data/app/services/worker_plugins/add_query.rb +99 -0
- data/app/services/worker_plugins/application_service.rb +33 -0
- data/app/services/worker_plugins/query_links_status.rb +19 -0
- data/app/services/worker_plugins/remove_query.rb +28 -0
- data/app/services/worker_plugins/select_column_with_type_cast.rb +37 -0
- data/app/services/worker_plugins/switch_query.rb +49 -0
- data/config/routes.rb +1 -1
- data/db/migrate/20150521114555_create_worker_plugins_workplaces.rb +4 -7
- data/db/migrate/20150521114659_create_worker_plugins_workplace_links.rb +16 -6
- data/db/migrate/20200702072306_change_workplace_links_resource_id_to_string_to_support_uuids.rb +9 -0
- data/db/migrate/20210106190349_change_resource_id_to_string_to_support_uuid.rb +9 -0
- data/lib/worker_plugins/engine.rb +6 -12
- data/lib/worker_plugins/version.rb +1 -1
- data/lib/worker_plugins.rb +2 -1
- metadata +16 -92
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 8010aee14c8aa6b008bd0ab626f52a3e9da9c14c560d04f0c757f13781d4cbca
|
4
|
+
data.tar.gz: 3aba5e574d71e6671c0d45b68fea71a50b1d8c31ec13e166679f74eee0c09c9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44dfebac2c28da2dba9e4f8cf746088daa85b33729f46e00e5548ac252d09425904b182eef34980fe72e9b6b3c0289ba0d71dd4c7b2170f2bbc7924ef4ce26be
|
7
|
+
data.tar.gz: affd58ce192d134c0c4918f114d5a2423b0aadde3e21be1ccbda039b96162e88f2ab54cb779914692ddbe54a18e060a144e19179efe45e4b8d342b26f9d7e597
|
data/README.md
CHANGED
@@ -7,6 +7,11 @@ Add to your Gemfile and bundle:
|
|
7
7
|
gem 'worker_plugins'
|
8
8
|
```
|
9
9
|
|
10
|
+
Install migrations (only necessary sometimes - try running `rails db:migrate` first before installing migrations):
|
11
|
+
```bash
|
12
|
+
rails worker_plugins:install:migrations
|
13
|
+
```
|
14
|
+
|
10
15
|
## Usage
|
11
16
|
|
12
17
|
Add a lot of objects to a workspace through transactions:
|
@@ -24,4 +29,4 @@ workspace.each_resource(types: ['User']) do |user|
|
|
24
29
|
|
25
30
|
## License
|
26
31
|
|
27
|
-
This project rocks and uses MIT-LICENSE.
|
32
|
+
This project rocks and uses MIT-LICENSE.
|
data/Rakefile
CHANGED
@@ -1,26 +1,26 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
begin
|
3
|
-
require
|
3
|
+
require "bundler/setup"
|
4
4
|
rescue LoadError
|
5
|
-
puts
|
5
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
6
6
|
end
|
7
7
|
begin
|
8
|
-
require
|
8
|
+
require "rdoc/task"
|
9
9
|
rescue LoadError
|
10
|
-
require
|
11
|
-
require
|
10
|
+
require "rdoc/rdoc"
|
11
|
+
require "rake/rdoctask"
|
12
12
|
RDoc::Task = Rake::RDocTask
|
13
13
|
end
|
14
14
|
|
15
15
|
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
-
rdoc.rdoc_dir =
|
17
|
-
rdoc.title =
|
18
|
-
rdoc.options <<
|
19
|
-
rdoc.rdoc_files.include(
|
20
|
-
rdoc.rdoc_files.include(
|
16
|
+
rdoc.rdoc_dir = "rdoc"
|
17
|
+
rdoc.title = "WorkerPlugins"
|
18
|
+
rdoc.options << "--line-numbers"
|
19
|
+
rdoc.rdoc_files.include("README.rdoc")
|
20
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
21
21
|
end
|
22
22
|
|
23
|
-
APP_RAKEFILE = File.expand_path("
|
24
|
-
load
|
23
|
+
APP_RAKEFILE = File.expand_path("spec/dummy/Rakefile", __dir__)
|
24
|
+
load "rails/tasks/engine.rake"
|
25
25
|
|
26
26
|
Bundler::GemHelper.install_tasks
|
@@ -1,58 +1,28 @@
|
|
1
|
-
class WorkerPlugins::Workplace < ActiveRecord::Base
|
1
|
+
class WorkerPlugins::Workplace < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord
|
2
|
+
self.table_name = "worker_plugins_workplaces"
|
3
|
+
|
2
4
|
has_many :workplace_links, dependent: :destroy
|
3
5
|
|
4
6
|
belongs_to :user, polymorphic: true
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
def add_links_to_objects(objects)
|
9
|
-
require 'active-record-transactioner'
|
10
|
-
|
11
|
-
# Cache inserted objects.
|
12
|
-
inserted_ids = load_inserted_ids
|
13
|
-
|
14
|
-
# Add given objects through transactions.
|
15
|
-
ActiveRecordTransactioner.new do |trans|
|
16
|
-
stream_each(objects) do |object|
|
17
|
-
class_name = object.class.name.to_s
|
18
|
-
inserted_ids[class_name] ||= {}
|
19
|
-
|
20
|
-
unless inserted_ids[class_name].key?(object.id)
|
21
|
-
inserted_ids[class_name][object.id] = true
|
22
|
-
link = WorkerPlugins::WorkplaceLink.new(
|
23
|
-
workplace: self,
|
24
|
-
resource: object
|
25
|
-
)
|
26
|
-
trans.save!(link)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
8
|
+
validates :name, presence: true
|
30
9
|
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
def each_resource(args = {})
|
10
|
+
def each_resource(limit: nil, types: nil)
|
35
11
|
count = 0
|
36
12
|
|
37
|
-
links_query = workplace_links.
|
38
|
-
links_query = links_query.where(resource_type:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
ids.each_slice(500) do |ids_slice|
|
45
|
-
constant.where(id: ids_slice).each do |resource|
|
46
|
-
yield resource
|
47
|
-
count += 1
|
48
|
-
return if args[:limit] && count >= args[:limit]
|
49
|
-
end
|
13
|
+
links_query = workplace_links.order(:id)
|
14
|
+
links_query = links_query.where(resource_type: types) if types
|
15
|
+
links_query.find_in_batches do |workplace_links|
|
16
|
+
workplace_links.each do |workplace_link|
|
17
|
+
yield workplace_link.resource
|
18
|
+
count += 1
|
19
|
+
return if limit && count >= limit # rubocop:disable Lint/NonLocalExitFromIterator:
|
50
20
|
end
|
51
21
|
end
|
52
22
|
end
|
53
23
|
|
54
24
|
def each_query_for_resources
|
55
|
-
workplace_links.group(
|
25
|
+
workplace_links.group("worker_plugins_workplace_links.resource_type").order("worker_plugins_workplace_links.id").each do |workplace_link|
|
56
26
|
resource_type = workplace_link.resource_type
|
57
27
|
constant = Object.const_get(resource_type)
|
58
28
|
ids = workplace_links.select(:resource_id).where(resource_type: workplace_link.resource_type).map(&:resource_id)
|
@@ -82,11 +52,11 @@ private
|
|
82
52
|
def load_inserted_ids
|
83
53
|
inserted_ids = {}
|
84
54
|
|
85
|
-
workplace_links.select(
|
55
|
+
workplace_links.select(:id, :resource_type, :resource_id).find_each do |workplace_link|
|
86
56
|
inserted_ids[workplace_link.resource_type] ||= {}
|
87
57
|
inserted_ids[workplace_link.resource_type][workplace_link.resource_id] = true
|
88
58
|
end
|
89
59
|
|
90
|
-
|
60
|
+
inserted_ids
|
91
61
|
end
|
92
62
|
end
|
@@ -1,6 +1,8 @@
|
|
1
|
-
class WorkerPlugins::WorkplaceLink < ActiveRecord::Base
|
1
|
+
class WorkerPlugins::WorkplaceLink < ActiveRecord::Base # rubocop:disable Rails/ApplicationRecord
|
2
|
+
self.table_name = "worker_plugins_workplace_links"
|
3
|
+
|
2
4
|
belongs_to :workplace
|
3
5
|
belongs_to :resource, polymorphic: true
|
4
6
|
|
5
|
-
|
7
|
+
validates :resource_id, uniqueness: {scope: [:resource_type, :workplace_id]}
|
6
8
|
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
class WorkerPlugins::AddQuery < WorkerPlugins::ApplicationService
|
2
|
+
attr_reader :query, :workplace
|
3
|
+
|
4
|
+
def initialize(query:, workplace:)
|
5
|
+
@query = query
|
6
|
+
.except(:order) # This fixes crashes in Postgres
|
7
|
+
@workplace = workplace
|
8
|
+
end
|
9
|
+
|
10
|
+
def perform
|
11
|
+
created # Cache which are about to be created
|
12
|
+
add_query_to_workplace
|
13
|
+
succeed!(created: created)
|
14
|
+
end
|
15
|
+
|
16
|
+
def add_query_to_workplace
|
17
|
+
WorkerPlugins::WorkplaceLink.connection.execute(sql)
|
18
|
+
end
|
19
|
+
|
20
|
+
def created
|
21
|
+
@created ||= resources_to_add.pluck(primary_key.to_sym)
|
22
|
+
end
|
23
|
+
|
24
|
+
def ids_added_already_query
|
25
|
+
workplace
|
26
|
+
.workplace_links
|
27
|
+
.where(resource_type: model_class.name, resource_id: query_with_selected_ids)
|
28
|
+
end
|
29
|
+
|
30
|
+
def ids_added_already
|
31
|
+
WorkerPlugins::SelectColumnWithTypeCast.execute!(
|
32
|
+
column_name_to_select: :resource_id,
|
33
|
+
column_to_compare_with: model_class.column_for_attribute(:id),
|
34
|
+
query: ids_added_already_query
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
def model_class
|
39
|
+
@model_class ||= query.klass
|
40
|
+
end
|
41
|
+
|
42
|
+
def primary_key
|
43
|
+
@primary_key ||= resources_to_add.klass.primary_key
|
44
|
+
end
|
45
|
+
|
46
|
+
def query_with_selected_ids
|
47
|
+
WorkerPlugins::SelectColumnWithTypeCast.execute!(
|
48
|
+
column_name_to_select: :id,
|
49
|
+
column_to_compare_with: WorkerPlugins::WorkplaceLink.column_for_attribute(:resource_id),
|
50
|
+
query: query
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
def resources_to_add
|
55
|
+
@resources_to_add ||= query
|
56
|
+
.distinct
|
57
|
+
.where
|
58
|
+
.not(id: ids_added_already)
|
59
|
+
end
|
60
|
+
|
61
|
+
def select_sql
|
62
|
+
@select_sql ||= resources_to_add
|
63
|
+
.select("
|
64
|
+
#{db_now_value},
|
65
|
+
#{quote(resources_to_add.klass.name)},
|
66
|
+
#{quote_table(resources_to_add.klass.table_name)}.#{quote_column(primary_key)},
|
67
|
+
#{db_now_value},
|
68
|
+
#{select_workplace_id_sql}
|
69
|
+
")
|
70
|
+
.to_sql
|
71
|
+
end
|
72
|
+
|
73
|
+
def select_workplace_id_sql
|
74
|
+
workplace_id_column = WorkerPlugins::WorkplaceLink.columns.find { |column| column.name == "workplace_id" }
|
75
|
+
|
76
|
+
if workplace_id_column.type == :uuid
|
77
|
+
"CAST(#{quote(workplace.id)} AS UUID)"
|
78
|
+
else
|
79
|
+
quote(workplace.id)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def sql
|
84
|
+
@sql ||= "
|
85
|
+
INSERT INTO
|
86
|
+
worker_plugins_workplace_links
|
87
|
+
|
88
|
+
(
|
89
|
+
created_at,
|
90
|
+
resource_type,
|
91
|
+
resource_id,
|
92
|
+
updated_at,
|
93
|
+
workplace_id
|
94
|
+
)
|
95
|
+
|
96
|
+
#{select_sql}
|
97
|
+
"
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class WorkerPlugins::ApplicationService < ServicePattern::Service
|
2
|
+
def db_now_value
|
3
|
+
@db_now_value ||= begin
|
4
|
+
time_string = Time.zone.now.strftime("%Y-%m-%d %H:%M:%S")
|
5
|
+
|
6
|
+
if postgres?
|
7
|
+
"CAST(#{quote(time_string)} AS TIMESTAMP)"
|
8
|
+
else
|
9
|
+
quote(time_string)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def quote(value)
|
15
|
+
WorkerPlugins::Workplace.connection.quote(value)
|
16
|
+
end
|
17
|
+
|
18
|
+
def quote_column(value)
|
19
|
+
WorkerPlugins::Workplace.connection.quote_column_name(value)
|
20
|
+
end
|
21
|
+
|
22
|
+
def quote_table(value)
|
23
|
+
WorkerPlugins::Workplace.connection.quote_table_name(value)
|
24
|
+
end
|
25
|
+
|
26
|
+
def postgres?
|
27
|
+
ActiveRecord::Base.connection.instance_values["config"][:adapter].downcase.include?("postgres")
|
28
|
+
end
|
29
|
+
|
30
|
+
def sqlite?
|
31
|
+
ActiveRecord::Base.connection.instance_values["config"][:adapter].downcase.include?("sqlite")
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class WorkerPlugins::QueryLinksStatus < WorkerPlugins::ApplicationService
|
2
|
+
arguments :query, :workplace
|
3
|
+
|
4
|
+
def perform
|
5
|
+
checked_count = workplace
|
6
|
+
.workplace_links
|
7
|
+
.where(resource_id: query.distinct.select(query.klass.primary_key))
|
8
|
+
.count
|
9
|
+
|
10
|
+
query_count = query.count
|
11
|
+
|
12
|
+
succeed!(
|
13
|
+
all_checked: query_count == checked_count,
|
14
|
+
checked_count: checked_count,
|
15
|
+
query_count: query_count,
|
16
|
+
some_checked: checked_count.positive? && checked_count < query_count
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
class WorkerPlugins::RemoveQuery < WorkerPlugins::ApplicationService
|
2
|
+
arguments :query, :workplace
|
3
|
+
|
4
|
+
attr_reader :destroyed
|
5
|
+
|
6
|
+
def perform
|
7
|
+
remove_query_from_workplace
|
8
|
+
succeed!(destroyed: destroyed, mode: :destroyed)
|
9
|
+
end
|
10
|
+
|
11
|
+
def remove_query_from_workplace
|
12
|
+
links_query = workplace.workplace_links.where(resource_type: model_class.name, resource_id: query_with_selected_ids)
|
13
|
+
@destroyed = links_query.pluck(:resource_id)
|
14
|
+
links_query.delete_all
|
15
|
+
end
|
16
|
+
|
17
|
+
def model_class
|
18
|
+
query.klass
|
19
|
+
end
|
20
|
+
|
21
|
+
def query_with_selected_ids
|
22
|
+
WorkerPlugins::SelectColumnWithTypeCast.execute!(
|
23
|
+
column_name_to_select: :id,
|
24
|
+
column_to_compare_with: WorkerPlugins::WorkplaceLink.column_for_attribute(:resource_id),
|
25
|
+
query: query.except(:order)
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
class WorkerPlugins::SelectColumnWithTypeCast < WorkerPlugins::ApplicationService
|
2
|
+
arguments :column_name_to_select, :column_to_compare_with, :query
|
3
|
+
|
4
|
+
def perform
|
5
|
+
return succeed! query.select(column_name_to_select) if same_type?
|
6
|
+
|
7
|
+
if column_to_compare_with.type == :string
|
8
|
+
succeed! query_with_varchar
|
9
|
+
elsif column_to_compare_with.type == :integer
|
10
|
+
succeed! query_with_integer
|
11
|
+
else
|
12
|
+
raise "Cant handle type cast between types: " \
|
13
|
+
"#{model_class.table_name}.#{column_name_to_select} (#{column_to_select.type}) " \
|
14
|
+
"#{column_to_compare_with.name} (#{column_to_compare_with.type})"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def column_to_select
|
19
|
+
@column_to_select ||= model_class.column_for_attribute(column_name_to_select)
|
20
|
+
end
|
21
|
+
|
22
|
+
def model_class
|
23
|
+
@model_class ||= query.klass
|
24
|
+
end
|
25
|
+
|
26
|
+
def query_with_integer
|
27
|
+
query.select("CAST(#{model_class.table_name}.#{column_name_to_select} AS BIGINT)")
|
28
|
+
end
|
29
|
+
|
30
|
+
def query_with_varchar
|
31
|
+
query.select("CAST(#{model_class.table_name}.#{column_name_to_select} AS VARCHAR)")
|
32
|
+
end
|
33
|
+
|
34
|
+
def same_type?
|
35
|
+
column_to_select.type == column_to_compare_with.type
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
class WorkerPlugins::SwitchQuery < WorkerPlugins::ApplicationService
|
2
|
+
arguments :query, :workplace
|
3
|
+
|
4
|
+
def perform
|
5
|
+
if resources_to_add.count.zero?
|
6
|
+
result = WorkerPlugins::RemoveQuery.execute!(query: query, workplace: workplace)
|
7
|
+
succeed!(
|
8
|
+
destroyed: result.fetch(:destroyed),
|
9
|
+
mode: :destroyed
|
10
|
+
)
|
11
|
+
else
|
12
|
+
result = WorkerPlugins::AddQuery.execute!(query: query, workplace: workplace)
|
13
|
+
succeed!(
|
14
|
+
created: result.fetch(:created),
|
15
|
+
mode: :created
|
16
|
+
)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def ids_added_already_query
|
21
|
+
workplace
|
22
|
+
.workplace_links
|
23
|
+
.where(resource_type: model_class.name, resource_id: query_with_selected_ids)
|
24
|
+
end
|
25
|
+
|
26
|
+
def ids_added_already
|
27
|
+
WorkerPlugins::SelectColumnWithTypeCast.execute!(
|
28
|
+
column_name_to_select: :resource_id,
|
29
|
+
column_to_compare_with: model_class.column_for_attribute(:id),
|
30
|
+
query: ids_added_already_query
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
def model_class
|
35
|
+
@model_class ||= query.klass
|
36
|
+
end
|
37
|
+
|
38
|
+
def query_with_selected_ids
|
39
|
+
WorkerPlugins::SelectColumnWithTypeCast.execute!(
|
40
|
+
column_name_to_select: :id,
|
41
|
+
column_to_compare_with: WorkerPlugins::WorkplaceLink.column_for_attribute(:resource_id),
|
42
|
+
query: query
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
def resources_to_add
|
47
|
+
@resources_to_add ||= query.where.not(id: ids_added_already)
|
48
|
+
end
|
49
|
+
end
|
data/config/routes.rb
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
Rails.application.routes.draw do
|
1
|
+
Rails.application.routes.draw do # rubocop:disable Lint/EmptyBlock
|
2
2
|
end
|
@@ -1,13 +1,10 @@
|
|
1
|
-
class CreateWorkerPluginsWorkplaces < ActiveRecord::Migration
|
1
|
+
class CreateWorkerPluginsWorkplaces < ActiveRecord::Migration[5.2]
|
2
2
|
def change
|
3
3
|
create_table :worker_plugins_workplaces do |t|
|
4
|
-
t.string :name
|
5
|
-
t.boolean :active
|
6
|
-
t.belongs_to :user, polymorphic: true
|
4
|
+
t.string :name, null: false
|
5
|
+
t.boolean :active, default: false, index: true, null: false
|
6
|
+
t.belongs_to :user, index: true, polymorphic: true
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
|
10
|
-
add_index :worker_plugins_workplaces, :user_id
|
11
|
-
add_index :worker_plugins_workplaces, :active
|
12
9
|
end
|
13
10
|
end
|
@@ -1,13 +1,23 @@
|
|
1
|
-
class CreateWorkerPluginsWorkplaceLinks < ActiveRecord::Migration
|
1
|
+
class CreateWorkerPluginsWorkplaceLinks < ActiveRecord::Migration[5.2]
|
2
2
|
def change
|
3
3
|
create_table :worker_plugins_workplace_links do |t|
|
4
|
-
t.
|
5
|
-
t.belongs_to :resource, polymorphic: true
|
6
|
-
|
4
|
+
t.references :workplace, index: {name: "index_on_workplace_id"}, null: false
|
5
|
+
t.belongs_to :resource, index: {name: "index_on_resource"}, null: false, polymorphic: true
|
6
|
+
|
7
|
+
if postgres?
|
8
|
+
t.jsonb :custom_data
|
9
|
+
else
|
10
|
+
t.json :custom_data
|
11
|
+
end
|
12
|
+
|
7
13
|
t.timestamps
|
8
14
|
end
|
9
15
|
|
10
|
-
add_index :worker_plugins_workplace_links, :workplace_id
|
11
|
-
|
16
|
+
add_index :worker_plugins_workplace_links, [:workplace_id, :resource_type, :resource_id], unique: true, name: "unique_resource_on_workspace"
|
17
|
+
add_foreign_key :worker_plugins_workplace_links, :worker_plugins_workplaces, column: "workplace_id"
|
18
|
+
end
|
19
|
+
|
20
|
+
def postgres?
|
21
|
+
connection.adapter_name.downcase.include?("postgres")
|
12
22
|
end
|
13
23
|
end
|
data/db/migrate/20200702072306_change_workplace_links_resource_id_to_string_to_support_uuids.rb
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
class ChangeWorkplaceLinksResourceIdToStringToSupportUuids < ActiveRecord::Migration[7.0]
|
2
|
+
def up
|
3
|
+
change_column :worker_plugins_workplace_links, :resource_id, :string
|
4
|
+
end
|
5
|
+
|
6
|
+
def down
|
7
|
+
change_column :worker_plugins_workplace_links, :resource_id, :bigint
|
8
|
+
end
|
9
|
+
end
|
@@ -1,15 +1,9 @@
|
|
1
|
-
module WorkerPlugins
|
2
|
-
class Engine < ::Rails::Engine
|
3
|
-
isolate_namespace WorkerPlugins
|
1
|
+
module WorkerPlugins; end
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
I18n.load_path += Dir[File.join(path, '**', '*.{rb,yml}')]
|
3
|
+
class WorkerPlugins::Engine < Rails::Engine
|
4
|
+
isolate_namespace WorkerPlugins
|
8
5
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
6
|
+
# Add translations to load path.
|
7
|
+
path = File.realpath(File.join(File.dirname(__FILE__), "..", "..", "config", "locales"))
|
8
|
+
I18n.load_path += Dir[File.join(path, "**", "*.{rb,yml}")]
|
15
9
|
end
|
data/lib/worker_plugins.rb
CHANGED
metadata
CHANGED
@@ -1,103 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: worker_plugins
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kasper Johanmsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
12
|
-
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rails
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: 3.2.21
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - "~>"
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: 3.2.21
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: active-record-transactioner
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: sqlite3
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: rspec-rails
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: factory_girl_rails
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ">="
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '0'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ">="
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: awesome_translations
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
11
|
+
date: 2023-05-09 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
97
13
|
description: Rails framework for easily choosing and creating lists of objects and
|
98
14
|
execute plugins against them.
|
99
15
|
email:
|
100
|
-
-
|
16
|
+
- kaspernj@gmail.com
|
101
17
|
executables: []
|
102
18
|
extensions: []
|
103
19
|
extra_rdoc_files: []
|
@@ -107,6 +23,12 @@ files:
|
|
107
23
|
- Rakefile
|
108
24
|
- app/models/worker_plugins/workplace.rb
|
109
25
|
- app/models/worker_plugins/workplace_link.rb
|
26
|
+
- app/services/worker_plugins/add_query.rb
|
27
|
+
- app/services/worker_plugins/application_service.rb
|
28
|
+
- app/services/worker_plugins/query_links_status.rb
|
29
|
+
- app/services/worker_plugins/remove_query.rb
|
30
|
+
- app/services/worker_plugins/select_column_with_type_cast.rb
|
31
|
+
- app/services/worker_plugins/switch_query.rb
|
110
32
|
- config/locales/awesome_translations/models/worker_plugins__workplace/da.yml
|
111
33
|
- config/locales/awesome_translations/models/worker_plugins__workplace/en.yml
|
112
34
|
- config/locales/awesome_translations/models/worker_plugins__workplace_link/da.yml
|
@@ -114,13 +36,16 @@ files:
|
|
114
36
|
- config/routes.rb
|
115
37
|
- db/migrate/20150521114555_create_worker_plugins_workplaces.rb
|
116
38
|
- db/migrate/20150521114659_create_worker_plugins_workplace_links.rb
|
39
|
+
- db/migrate/20200702072306_change_workplace_links_resource_id_to_string_to_support_uuids.rb
|
40
|
+
- db/migrate/20210106190349_change_resource_id_to_string_to_support_uuid.rb
|
117
41
|
- lib/tasks/worker_plugins_tasks.rake
|
118
42
|
- lib/worker_plugins.rb
|
119
43
|
- lib/worker_plugins/engine.rb
|
120
44
|
- lib/worker_plugins/version.rb
|
121
45
|
homepage: https://www.github.com/kaspernj/worker_plugins
|
122
46
|
licenses: []
|
123
|
-
metadata:
|
47
|
+
metadata:
|
48
|
+
rubygems_mfa_required: 'true'
|
124
49
|
post_install_message:
|
125
50
|
rdoc_options: []
|
126
51
|
require_paths:
|
@@ -129,15 +54,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
129
54
|
requirements:
|
130
55
|
- - ">="
|
131
56
|
- !ruby/object:Gem::Version
|
132
|
-
version:
|
57
|
+
version: 2.7.5
|
133
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
134
59
|
requirements:
|
135
60
|
- - ">="
|
136
61
|
- !ruby/object:Gem::Version
|
137
62
|
version: '0'
|
138
63
|
requirements: []
|
139
|
-
|
140
|
-
rubygems_version: 2.4.0
|
64
|
+
rubygems_version: 3.1.6
|
141
65
|
signing_key:
|
142
66
|
specification_version: 4
|
143
67
|
summary: Rails framework for easily choosing and creating lists of objects and execute
|