daemonic 0.1.1 → 0.1.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 +4 -4
- data/README.md +2 -4
- data/features/support/{env.rb → aruba.rb} +0 -0
- data/features/worker.feature +1 -3
- data/lib/daemonic/version.rb +1 -1
- data/lib/daemonic.rb +7 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 08967f54a434d3f2a95afdff4d3012de7e4667f3
|
4
|
+
data.tar.gz: def0f290d179d0e77d20641773febe003faeefe8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8207b32bb5fb5775ce32c3e13beca35c959da25fd3c9ffbb212e43e5ab902303c53ff62c126fe5dc3c9a9f2d1bb596fa451710f7e9fd3f7eff2f7c4a34d689bf
|
7
|
+
data.tar.gz: ccdc7553329447f58460b573c29e585b044acf334ba79a0df553bd05bd9e908c7cd8d877dd660798fcca15bba6de417ce5d54c9190782f04dea06f9fc35f67bc
|
data/README.md
CHANGED
@@ -47,9 +47,7 @@ class FeedWorker
|
|
47
47
|
|
48
48
|
end
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
Daemonic.run(feed_worker)
|
50
|
+
Daemonic.run { FeedWorker.new }
|
53
51
|
```
|
54
52
|
|
55
53
|
Make the file executable:
|
@@ -101,7 +99,7 @@ multi-threaded daemon:
|
|
101
99
|
* Create an executable.
|
102
100
|
* Require daemonic.
|
103
101
|
* Require your own worker.
|
104
|
-
* End the executable with `Daemonic.run
|
102
|
+
* End the executable with `Daemonic.run { my_worker }`.
|
105
103
|
|
106
104
|
You can get help, by running the script you created:
|
107
105
|
|
File without changes
|
data/features/worker.feature
CHANGED
data/lib/daemonic/version.rb
CHANGED
data/lib/daemonic.rb
CHANGED
@@ -14,19 +14,20 @@ Thread.abort_on_exception = true
|
|
14
14
|
|
15
15
|
module Daemonic
|
16
16
|
|
17
|
-
def self.run(
|
17
|
+
def self.run(default_options = {}, &worker_proc)
|
18
18
|
command, options = CLI.new(ARGV, default_options).run
|
19
19
|
case command
|
20
|
-
when :start then start(
|
20
|
+
when :start then start(options, &worker_proc)
|
21
21
|
when :stop then stop(options)
|
22
22
|
when :status then status(options)
|
23
|
-
when :restart then restart(
|
23
|
+
when :restart then restart(options, &worker_proc)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
def self.start(
|
27
|
+
def self.start(options, &worker_proc)
|
28
28
|
daemon = Daemon.new(options)
|
29
29
|
daemon.start do
|
30
|
+
worker = worker_proc.call
|
30
31
|
Producer.new(worker, options).run
|
31
32
|
end
|
32
33
|
end
|
@@ -39,9 +40,10 @@ module Daemonic
|
|
39
40
|
Daemon.new(options).status
|
40
41
|
end
|
41
42
|
|
42
|
-
def self.restart(
|
43
|
+
def self.restart(options, &worker_proc)
|
43
44
|
daemon = Daemon.new(options.merge(daemonize: true))
|
44
45
|
daemon.restart do
|
46
|
+
worker = worker_proc.call
|
45
47
|
Producer.new(worker, options).run
|
46
48
|
end
|
47
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daemonic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- iain
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -96,7 +96,7 @@ files:
|
|
96
96
|
- daemonic.gemspec
|
97
97
|
- examples/init-d.sh
|
98
98
|
- examples/rss
|
99
|
-
- features/support/
|
99
|
+
- features/support/aruba.rb
|
100
100
|
- features/worker.feature
|
101
101
|
- lib/daemonic.rb
|
102
102
|
- lib/daemonic/cli.rb
|
@@ -129,6 +129,6 @@ signing_key:
|
|
129
129
|
specification_version: 4
|
130
130
|
summary: Daemonic makes multi-threaded daemons easy.
|
131
131
|
test_files:
|
132
|
-
- features/support/
|
132
|
+
- features/support/aruba.rb
|
133
133
|
- features/worker.feature
|
134
134
|
has_rdoc:
|