libis-workflow-activerecord 0.9.2 → 0.9.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +10 -3
- data/db/config.yml +5 -3
- data/db/migrate/004_create_statuses_table.rb +2 -1
- data/lib/libis/workflow/activerecord.rb +0 -1
- data/lib/libis/workflow/activerecord/version.rb +1 -1
- data/libis-workflow-activerecord.gemspec +1 -1
- data/spec/job_spec.rb +0 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/tasks/camelize_name.rb +1 -1
- metadata +5 -10
- data/lib/libis/workflow/activerecord/worker.rb +0 -20
- data/spec/db_env.sh +0 -5
- data/spec/db_start.sh +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d41bc5ce60d5ec9f3368d4970f1659c1a524119616d3065e1167c60cc17e796
|
4
|
+
data.tar.gz: 33e6a53ad2260ca97924417196d4da388614430e6ce850d7d0b0229055c480ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5cceda837e1f187863dec902a1f7012a23aa6f97ec269261c31257ddd0b4290be778005a91c18f6a102b0824154ca4a01aaf0c50ec01edc9d07b8e91d551ef4
|
7
|
+
data.tar.gz: 5f091dc88445c9892827db5d7db3d3fe471395e59abc5307031725379ac8d775ffc970d85c6875105aa70d428e50834fb61ea676a8aeb0037e9b9fa34b67d811
|
data/Rakefile
CHANGED
@@ -12,10 +12,11 @@ require 'yaml'
|
|
12
12
|
# noinspection RubyResolve
|
13
13
|
require 'logger'
|
14
14
|
require 'active_record'
|
15
|
+
require 'database_cleaner'
|
15
16
|
|
16
|
-
namespace
|
17
|
+
namespace(:db) do
|
17
18
|
def create_database(config)
|
18
|
-
options = {:charset => 'utf8', :collation => '
|
19
|
+
options = {:charset => 'utf8', :collation => 'en_US.UTF-8'}
|
19
20
|
|
20
21
|
create_db = lambda do |cfg|
|
21
22
|
ActiveRecord::Base.establish_connection cfg.merge('database' => nil)
|
@@ -69,10 +70,16 @@ namespace :db do
|
|
69
70
|
ActiveRecord::Base.connection.drop_database @config['database']
|
70
71
|
end
|
71
72
|
|
73
|
+
desc 'Clears the database and reloads the default setup'
|
74
|
+
task :clear => :configure_connection do
|
75
|
+
DatabaseCleaner.strategy = :truncation
|
76
|
+
|
77
|
+
end
|
78
|
+
|
72
79
|
desc 'Migrate the database (options: VERSION=x, VERBOSE=false).'
|
73
80
|
task :migrate => :configure_connection do
|
74
81
|
ActiveRecord::Migration.verbose = true
|
75
|
-
ActiveRecord::
|
82
|
+
ActiveRecord::MigrationContext.new(MIGRATIONS_DIR).migrate(ENV['VERSION'] ? ENV['VERSION'].to_i : nil)
|
76
83
|
end
|
77
84
|
|
78
85
|
desc 'Rolls the schema back to the previous version (specify steps w/ STEP=n).'
|
data/db/config.yml
CHANGED
@@ -1,17 +1,18 @@
|
|
1
1
|
default: &default
|
2
2
|
adapter: postgresql
|
3
3
|
encoding: utf-8
|
4
|
-
database:
|
4
|
+
database: workflow
|
5
5
|
host: localhost
|
6
6
|
port: 5432
|
7
|
-
username:
|
8
|
-
password:
|
7
|
+
username: workflow
|
8
|
+
password: workflow
|
9
9
|
# For details on connection pooling, see Rails configuration guide
|
10
10
|
# http://guides.rubyonrails.org/configuring.html#database-pooling
|
11
11
|
pool: 20
|
12
12
|
|
13
13
|
development:
|
14
14
|
<<: *default
|
15
|
+
database: workflow_dev
|
15
16
|
|
16
17
|
# The specified database role being used to connect to postgres.
|
17
18
|
# To create additional roles in postgres see `$ createuser --help`.
|
@@ -45,6 +46,7 @@ development:
|
|
45
46
|
# Do not set this db to the same as development or production.
|
46
47
|
test:
|
47
48
|
<<: *default
|
49
|
+
database: workflow_test
|
48
50
|
min_messages: warning
|
49
51
|
|
50
52
|
# As with config/secrets.yml, you never want to store sensitive information,
|
@@ -10,10 +10,11 @@ class CreateStatusesTable < ActiveRecord::Migration[5.0]
|
|
10
10
|
t.string :status, limit: 12
|
11
11
|
t.integer :progress
|
12
12
|
t.integer :max
|
13
|
+
t.datetime :created, null: false
|
14
|
+
t.datetime :updated, null: false
|
13
15
|
|
14
16
|
t.references :work_item, foreign_key: {to_table: :work_items, on_delete: :cascade}
|
15
17
|
|
16
|
-
t.timestamps
|
17
18
|
end
|
18
19
|
|
19
20
|
add_index :statuses, [:task, :id]
|
@@ -12,7 +12,6 @@ module Libis
|
|
12
12
|
autoload :WorkItem, 'libis/workflow/activerecord/work_item'
|
13
13
|
autoload :Run, 'libis/workflow/activerecord/run'
|
14
14
|
autoload :Job, 'libis/workflow/activerecord/job'
|
15
|
-
autoload :Worker, 'libis/workflow/activerecord/worker'
|
16
15
|
autoload :Workflow, 'libis/workflow/activerecord/workflow'
|
17
16
|
autoload :Status, 'libis/workflow/activerecord/status'
|
18
17
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Libis
|
2
2
|
module Workflow
|
3
3
|
module ActiveRecord
|
4
|
-
VERSION = '0.9.
|
4
|
+
VERSION = '0.9.5' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
|
5
5
|
end
|
6
6
|
end
|
7
7
|
end
|
@@ -30,7 +30,7 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.require_paths = ['lib']
|
31
31
|
|
32
32
|
spec.add_runtime_dependency 'libis-workflow', '~> 2.0'
|
33
|
-
spec.add_runtime_dependency 'activerecord', '~> 5'
|
33
|
+
spec.add_runtime_dependency 'activerecord', '~> 5.2'
|
34
34
|
|
35
35
|
spec.add_development_dependency 'bundler', '~> 1.6'
|
36
36
|
spec.add_development_dependency 'rake'
|
data/spec/job_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/tasks/camelize_name.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: libis-workflow-activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kris Dekeyser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: libis-workflow
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '5'
|
33
|
+
version: '5.2'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '5'
|
40
|
+
version: '5.2'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -183,11 +183,8 @@ files:
|
|
183
183
|
- lib/libis/workflow/activerecord/status.rb
|
184
184
|
- lib/libis/workflow/activerecord/version.rb
|
185
185
|
- lib/libis/workflow/activerecord/work_item.rb
|
186
|
-
- lib/libis/workflow/activerecord/worker.rb
|
187
186
|
- lib/libis/workflow/activerecord/workflow.rb
|
188
187
|
- libis-workflow-activerecord.gemspec
|
189
|
-
- spec/db_env.sh
|
190
|
-
- spec/db_start.sh
|
191
188
|
- spec/items.rb
|
192
189
|
- spec/items/test_dir_item.rb
|
193
190
|
- spec/items/test_file_item.rb
|
@@ -224,13 +221,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
224
221
|
version: '0'
|
225
222
|
requirements: []
|
226
223
|
rubyforge_project:
|
227
|
-
rubygems_version: 2.7.
|
224
|
+
rubygems_version: 2.7.8
|
228
225
|
signing_key:
|
229
226
|
specification_version: 4
|
230
227
|
summary: ActiveRecord persistence for the LIBIS Workflow framework.
|
231
228
|
test_files:
|
232
|
-
- spec/db_env.sh
|
233
|
-
- spec/db_start.sh
|
234
229
|
- spec/items.rb
|
235
230
|
- spec/items/test_dir_item.rb
|
236
231
|
- spec/items/test_file_item.rb
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'libis/workflow/worker'
|
2
|
-
require 'sidekiq'
|
3
|
-
|
4
|
-
module Libis
|
5
|
-
module Workflow
|
6
|
-
module ActiveRecord
|
7
|
-
|
8
|
-
class Worker < Libis::Workflow::Worker
|
9
|
-
|
10
|
-
def get_job(job_config)
|
11
|
-
job_name = job_config.delete(:name)
|
12
|
-
job = ::Libis::Workflow::ActiveRecord::Job.find(name: job_name).first
|
13
|
-
raise RuntimeError.new "Workflow #{job_name} not found" unless job.is_a? ::Libis::Workflow::ActiveRecord::Job
|
14
|
-
job
|
15
|
-
end
|
16
|
-
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
data/spec/db_env.sh
DELETED