daemonite 0.5.0 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +8 -5
  3. data/daemonite.gemspec +1 -1
  4. data/lib/daemonite.rb +13 -10
  5. metadata +3 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a2aefaeee8ed856d896cb663cc2c2d8666f437e948e172d3d4f3bb8f8ac2bad5
4
- data.tar.gz: 18face311c11441c3baa56eb74586bd13a2dc2fce37efd4475b4963121ae8b2f
3
+ metadata.gz: d80e2f0268b9385c864ebe15b2f0f728b2acbb3d4205115722abd3d308b0267d
4
+ data.tar.gz: 5b90f90695c57d08524b5d64d4579f230faa44981abd457e4291ecf806c45629
5
5
  SHA512:
6
- metadata.gz: 481799bb690fec6d0090db1ff7e762ebf00ea65248c9b5a21311058b49b5661eb141c5f6dd930850c8e53d8f3809f668aedbe585702f337d8674061fef6fb009
7
- data.tar.gz: 015b1b64ebe9e4f954275c8e526c9f5de27a1ee52d5c5b965d0284e7bff355a342db2d2dfda9af62070aff3cbec23444efb42ec3771cc8083f9547a36ac8ee57
6
+ metadata.gz: 4a6ad8f8b8847dee5cc599e1effc3c68fd5d595688f55cff5db9488a949acb4a176f14197d615d0cb60bd69b1d8cbf96933744085a511cd4bc0124821fcd53aa
7
+ data.tar.gz: 399d6e45ecbd5055cec2f0ce6ef4a5f6bc9b478938e70523957568a843f4845a2c5d31c65c5ada3a41e92c2e54bad6725e8e766c10312664281a5aef3578c8fc
data/Rakefile CHANGED
@@ -1,19 +1,22 @@
1
1
  require 'rake'
2
2
  require 'rubygems/package_task'
3
- require 'rake/testtask'
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
- `rm pkg/* -rf`
10
- `ln -sf #{pkg.name}.gem pkg/daemonite.gem`
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/daemonite.gem`
17
+ `gem push pkg/#{spec.name}.gem`
15
18
  end
16
19
 
17
20
  task :install => :gem do |r|
18
- `gem install pkg/daemonite.gem`
21
+ `gem install pkg/#{spec.name}.gem`
19
22
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "daemonite"
3
- s.version = "0.5.0"
3
+ s.version = "0.5.5"
4
4
  s.platform = Gem::Platform::RUBY
5
5
  s.license = "LGPL-3.0"
6
6
  s.summary = "Daemonite - Process.daemon and argparse wrapper for loopies."
@@ -66,7 +66,7 @@ module Daemonism
66
66
  opts.merge!(Psych::load_file(opts[:basepath] + '/' + f))
67
67
  end
68
68
  }
69
- opt.on("--help", "-h", "This text.") { puts opt; exit }
69
+ opt.on("--help", "-h", "This text.") { puts opt; ::Kernel::exit }
70
70
  opt.separator(opt.summary_indent + "start|stop|restart|info".ljust(opt.summary_width+1) + "Do operation start, stop, restart or get information.")
71
71
  opts[:runtime_cmds].each do |ro|
72
72
  opt.separator(opt.summary_indent + ro[0].ljust(opt.summary_width+1) + ro[1])
@@ -74,9 +74,9 @@ module Daemonism
74
74
  opt.parse!
75
75
  }
76
76
 
77
- unless (%w{start stop restart} + opts[:runtime_cmds].map{|ro| ro[0] }).include?(ARGV[0])
77
+ unless (%w{start stop restart info} + opts[:runtime_cmds].map{|ro| ro[0] }).include?(ARGV[0])
78
78
  puts ARGV.options
79
- exit!
79
+ ::Kernel::exit
80
80
  end
81
81
  opts[:cmdl_operation] = ARGV[0]
82
82
  end
@@ -98,7 +98,7 @@ module Daemonism
98
98
  unless @@daemonism_restart
99
99
  if opts[:cmdl_operation] == "info" && status.call == false
100
100
  puts "Server #{opts[:cmdl_info].nil? ? '' : '(' + opts[:cmdl_info].to_s + ') '}not running"
101
- exit
101
+ ::Kernel::exit
102
102
  end
103
103
  if opts[:cmdl_operation] == "info" && status.call == true
104
104
  puts "Server #{opts[:cmdl_info].nil? ? '' : '(' + opts[:cmdl_info].to_s + ') '}running as #{pid}"
@@ -110,11 +110,11 @@ module Daemonism
110
110
  puts "CPU Time: #{stats.last}"
111
111
  rescue
112
112
  end
113
- exit
113
+ ::Kernel::exit
114
114
  end
115
115
  if %w{start}.include?(opts[:cmdl_operation]) && status.call == true
116
116
  puts "Server #{opts[:cmdl_info].nil? ? '' : '(' + opts[:cmdl_info].to_s + ') '}already started"
117
- exit
117
+ ::Kernel::exit
118
118
  end
119
119
  end
120
120
 
@@ -133,7 +133,7 @@ module Daemonism
133
133
  sleep 0.3
134
134
  end
135
135
  end
136
- exit unless opts[:cmdl_operation] == "restart"
136
+ ::Kernel::exit unless opts[:cmdl_operation] == "restart"
137
137
  end
138
138
  end
139
139
 
@@ -153,7 +153,7 @@ module Daemonism
153
153
  Dir.chdir(opts[:basepath])
154
154
  ::Kernel::at_exit do
155
155
  File.unlink(opts[:basepath] + '/' + opts[:pidfile])
156
- @at_exit.call if @at_exit
156
+ @at_exit.call(opts) if @at_exit
157
157
  end
158
158
  end
159
159
  end
@@ -174,6 +174,9 @@ module Daemonism
174
174
  def on_startup(&blk)
175
175
  on :startup, &blk
176
176
  end
177
+ def use(blk)
178
+ instance_eval(&blk)
179
+ end
177
180
  alias_method :at, :on
178
181
  alias_method :at_exit, :on_exit
179
182
  alias_method :at_startup, :on_startup
@@ -193,7 +196,7 @@ class Daemonite
193
196
 
194
197
  def go!
195
198
  begin
196
- @at_startup.call if @at_startup
199
+ @at_startup.call(@opts) if @at_startup
197
200
  @opts[:block].call(@opts)
198
201
  rescue SystemExit, Interrupt
199
202
  puts "Server stopped due to interrupt (PID:#{Process.pid})"
@@ -204,7 +207,7 @@ class Daemonite
204
207
 
205
208
  def loop!
206
209
  begin
207
- @at_startup.call if @at_startup
210
+ @at_startup.call(@opts) if @at_startup
208
211
  loop do
209
212
  @opts[:block].call(@opts)
210
213
  end unless @opts[:block].nil?
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.0
4
+ version: 0.5.5
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: 2019-04-27 00:00:00.000000000 Z
11
+ date: 2020-05-29 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
- rubyforge_project:
48
- rubygems_version: 2.7.6
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.