alexvollmer-daemon-spawn 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.2.0 / 2009-04-22
2
+
3
+ * Allow specification of args instead of ARGV so that scripts can
4
+ handle command line parsing and validation prior to spawning.
5
+
1
6
  === 0.1.0 / 2009-01-26
2
7
 
3
8
  * 1 major enhancement
data/Manifest.txt CHANGED
@@ -2,7 +2,6 @@ History.txt
2
2
  Manifest.txt
3
3
  README.txt
4
4
  Rakefile
5
- bin/daemon-spawn
6
5
  lib/daemon-spawn.rb
7
6
  test/test_daemon-spawn.rb
8
7
  examples/echo_server.rb
data/Rakefile CHANGED
@@ -4,8 +4,8 @@ require 'rubygems'
4
4
  require 'hoe'
5
5
  require './lib/daemon-spawn.rb'
6
6
 
7
- Hoe.new('daemon-spawn', DaemonSpawn::VERSION) do |p|
8
- p.developer('Alex Vollmer', 'alex@evri.com')
7
+ Hoe.spec('daemon-spawn') do |p|
8
+ p.developer('Alex Vollmer', 'alex.vollmer@gmail.com')
9
9
  end
10
10
 
11
11
  # vim: syntax=Ruby
@@ -1,7 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'daemon-spawn'
4
- require 'socket'
3
+ require "socket"
4
+ require "rubygems"
5
+ gem "daemon-spawn", "=0.1.1"
6
+ require "daemon-spawn"
5
7
 
6
8
  class EchoServer < DaemonSpawn::Base
7
9
 
data/lib/daemon-spawn.rb CHANGED
@@ -3,7 +3,7 @@ require "fileutils"
3
3
  # Large portions of this were liberally stolen from the
4
4
  # 'simple-daemon' project at http://simple-daemon.rubyforge.org/
5
5
  module DaemonSpawn
6
- VERSION = '0.1.0'
6
+ VERSION = '0.2.0'
7
7
 
8
8
  def self.usage(msg=nil) #:nodoc:
9
9
  print "#{msg}, " if msg
@@ -50,6 +50,10 @@ module DaemonSpawn
50
50
  if pid = daemon.pid
51
51
  FileUtils.rm(daemon.pid_file)
52
52
  Process.kill("TERM", pid)
53
+ begin
54
+ Process.wait(pid)
55
+ rescue Errno::ECHILD
56
+ end
53
57
  else
54
58
  puts "Pid file not found. Is the daemon started?"
55
59
  exit
@@ -120,11 +124,14 @@ module DaemonSpawn
120
124
  # - <tt>:sync_log</tt> -- indicate whether or not to sync log IO
121
125
  # - <tt>:singleton</tt> -- If set to true, only one instance is
122
126
  # allowed to start
123
- def self.spawn!(opts={ })
124
- case ARGV.size > 0 && ARGV.shift
127
+ # args must begin with 'start', 'stop', 'status', or 'restart'.
128
+ # The first token will be removed and any remaining arguments
129
+ # passed to the daemon's start method.
130
+ def self.spawn!(opts={ }, args=ARGV)
131
+ case args.size > 0 && args.shift
125
132
  when 'start'
126
133
  daemon = self.new(opts)
127
- DaemonSpawn.start(daemon, ARGV)
134
+ DaemonSpawn.start(daemon, args)
128
135
  when 'stop'
129
136
  daemon = self.new(opts)
130
137
  DaemonSpawn.stop(daemon)
@@ -138,7 +145,7 @@ module DaemonSpawn
138
145
  when 'restart'
139
146
  daemon = self.new(opts)
140
147
  DaemonSpawn.stop(daemon)
141
- DaemonSpawn.start(daemon, ARGV)
148
+ DaemonSpawn.start(daemon, args)
142
149
  when '-h', '--help', 'help'
143
150
  DaemonSpawn.usage
144
151
  exit
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alexvollmer-daemon-spawn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Vollmer
@@ -9,23 +9,24 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-26 00:00:00 -08:00
13
- default_executable: daemon-spawn
12
+ date: 2009-09-21 00:00:00 -07:00
13
+ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hoe
17
+ type: :development
17
18
  version_requirement:
18
19
  version_requirements: !ruby/object:Gem::Requirement
19
20
  requirements:
20
21
  - - ">="
21
22
  - !ruby/object:Gem::Version
22
- version: 1.8.2
23
+ version: 2.3.3
23
24
  version:
24
25
  description: Daemon launching and management made dead simple. With daemon-spawn you can start, stop and restart processes that run in the background. Processed are tracked by a simple PID file written to disk. In addition, you can choose to either execute ruby in your daemonized process or 'exec' another process altogether (handy for wrapping other services).
25
26
  email:
26
- - alex@evri.com
27
- executables:
28
- - daemon-spawn
27
+ - alex.vollmer@gmail.com
28
+ executables: []
29
+
29
30
  extensions: []
30
31
 
31
32
  extra_rdoc_files:
@@ -37,12 +38,12 @@ files:
37
38
  - Manifest.txt
38
39
  - README.txt
39
40
  - Rakefile
40
- - bin/daemon-spawn
41
41
  - lib/daemon-spawn.rb
42
42
  - test/test_daemon-spawn.rb
43
43
  - examples/echo_server.rb
44
- has_rdoc: true
44
+ has_rdoc: false
45
45
  homepage: http://github.com/alexvollmer/daemon-spawn
46
+ licenses:
46
47
  post_install_message:
47
48
  rdoc_options:
48
49
  - --main
@@ -64,9 +65,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
65
  requirements: []
65
66
 
66
67
  rubyforge_project: daemon-spawn
67
- rubygems_version: 1.2.0
68
+ rubygems_version: 1.3.5
68
69
  signing_key:
69
- specification_version: 2
70
+ specification_version: 3
70
71
  summary: Daemon launching and management made dead simple
71
72
  test_files:
72
73
  - test/test_daemon-spawn.rb
data/bin/daemon-spawn DELETED
File without changes