LRH 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/LRH.rb +27 -0
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a71324a2235eb4f95955e0dadc3a0394c13376fc
4
- data.tar.gz: 9e85932019f46a448228e0ed11d15873986ecfe4
3
+ metadata.gz: 04af4321fdfc0897011caf1c6bbf8fdf2d15f378
4
+ data.tar.gz: 136ebcdf88808f80be77061593e9545b538afbde
5
5
  SHA512:
6
- metadata.gz: c6da49af00d64fd6eefa93908818612a45be17c7f5d111191d152ae53f0f8ec1dbc5005ad594ec44eed7d4d76fb16dc488355039306966eef02a8b7148e4d6be
7
- data.tar.gz: a4e91ed5a8ef26d8d4f53da5004c4c29ecc877c5361fccff5dea3bc0f69e2258a24e89d9558022523995478b4f876e921d012b0312db141f1256676b7543d9f1
6
+ metadata.gz: 80eb42e81538871fface1c8709f6ac94e2056f573907d7afa06d065c4af1aef68aeee46c9cc86e71986df0e1e3b54f86bc25774eafa3b64ee217b14e933b9f7b
7
+ data.tar.gz: 9cee1c8be09ad43deb8870bfe2ab4336ad848cbd62ad9374557413e0e191140d94dec5acbc5407b0040d1aa62fca9c91e26eddff5417743ba90b812d29dd976e
data/LRH.rb CHANGED
@@ -21,6 +21,14 @@ class IOAble
21
21
  return get_option(:debug)
22
22
  end
23
23
 
24
+ def job=(job)
25
+ @job = job
26
+ end
27
+
28
+ def halt!
29
+ @job.halt! if @job
30
+ end
31
+
24
32
  def log(obj)
25
33
  msg = nil
26
34
  msg = "Lister: " + obj.to_s if self.is_a? Lister
@@ -210,24 +218,43 @@ class Harvester < IOAble
210
218
  end
211
219
 
212
220
  class Job
221
+ NOT_RUNNING = 0
222
+ RUNNING = 1
223
+ HALTED = 2
224
+
213
225
  def initialize(lister, runner, harvester)
214
226
  @lister = lister
215
227
  @runner = runner
216
228
  @harvester = harvester
229
+
230
+ @lister.job = self
231
+ @runner.job = self
232
+ @harvester.job = self
233
+
234
+ @status = NOT_RUNNING
217
235
  end
218
236
 
219
237
  def run
238
+ @status = RUNNING
220
239
  @lister._list do |target|
221
240
  partial = @runner._run(target)
222
241
  @harvester._harvest(partial)
242
+
243
+ break if @status != RUNNING
223
244
  end
224
245
 
225
246
  @runner._finally do |to_harvest|
226
247
  @harvester._harvest(to_harvest)
227
248
  end
228
249
 
250
+ @status = NOT_RUNNING
251
+
229
252
  return @harvester._result
230
253
  end
254
+
255
+ def halt!
256
+ @status = HALTED
257
+ end
231
258
  end
232
259
 
233
260
  class PartialJob < Job
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: LRH
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simone Scalabrino