libis-workflow 2.0.beta.18 → 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: ab1fb2a05e34660de16b7d6f5e5a63ab6e82010e
4
- data.tar.gz: 9cb25d10d768ae11a0c819706c86a3bb2b5563f8
3
+ metadata.gz: 2e5a0e42c41ae73d9a6b852917818dc9cebd97ef
4
+ data.tar.gz: e4fb088019e7d60aad2b6b28323b2a5c777dbe64
5
5
  SHA512:
6
- metadata.gz: 296a6a7ee5c10280d419a444b1fe09fa80d843c293f0ed68fc27ac40b9d6a5e23bc5167b64f46a687e33a28c9b42edbba5ed2a40ce18b17558b8a90cdbfc3582
7
- data.tar.gz: d1caeafd347a546ea67f1e25017aea1077d8b8b9b9f52400624e29c584ebed6143c813f7930f095794c87434badb540c80fe6e3f7dd9531dc58f0bbbb62f2eab
6
+ metadata.gz: bfa5b177b528c9c5e8a33e9087b2698c9f1b7a3a54c986ebb4fe00150eb700fe694055239678cd5d50d8a696e555a215ad8028a30db0bc708495684e1b48a3ac
7
+ data.tar.gz: 68f3312f5d681a3730bff41ec4e995408b986ec58a62f62ebd53d3c11882585dfe83e497d16e2f9702aff2719c70358bc7ee54bc996143d8a97d13e7c4cdf14d
@@ -110,15 +110,21 @@ module Libis
110
110
  end
111
111
 
112
112
  # Iterates over the work item clients and invokes code on each of them.
113
- def each
114
- self.items.each { |item| yield item }
113
+ def each(&block)
114
+ self.items.each(&block)
115
115
  end
116
116
 
117
+ def size
118
+ self.items.size
119
+ end
120
+
121
+ alias_method :count, :size
122
+
117
123
  # Add a child work item
118
124
  #
119
125
  # @param [WorkItem] item to be added to the child list :items
120
126
  def add_item(item)
121
- return self unless item and item.is_a? Libis::Workflow::Base::WorkItem
127
+ return self unless item and item.is_a?(Libis::Workflow::Base::WorkItem)
122
128
  self.items << item
123
129
  item.parent = self
124
130
  self.save!
@@ -128,14 +134,6 @@ module Libis
128
134
 
129
135
  alias_method :<<, :add_item
130
136
 
131
- def get_items
132
- self.items.dup
133
- end
134
-
135
- def item_count
136
- self.items.size
137
- end
138
-
139
137
  # Return item's parent
140
138
  # @return [Libis::Workflow::Base::WorkItem]
141
139
  def get_parent
@@ -158,16 +158,18 @@ module Libis
158
158
 
159
159
  def run_subitems(parent_item)
160
160
  return unless check_processing_subitems
161
- return unless parent_item.count > 0
161
+
162
+ items = subitems(parent_item)
163
+ return unless items.size > 0
162
164
 
163
165
  status = Hash.new(0)
164
- subitems(parent_item).each_with_index do |item, i|
165
- debug 'Processing subitem (%d/%d): %s', parent_item, i+1, parent_item.count, item.to_s
166
+ items.each_with_index do |item, i|
167
+ debug 'Processing subitem (%d/%d): %s', parent_item, i+1, items.size, item.to_s
166
168
  run_item item
167
169
  status[item.status(self.namepath)] += 1
168
170
  end
169
171
 
170
- debug '%d of %d subitems passed', parent_item, status[:DONE], parent_item.count
172
+ debug '%d of %d subitems passed', parent_item, status[:DONE], items.size
171
173
  substatus_check(status, parent_item, 'item')
172
174
  end
173
175
 
@@ -267,7 +269,7 @@ module Libis
267
269
  end
268
270
 
269
271
  def subitems(item = nil)
270
- (item || self.workitem).get_items
272
+ (item || self.workitem).items
271
273
  end
272
274
 
273
275
  def default_values
@@ -32,11 +32,11 @@ module Libis
32
32
  return unless check_processing_subtasks
33
33
 
34
34
  tasks = subtasks
35
- return unless tasks.count > 0
35
+ return unless tasks.size > 0
36
36
 
37
37
  status = Hash.new(0)
38
38
  tasks.each_with_index do |task, i|
39
- debug 'Running subtask (%d/%d): %s', item, i+1, tasks.count, task.name
39
+ debug 'Running subtask (%d/%d): %s', item, i+1, tasks.size, task.name
40
40
  task.run item
41
41
  status[item.status(task.namepath)] += 1
42
42
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Libis
4
4
  module Workflow
5
- VERSION = '2.0.beta.18' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
5
+ VERSION = '2.0.beta.20' unless const_defined? :VERSION # the guard is against a redefinition warning that happens on Travis
6
6
  end
