kryten 0.3.1 → 0.3.2

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: 34b08a58638b72baeb0299500f0c86a92f4848af
4
- data.tar.gz: eb1bd8aef5e1e69f6b888d68865cf608c0164c5a
3
+ metadata.gz: 041e7f2031ca1cbce58860c7c32dd071043a659c
4
+ data.tar.gz: 2f033e5a142a444fa4dbea7397afde548cc6c03b
5
5
  SHA512:
6
- metadata.gz: 222cff335de37f973338a524bea9a98d3cbf6dbae0f8c688716ea160498448994a65a1aa54a53c9c788e8c6a331c3239e7d94df2d920f24d8926b3cc02e76245
7
- data.tar.gz: 426146455eee2fbc99c7c76d155b702a2027bc4499d5ec0c9cc645a042bfb6152ff73d56ddf21cc72553c97beb701cf8893bd6efade197084d067c3db699d8c3
6
+ metadata.gz: 775b1c27de3eb3c17fc38ab0f0ce78c589f87f4e8e5bd4ab0ccdc90e3e19757ad6301ac9e1f29dee29cdecfc409f07b0a814de85dca74006f4249a63bf9d803f
7
+ data.tar.gz: 9b9abaef21f0833e613fcbb3d656386c8a65ed5cd5ac6338097a4fd54854d6f81a4757c94f0494c04c8c36cf51166e3b565dc405d61e88991c601807329b607d
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Kryten
2
2
 
3
3
  Kryten Series 4000 Mechanoid is a modular task runner written in Ruby.
4
+ It's meant to run simple recurring tasks in the background using threads or daemons.
4
5
 
5
6
  ## Installation
6
7
 
@@ -25,7 +26,9 @@ Or install it yourself as:
25
26
  require 'kryten'
26
27
  include Kryten
27
28
 
28
- # define work to be done in a class with a run method
29
+ # Define work to be done in a class with a run method.
30
+ # This method will be run at an interval defined by the timer method.
31
+ # Execution happens in the background based on the type of task included.
29
32
 
30
33
  class Work
31
34
  include ThreadedTask
@@ -36,15 +39,31 @@ Or install it yourself as:
36
39
 
37
40
  end
38
41
 
39
- # The worker can run on it's own and responds to the interrupt signal.
42
+ # The worker can run on it's own and responds to interrupt signals.
40
43
  Work.new.start # loop run method in foreground
41
44
  Work.new.start_worker # loop run method in a thread
42
45
 
43
- # Two or more workers can be managed by the Supervisor
44
- tasks = []
45
- tasks << FirstTask.new
46
- tasks << SecondTask.new
47
- Supervisor.start(tasks)
46
+ # A worker can have any number of child workers
47
+ class WorkList
48
+ include ThreadedTask
49
+ end
50
+
51
+ WorkList.new('app').workers do
52
+ [Work.new('task1'), Work.new('task2')]
53
+ end
54
+
55
+ # Run the work in separate processes instead of threads
56
+ class WorkList
57
+ include BackgroundTask
58
+ end
59
+
60
+ class Work
61
+ include BackgroundTask
62
+ end
63
+
64
+ WorkList.new('app').workers do
65
+ [Work.new('task1'), Work.new('task2')]
66
+ end
48
67
 
49
68
 
50
69
  ```
data/lib/kryten/lawger.rb CHANGED
@@ -3,6 +3,10 @@ require 'logger'
3
3
  module Kryten::Lawger
4
4
  attr_accessor :logger
5
5
 
6
+ def name
7
+ @name || self.class.to_s.gsub('::','-').downcase
8
+ end
9
+
6
10
  def log_path
7
11
  "log/#{name}.log"
8
12
  end
@@ -1,3 +1,3 @@
1
1
  module Kryten
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kryten
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zsolt Fekete
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-30 00:00:00.000000000 Z
11
+ date: 2016-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler