libis-workflow-mongoid 2.0.beta.19 → 2.0.beta.20

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
  SHA1:
3
- metadata.gz: 4007c2617d40f21ef002c8fb826fdd591cd13678
4
- data.tar.gz: 36e3a6f296770d5c025cd02965ab65b4baa2193f
3
+ metadata.gz: 674a0925bea93cd6af396d621e1d2a73a29e2ffb
4
+ data.tar.gz: 8b8037e88db86b2d0c5a43b81418ac146c7f663b
5
5
  SHA512:
6
- metadata.gz: 265c9ee3d043ae9ea96f024098ebb2edfaec73440c19c73225420efa2f403626a377e969760e7bd9049b038689d88711fd3b4e29ed9246f05a02d99b8131664a
7
- data.tar.gz: 2cbc5c0042c75712a9b36bbcb3c8fb69b762f24eaea2011ded5c818dbe24f05637d2d90fd54ba9ac3fd2e888f63411ccb20d4499d61d007a7921c23328401c1a
6
+ metadata.gz: dd4ea904e7d5b87f731b6cb531b0d1a39446fdcba03df3078850f92f768e7925628f8b35e0d5570c3cb33dc46267307e47424ac31771ce55770a5eb4d84f0d29
7
+ data.tar.gz: cfae7c656ae1f5e52a146a8148a7c3b14a7c80de083917affe9bbce848af40cf640dce6115638037d8683b8d58ec261de60e7788acaddcb65dd5479effb5e317
@@ -3,7 +3,7 @@
3
3
  module Libis
4
4
  module Workflow
5
5
  module Mongoid
6
- VERSION = '2.0.beta.19' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
6
+ VERSION = '2.0.beta.20' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
7
7
  end
8
8
  end
9
9
  end
@@ -8,21 +8,6 @@ module Libis
8
8
 
9
9
  module WorkItemBase
10
10
 
11
- class Options
12
- include Libis::Workflow::Mongoid::Dynamic
13
- embedded_in :work_item, class_name: 'Libis::Workflow::Mongoid::WorkItem'
14
- end
15
-
16
- class Properties
17
- include Libis::Workflow::Mongoid::Dynamic
18
- embedded_in :work_item, class_name: 'Libis::Workflow::Mongoid::WorkItem'
19
- end
20
-
21
- class Summary
22
- include Libis::Workflow::Mongoid::Dynamic
23
- embedded_in :work_item, class_name: 'Libis::Workflow::Mongoid::WorkItem'
24
- end
25
-
26
11
  def self.included(klass)
27
12
  klass.class_eval do
28
13
  include Libis::Workflow::Base::WorkItem
@@ -30,9 +15,9 @@ module Libis
30
15
 
31
16
  store_in collection: 'workflow_items'
32
17
 
33
- embeds_one :options, class_name: Libis::Workflow::Mongoid::WorkItemBase::Options.to_s
34
- embeds_one :properties, class_name: Libis::Workflow::Mongoid::WorkItemBase::Properties.to_s
35
- embeds_one :summary, class_name: Libis::Workflow::Mongoid::WorkItemBase::Summary.to_s
18
+ field :options, type: Hash, default: -> { Hash.new }
19
+ field :properties, type: Hash, default: -> { Hash.new }
20
+ field :summary, type: Hash, default: -> { Hash.new }
36
21
 
37
22
  has_many :logs, as: :logger, class_name: Libis::Workflow::Mongoid::LogEntry.to_s,
38
23
  dependent: :destroy, autosave: true, order: :_id.asc do
@@ -55,12 +40,6 @@ module Libis
55
40
  document.logs.each { |log| log.destroy! }
56
41
  end
57
42
 
58
- set_callback(:initialize, :after) do |document|
59
- document.options = {}
60
- document.properties = {}
61
- document.summary = {}
62
- end
63
-
64
43
  end
65
44
  end
66
45
 
@@ -12,7 +12,7 @@ class TestDirItem < TestItem
12
12
  end
13
13
 
14
14
  def name
15
- self.properties[:name] || super
15
+ self.properties['name'] || super
16
16
  end
17
17
 
18
18
  end
@@ -15,15 +15,15 @@ class TestFileItem < TestItem
15
15
  end
16
16
 
17
17
  def name
18
- self.properties[:name] || super
18
+ self.properties['name'] || super
19
19
  end
20
20
 
21
21
  def filesize
22
- properties[:size]
22
+ properties['size']
23
23
  end
24
24
 
25
25
  def fixity_check(checksum)
26
- properties[:checksum] == checksum
26
+ properties['checksum'] == checksum
27
27
  end
28
28
 
29
29
  end
@@ -6,7 +6,7 @@ class CamelizeName < ::Libis::Workflow::Task
6
6
 
7
7
  def process(item)
8
8
  return unless (item.is_a?(TestFileItem) || item.is_a?(TestDirItem))
9
- item.properties[:name] = item.name.camelize
9
+ item.properties['name'] = item.name.camelize
10
10
  item.save!
11
11
  end
12
12
 
@@ -88,7 +88,8 @@ describe 'TestWorkflow' do
88
88
 
89
89
  it 'should camelize the workitem name' do
90
90
 
91
- expect(run.options['CollectFiles'][:location]).to eq dirname
91
+ puts run.options
92
+ expect(run.options['CollectFiles']['location']).to eq dirname
92
93
 
93
94
  expect(run.items.size).to eq 1
94
95
  expect(run.items.count).to eq 1
@@ -110,13 +111,13 @@ describe 'TestWorkflow' do
110
111
 
111
112
  it 'should return expected debug output' do
112
113
 
113
- expect(run.summary[:DEBUG]).to eq 23
114
+ expect(run.summary['DEBUG']).to eq 23
114
115
  expect(run.log_history.count).to eq 8
115
116
  expect(run.status_log.count).to eq 8
116
117
  item = run.items.first
117
118
  expect(item.log_history.count).to eq 15
118
119
  expect(item.status_log.count).to eq 6
119
- expect(item.summary[:DEBUG]).to eq 15
120
+ expect(item.summary['DEBUG']).to eq 15
120
121
 
121
122
  sample_out = <<STR
122
123
  DEBUG -- CollectFiles - TestRun : Processing subitem (1/1): items
@@ -188,8 +189,8 @@ STR
188
189
  item = run.items.first
189
190
  expect(item.nil?).to eq false
190
191
  expect(item.is_a? TestDirItem).to eq true
191
- expect(item.properties[:name]).to eq 'Items'
192
- expect(item.properties[:ingest_failed]).to eq false
192
+ expect(item.properties['name']).to eq 'Items'
193
+ expect(item.properties['ingest_failed']).to eq false
193
194
  end
194
195
 
195
196
  it 'move item in relation' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libis-workflow-mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.beta.19
4
+ version: 2.0.beta.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kris Dekeyser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-05 00:00:00.000000000 Z
11
+ date: 2016-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: libis-workflow