dante 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/dante/runner.rb +19 -19
  2. data/lib/dante/version.rb +1 -1
  3. metadata +3 -3
@@ -120,13 +120,30 @@ module Dante
120
120
  sleep(1)
121
121
  end
122
122
 
123
+ # Returns true if process is not running
124
+ def daemon_stopped?
125
+ ! self.daemon_running?
126
+ end
127
+
128
+ # Returns running for the daemonized process
129
+ # self.daemon_running?
130
+ def daemon_running?
131
+ return false unless File.exist?(options[:pid_path])
132
+ Process.kill 0, File.read(options[:pid_path]).to_i
133
+ true
134
+ rescue Errno::ESRCH
135
+ false
136
+ end
137
+
138
+ protected
139
+
123
140
  def parse_options
124
141
  headline = [@name, @description].compact.join(" - ")
125
142
  OptionParser.new do |opts|
126
143
  opts.summary_width = 25
127
144
  opts.banner = [headline, "\n\n",
128
- "Usage: #{@name} [-p port] [-P file] [-d] [-k]\n",
129
- " #{@name} --help\n"].compact.join("")
145
+ "Usage: #{@name} [-p port] [-P file] [-d] [-k]\n",
146
+ " #{@name} --help\n"].compact.join("")
130
147
  opts.separator ""
131
148
 
132
149
  opts.on("-p", "--port PORT", Integer, "Specify port", "(default: #{options[:port]})") do |v|
@@ -164,8 +181,6 @@ module Dante
164
181
  options
165
182
  end
166
183
 
167
- protected
168
-
169
184
  def store_pid(pid)
170
185
  FileUtils.mkdir_p(File.dirname(options[:pid_path]))
171
186
  File.open(options[:pid_path], 'w'){|f| f.write("#{pid}\n")}
@@ -195,21 +210,6 @@ module Dante
195
210
  elapsed_seconds < timeout_seconds
196
211
  end
197
212
 
198
- # Returns true if process is not running
199
- def daemon_stopped?
200
- ! self.daemon_running?
201
- end
202
-
203
- # Returns running for the daemonized process
204
- # self.daemon_running?
205
- def daemon_running?
206
- return false unless File.exist?(options[:pid_path])
207
- Process.kill 0, File.read(options[:pid_path]).to_i
208
- true
209
- rescue Errno::ESRCH
210
- false
211
- end
212
-
213
213
  def log(message)
214
214
  puts message if options[:debug]
215
215
  end
@@ -1,3 +1,3 @@
1
1
  module Dante
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dante
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nathan Esquenazi