7
7
  end
@@ -5,32 +5,34 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
 
6
6
  require 'libis/workflow/version'
7
7
 
8
- Gem::Specification.new do |gem|
9
- gem.name = 'libis-workflow'
10
- gem.version = ::Libis::Workflow::VERSION
11
- gem.date = Date.today.to_s
8
+ Gem::Specification.new do |spec|
9
+ spec.name = 'libis-workflow'
10
+ spec.version = ::Libis::Workflow::VERSION
11
+ spec.date = Date.today.to_s
12
12
 
13
- gem.summary = %q{LIBIS Workflow framework.}
14
- gem.description = %q{A simple framework to build custom task/workflow solutions.}
13
+ spec.summary = %q{LIBIS Workflow framework.}
14
+ spec.description = %q{A simple framework to build custom task/workflow solutions.}
15
15
 
16
- gem.author = 'Kris Dekeyser'
17
- gem.email = 'kris.dekeyser@libis.be'
18
- gem.homepage = 'https://github.com/Kris-LIBIS/workflow'
19
- gem.license = 'MIT'
16
+ spec.author = 'Kris Dekeyser'
17
+ spec.email = 'kris.dekeyser@libis.be'
18
+ spec.homepage = 'https://github.com/Kris-LIBIS/workflow'
19
+ spec.license = 'MIT'
20
20
 
21
- gem.files = `git ls-files -z`.split("\x0")
22
- gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
23
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
21
+ spec.platform = Gem::Platform::JAVA if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
24
22
 
25
- gem.require_paths = ['lib']
23
+ spec.files = `git ls-files -z`.split("\x0")
24
+ spec.executables = spec.files.grep(%r{^bin/}).map { |f| File.basename(f) }
25
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
26
26
 
27
- gem.add_development_dependency 'bundler', '~> 1.6'
28
- gem.add_development_dependency 'rake', '~> 10.3'
29
- gem.add_development_dependency 'rspec', '~> 3.1'
30
- gem.add_development_dependency 'simplecov', '~> 0.9'
31
- gem.add_development_dependency 'coveralls', '~> 0.7'
27
+ spec.require_paths = ['lib']
32
28
 
33
- gem.add_runtime_dependency 'libis-tools', '~> 0.9'
34
- gem.add_runtime_dependency 'sidekiq', '~> 3.3'
29
+ spec.add_development_dependency 'bundler', '~> 1.6'
30
+ spec.add_development_dependency 'rake', '~> 10.3'
31
+ spec.add_development_dependency 'rspec', '~> 3.1'
32
+ spec.add_development_dependency 'simplecov', '~> 0.9'
33
+ spec.add_development_dependency 'coveralls', '~> 0.7'
34
+
35
+ spec.add_runtime_dependency 'libis-tools', '~> 0.9'
36
+ spec.add_runtime_dependency 'sidekiq', '~> 3.3'
35
37
 
36
38
  end
@@ -63,9 +63,11 @@ describe 'TestWorkflow' do
63
63
  it 'should camelize the workitem name' do
64
64
  run = job.execute
65
65
  expect(run.options['CollectFiles'][:location]).to eq dirname
66
- expect(run.items.count).to eq 1
66
+ expect(run.size).to eq 1
67
+ expect(run.items.size).to eq 1
67
68
  expect(run.items.first.class).to eq TestDirItem
68
- expect(run.items.first.count).to eq 3
69
+ expect(run.items.first.size).to eq 3
70
+ expect(run.items.first.items.size).to eq 3
69
71
  expect(run.items.first.first.class).to eq TestFileItem
70
72
 
71
73
  expect(run.items.first.name).to eq 'Items'
@@ -104,16 +106,16 @@ STR
104
106
  run = job.execute
105
107
  output = logoutput.string.lines.to_a
106
108
 
107
- expect(output.count).to eq sample_out.count
109
+ expect(output.size).to eq sample_out.size
108
110
  output.each_with_index do |o, i|
109
111
  expect(o[/(?<=\] ).*/]).to eq sample_out[i].strip
110
112
  end
111
113
 
112
114
  expect(run.summary['DEBUG']).to eq 20
113
- expect(run.log_history.count).to eq 8
114
- expect(run.status_log.count).to eq 8
115
- expect(run.items.first.log_history.count).to eq 12
116
- expect(run.items.first.status_log.count).to eq 6
115
+ expect(run.log_history.size).to eq 8
116
+ expect(run.status_log.size).to eq 8
117
+ expect(run.items.first.log_history.size).to eq 12
118
+ expect(run.items.first.status_log.size).to eq 6
117
119
 
118
120
  [
119
121
  {task: 'CollectFiles', status: :STARTED},
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libis-workflow
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.beta.18
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: 2015-12-11 00:00:00.000000000 Z
11
+ date: 2015-12-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler