daemonite 0.5.4 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +8 -5
- data/daemonite.gemspec +1 -1
- data/lib/daemonite.rb +14 -3
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dc0e44a0c6de00925ca5424245b89a85cd8d63c79c93d84892ae39d69b326373
|
4
|
+
data.tar.gz: af45d64c6a065187ef9dc55e3cd025fb56f3b32727f355485253261071d553bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62ec081eac7a40da7a5870e657e5b8f9257e145339d1b59fbf287c3e0d7c44de0bb7e86e4324fffeac858ac498824c6a974f37bb88b1a43fba92fd422c0201d7
|
7
|
+
data.tar.gz: 11696919c2c13ed8efdc6b297600224ba84a1f0e5a91def24936c3d495c195583e3f44e1ccc8237382cf9776d15005ad92891122d272ca81dcb9b8e154154e52
|
data/Rakefile
CHANGED
@@ -1,19 +1,22 @@
|
|
1
1
|
require 'rake'
|
2
2
|
require 'rubygems/package_task'
|
3
|
-
require '
|
3
|
+
require 'fileutils'
|
4
4
|
|
5
5
|
spec = eval(File.read('daemonite.gemspec'))
|
6
6
|
Gem::PackageTask.new(spec) do |pkg|
|
7
7
|
pkg.need_zip = true
|
8
8
|
pkg.need_tar = true
|
9
|
-
|
10
|
-
|
9
|
+
FileUtils.mkdir 'pkg' rescue nil
|
10
|
+
FileUtils.rm_rf Dir.glob('pkg/*')
|
11
|
+
FileUtils.ln_sf "#{pkg.name}.gem", "pkg/#{spec.name}.gem"
|
11
12
|
end
|
12
13
|
|
14
|
+
task :default => :gem
|
15
|
+
|
13
16
|
task :push => :gem do |r|
|
14
|
-
`gem push pkg
|
17
|
+
`gem push pkg/#{spec.name}.gem`
|
15
18
|
end
|
16
19
|
|
17
20
|
task :install => :gem do |r|
|
18
|
-
`gem install pkg
|
21
|
+
`gem install pkg/#{spec.name}.gem`
|
19
22
|
end
|
data/daemonite.gemspec
CHANGED
data/lib/daemonite.rb
CHANGED
@@ -33,7 +33,8 @@ module Daemonism
|
|
33
33
|
:runtime_proc => nil,
|
34
34
|
:cmdl_info => nil,
|
35
35
|
:cmdl_parsing => true,
|
36
|
-
:cmdl_operation => 'start'
|
36
|
+
:cmdl_operation => 'start',
|
37
|
+
:kill_amount => 1000
|
37
38
|
}
|
38
39
|
|
39
40
|
def daemonism(opts={},&block)
|
@@ -128,8 +129,15 @@ module Daemonism
|
|
128
129
|
else
|
129
130
|
puts "Server #{opts[:cmdl_info].nil? ? '' : '(' + opts[:cmdl_info].to_s + ') '}stopped"
|
130
131
|
puts "Waiting while server goes down ..."
|
132
|
+
count = 0
|
131
133
|
while status.call
|
132
|
-
|
134
|
+
if count > opts[:kill_amount]
|
135
|
+
Process.kill "SIGKILL", pid
|
136
|
+
File.unlink(opts[:basepath] + '/' + opts[:pidfile])
|
137
|
+
else
|
138
|
+
Process.kill "SIGTERM", pid
|
139
|
+
end
|
140
|
+
count += 1
|
133
141
|
sleep 0.3
|
134
142
|
end
|
135
143
|
end
|
@@ -147,7 +155,7 @@ module Daemonism
|
|
147
155
|
@@daemonism_restart = true
|
148
156
|
|
149
157
|
retain = $stdout.dup
|
150
|
-
Process.daemon
|
158
|
+
Process.daemon unless opts[:verbose]
|
151
159
|
retain.puts "Server #{opts[:cmdl_info].nil? ? '' : '(' + opts[:cmdl_info].to_s + ') '}started as PID:#{Process.pid}"
|
152
160
|
File.write(opts[:basepath] + '/' + opts[:pidfile],Process.pid) # after daemon, so that we get the forked pid
|
153
161
|
Dir.chdir(opts[:basepath])
|
@@ -174,6 +182,9 @@ module Daemonism
|
|
174
182
|
def on_startup(&blk)
|
175
183
|
on :startup, &blk
|
176
184
|
end
|
185
|
+
def use(blk)
|
186
|
+
instance_eval(&blk)
|
187
|
+
end
|
177
188
|
alias_method :at, :on
|
178
189
|
alias_method :at_exit, :on_exit
|
179
190
|
alias_method :at_startup, :on_startup
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daemonite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juergen eTM Mangler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Daemonite - Process.daemon and argparse wrapper for loopies.
|
14
14
|
email: juergen.mangler@gmail.com
|
@@ -44,8 +44,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
44
44
|
- !ruby/object:Gem::Version
|
45
45
|
version: '0'
|
46
46
|
requirements: []
|
47
|
-
|
48
|
-
rubygems_version: 2.7.6.2
|
47
|
+
rubygems_version: 3.1.2
|
49
48
|
signing_key:
|
50
49
|
specification_version: 4
|
51
50
|
summary: Daemonite - Process.daemon and argparse wrapper for loopies.
|