dante 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -84,7 +84,7 @@ Will return a useful help banner message explaining the simple usage.
84
84
  ## Customization
85
85
 
86
86
  In many cases, you will need to add custom flags/options or a custom description to your executable. You can do this
87
- easily by using the `Dante::Runner` directly:
87
+ easily by using `Dante::Runner` more explicitly:
88
88
 
89
89
  ```ruby
90
90
  #!/usr/bin/env ruby
@@ -95,6 +95,7 @@ require File.expand_path("../../myapp.rb", __FILE__)
95
95
  runner = Dante::Runner.new('myapp', :port => 8080)
96
96
  # Sets the description in 'help'
97
97
  runner.description = "This is myapp"
98
+ # Setup custom 'test' option flag
98
99
  runner.with_options do |opts|
99
100
  opts.on("-t", "--test TEST", String, "Test this thing") do |test|
100
101
  options[:test] = test
data/lib/dante/runner.rb CHANGED
@@ -46,17 +46,14 @@ module Dante
46
46
  # @runner.execute { ... }
47
47
  def execute(&block)
48
48
  parse_options
49
- kill_pid(options[:kill] || '*') if options.include?(:kill)
50
49
 
51
- Process.euid = options[:user] if options[:user]
52
- Process.egid = options[:group] if options[:group]
53
-
54
- @startup_command = block if block_given?
55
-
56
- if !options[:daemonize]
57
- start
58
- else
59
- daemonize
50
+ if options.include?(:kill)
51
+ kill_pid(options[:kill] || '*')
52
+ else # create process
53
+ Process.euid = options[:user] if options[:user]
54
+ Process.egid = options[:group] if options[:group]
55
+ @startup_command = block if block_given?
56
+ options[:daemonize] ? daemonize : start
60
57
  end
61
58
  end
62
59
 
@@ -134,16 +131,14 @@ module Dante
134
131
  def kill_pid(k)
135
132
  Dir[options[:pid_path]].each do |f|
136
133
  begin
137
- puts f
138
- pid = IO.read(f).chomp.to_i
139
- FileUtils.rm f
140
- Process.kill(9, pid)
141
- puts "killed PID: #{pid}"
134
+ pid = IO.read(f).chomp.to_i
135
+ FileUtils.rm f
136
+ Process.kill(9, pid)
137
+ puts "killed PID: #{pid} at #{f}"
142
138
  rescue => e
143
139
  puts "Failed to kill! #{k}: #{e}"
144
140
  end
145
141
  end
146
- exit
147
142
  end
148
143
 
149
144
  def daemonize
data/lib/dante/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dante
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
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: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Nathan Esquenazi
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-11-28 00:00:00 -08:00
18
+ date: 2011-11-30 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency