foreverb 0.3.2 → 0.3.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +6 -2
- data/examples/simple +23 -4
- data/lib/forever/base.rb +8 -6
- data/lib/forever/version.rb +1 -1
- metadata +58 -77
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 2a361c0d899e49b17693a7954d7d423620c9c5f5
|
4
|
+
data.tar.gz: e51935d312e893593aba2a2cd909dbfb62ba6fa6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 87e3dc3b2ae173f9de0f5dc9e422f8bf5d70b57eaf13ed343a2dbc62dc76a91d66f0cc626972561111a2b4b23d4623dabb6d91be9e222a71555c625ec58dbad2
|
7
|
+
data.tar.gz: 14449be3057cd8441faf513aac1777b65e900c3598f451ecba1e12cbcd5109586214a862c498c5724281c5909b3158b3fb496a6966e56729ae24a9bac567eeb1
|
data/README.md
CHANGED
@@ -417,20 +417,24 @@ esac
|
|
417
417
|
|
418
418
|
You'll have to create one script per each user foreverb runs on.
|
419
419
|
After creating the file, make it executable:
|
420
|
-
|
421
|
-
|
420
|
+
|
421
|
+
chmod +x /etc/init.d/foreverb-username
|
422
|
+
|
422
423
|
and add it to the system's boot:
|
423
424
|
|
424
425
|
* RedHat:
|
425
426
|
```sudo /sbin/chkconfig --level 345 foreverb-username on
|
426
427
|
```
|
428
|
+
|
427
429
|
* Debian/Ubuntu:
|
428
430
|
```sudo /usr/sbin/update-rc.d -f foreverb-username defaults
|
429
431
|
```
|
432
|
+
|
430
433
|
* Gentoo:
|
431
434
|
```sudo rc-update add foreverb-username default
|
432
435
|
```
|
433
436
|
|
437
|
+
|
434
438
|
## Extras
|
435
439
|
|
436
440
|
To see a most comprensive app running _foreverb_ + _growl_ see [githubwatcher gem](https://github.com/daddye/githubwatcher)
|
data/examples/simple
CHANGED
@@ -3,18 +3,27 @@ require 'rubygems' unless defined?(Gem)
|
|
3
3
|
require 'bundler/setup'
|
4
4
|
require 'forever'
|
5
5
|
|
6
|
-
Forever.run :fork => ENV['FORK'] do
|
6
|
+
Forever.run :fork => !!ENV['FORK'] do
|
7
7
|
dir File.expand_path('../', __FILE__) # Default is ../../__FILE__
|
8
|
-
|
8
|
+
log File.join(dir, "#{name}.log")
|
9
|
+
pid File.join(dir, "#{name}.pid")
|
9
10
|
|
10
|
-
before :
|
11
|
+
before :all do
|
11
12
|
puts 'before all'
|
12
13
|
end
|
13
14
|
|
14
|
-
|
15
|
+
before :each do
|
16
|
+
puts 'before each'
|
17
|
+
end
|
18
|
+
|
19
|
+
after :all do
|
15
20
|
puts 'after all'
|
16
21
|
end
|
17
22
|
|
23
|
+
after :each do
|
24
|
+
puts 'after each'
|
25
|
+
end
|
26
|
+
|
18
27
|
every 1.seconds do
|
19
28
|
puts 'wait me 10 seconds'
|
20
29
|
sleep 10
|
@@ -24,10 +33,20 @@ Forever.run :fork => ENV['FORK'] do
|
|
24
33
|
puts 'every 2 seconds'
|
25
34
|
end
|
26
35
|
|
36
|
+
every 10.seconds do
|
37
|
+
raise 'Arg....'
|
38
|
+
end
|
39
|
+
|
27
40
|
on_ready do
|
28
41
|
puts "All jobs will will wait me for 1 second"; sleep 1
|
29
42
|
end
|
30
43
|
|
44
|
+
on_error do |e|
|
45
|
+
puts '-' * 30
|
46
|
+
puts e
|
47
|
+
puts '-' * 30
|
48
|
+
end
|
49
|
+
|
31
50
|
on_exit do
|
32
51
|
puts "Bye bye"
|
33
52
|
end
|
data/lib/forever/base.rb
CHANGED
@@ -27,7 +27,7 @@ module Forever
|
|
27
27
|
exit
|
28
28
|
when 'start', 'restart', 'up', nil
|
29
29
|
stop
|
30
|
-
when 'run'
|
30
|
+
when 'run', 'live'
|
31
31
|
detach = false
|
32
32
|
stop
|
33
33
|
when 'stop'
|
@@ -50,6 +50,7 @@ module Forever
|
|
50
50
|
Commands:
|
51
51
|
|
52
52
|
start stop (if present) the daemon and perform a start
|
53
|
+
live run in no-deamon mode
|
53
54
|
stop stop the daemon if a during when it is idle
|
54
55
|
restart same as start
|
55
56
|
kill force stop by sending a KILL signal to the process
|
@@ -73,7 +74,7 @@ module Forever
|
|
73
74
|
print "[\e[90m%s\e[0m] Process %s with pid \e[1m%d\e[0m with \e[1m%s\e[0m and Forever v.%s\n" %
|
74
75
|
[name, detach != false ? :daemonized : :running, Process.pid, forking ? :fork : :thread, Forever::VERSION]
|
75
76
|
|
76
|
-
%w(INT TERM
|
77
|
+
%w(INT TERM).each { |signal| trap(signal) { stop! } }
|
77
78
|
trap(:HUP) do
|
78
79
|
IO.open(1, 'w'){ |s| s.puts config }
|
79
80
|
end
|
@@ -108,7 +109,7 @@ module Forever
|
|
108
109
|
if forking
|
109
110
|
begin
|
110
111
|
GC.start
|
111
|
-
pids << fork { job_call(job) }
|
112
|
+
pids << Process.detach(fork { job_call(job) })
|
112
113
|
rescue Errno::EAGAIN
|
113
114
|
puts "\n\nWait all processes since os cannot create a new one\n\n"
|
114
115
|
Process.waitall
|
@@ -120,7 +121,7 @@ module Forever
|
|
120
121
|
end
|
121
122
|
|
122
123
|
# Detach zombies, our ps will be happier
|
123
|
-
pids.delete_if { |p|
|
124
|
+
pids.delete_if { |p| p.stop? }
|
124
125
|
|
125
126
|
sleep 0.5
|
126
127
|
end
|
@@ -332,7 +333,8 @@ module Forever
|
|
332
333
|
end
|
333
334
|
alias :inspect :to_s
|
334
335
|
|
335
|
-
|
336
|
+
private
|
337
|
+
|
336
338
|
def filters
|
337
339
|
@_filters ||= {
|
338
340
|
:before => { :each => [], :all => [] },
|
@@ -351,7 +353,7 @@ module Forever
|
|
351
353
|
yield
|
352
354
|
end
|
353
355
|
end
|
354
|
-
|
356
|
+
|
355
357
|
def write_config!
|
356
358
|
config_was = File.exist?(FOREVER_PATH) ? YAML.load_file(FOREVER_PATH) : []
|
357
359
|
config_was.delete_if { |conf| conf.nil? || conf.empty? || conf[:file] == file }
|
data/lib/forever/version.rb
CHANGED
metadata
CHANGED
@@ -1,77 +1,67 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreverb
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 3
|
9
|
-
- 2
|
10
|
-
version: 0.3.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.3.3
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- DAddYE
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
- !ruby/object:Gem::Dependency
|
11
|
+
date: 2015-01-26 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
21
14
|
name: thor
|
22
|
-
|
23
|
-
|
24
|
-
none: false
|
25
|
-
requirements:
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
26
17
|
- - ">="
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 35
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 15
|
32
|
-
- 0
|
18
|
+
- !ruby/object:Gem::Version
|
33
19
|
version: 0.15.0
|
34
20
|
type: :runtime
|
35
|
-
version_requirements: *id001
|
36
|
-
- !ruby/object:Gem::Dependency
|
37
|
-
name: minitest
|
38
21
|
prerelease: false
|
39
|
-
|
40
|
-
|
41
|
-
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.15.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: minitest
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
42
31
|
- - ">="
|
43
|
-
- !ruby/object:Gem::Version
|
44
|
-
|
45
|
-
segments:
|
46
|
-
- 0
|
47
|
-
version: "0"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
48
34
|
type: :development
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: rspec
|
52
35
|
prerelease: false
|
53
|
-
|
54
|
-
|
55
|
-
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
56
45
|
- - ">="
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
|
59
|
-
segments:
|
60
|
-
- 0
|
61
|
-
version: "0"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
62
48
|
type: :development
|
63
|
-
|
64
|
-
|
65
|
-
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Small daemon framework for ruby, with logging, error handler, scheduling
|
56
|
+
and much more.
|
57
|
+
email:
|
66
58
|
- d.dagostino@lipsiasoft.com
|
67
|
-
executables:
|
59
|
+
executables:
|
68
60
|
- foreverb
|
69
61
|
extensions: []
|
70
|
-
|
71
62
|
extra_rdoc_files: []
|
72
|
-
|
73
|
-
|
74
|
-
- .gitignore
|
63
|
+
files:
|
64
|
+
- ".gitignore"
|
75
65
|
- CHANGES.md
|
76
66
|
- Gemfile
|
77
67
|
- README.md
|
@@ -91,38 +81,29 @@ files:
|
|
91
81
|
- spec/spec_helper.rb
|
92
82
|
homepage: https://github.com/daddye/forever
|
93
83
|
licenses: []
|
94
|
-
|
84
|
+
metadata: {}
|
95
85
|
post_install_message:
|
96
86
|
rdoc_options: []
|
97
|
-
|
98
|
-
require_paths:
|
87
|
+
require_paths:
|
99
88
|
- lib
|
100
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
101
|
-
|
102
|
-
requirements:
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
103
91
|
- - ">="
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
version: "0"
|
109
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
-
none: false
|
111
|
-
requirements:
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
112
96
|
- - ">="
|
113
|
-
- !ruby/object:Gem::Version
|
114
|
-
|
115
|
-
segments:
|
116
|
-
- 0
|
117
|
-
version: "0"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
118
99
|
requirements: []
|
119
|
-
|
120
100
|
rubyforge_project: foreverb
|
121
|
-
rubygems_version:
|
101
|
+
rubygems_version: 2.2.2
|
122
102
|
signing_key:
|
123
|
-
specification_version:
|
103
|
+
specification_version: 4
|
124
104
|
summary: Small daemon framework for ruby
|
125
|
-
test_files:
|
105
|
+
test_files:
|
126
106
|
- spec/cli_spec.rb
|
127
107
|
- spec/foreverb_spec.rb
|
128
108
|
- spec/spec_helper.rb
|
109
|
+
has_rdoc:
|