upstart-unicorn-launcher 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a414fcb8c1871445b2111e954bdc9cb65850a44d
4
- data.tar.gz: 60ede7fcda9a76782338b223bfdab17546231b39
3
+ metadata.gz: fcfcecdaacbb99d28cb3ba75e37e0f2f77aa7180
4
+ data.tar.gz: 7f9384d07859a01267cfc0e3e00b10e2825aa10e
5
5
  SHA512:
6
- metadata.gz: f783ab849e8a605392a3cd5eb1fdb175ddddcc81f7a00ff87c90092f180a687ddf7a706aa7968b13dc4cb052304b044932c3d65d0e610ed8ba9dc6ef4ad987e1
7
- data.tar.gz: c60199146b50352e229c438ce300e1533d3ffa162b8eb1d58b558487122e1af9c0641b7cfce0c518f6e169e5475fd9d97bdb5c50a1359db33431a54ebbbccdf8
6
+ metadata.gz: 264cfee8d9ba752f70a878de25dbcd19716c1dfd858dbb66832e9bdc00f6857432719edf9b00320e78918897e0a1b5e66258dd6bf109aba88bc389b3a6de4b30
7
+ data.tar.gz: 599e9ce3cc01913b01b96ea04e3dfefba648662aba7aaa2f3625c1044effaa58a4e0c4a14801f00abe48d411af274ddfba06493f774f414aff678bce4638e5f4
@@ -16,6 +16,10 @@ OptionParser.new do |opts|
16
16
  opts.on("-s", "--startup-time STARTUP", "Time to wait for server to start") do |time|
17
17
  options[:startup] = time.to_i
18
18
  end
19
+
20
+ opts.on("-v", "--verbose", "Verbose output") do
21
+ options[:verbose] = true
22
+ end
19
23
  end.parse!(ARGV[0...command_index])
20
24
 
21
25
  launcher = UpstartUnicornLauncher.new command, options
@@ -1,13 +1,14 @@
1
1
  require 'timeout'
2
2
 
3
3
  class UpstartUnicornLauncher
4
- attr_accessor :command, :pidfile, :startup_period, :tick_period, :restarting
4
+ attr_accessor :command, :pidfile, :startup_period, :tick_period, :restarting, :verbose
5
5
 
6
6
  def initialize(command, options = {})
7
7
  self.command = command
8
8
  self.pidfile = File.expand_path(options[:pidfile] || 'unicorn.pid')
9
9
  self.startup_period = options[:startup] || 60
10
10
  self.tick_period = options[:tick] || 0.1
11
+ self.verbose = options[:verbose] || false
11
12
  end
12
13
 
13
14
  def start
@@ -32,6 +33,7 @@ class UpstartUnicornLauncher
32
33
 
33
34
  def restart_server_on(*signals)
34
35
  signals.each do |signal|
36
+ debug "Received #{signal}, restarting server"
35
37
  trap(signal.to_s) { restart_server }
36
38
  end
37
39
  end
@@ -39,6 +41,7 @@ class UpstartUnicornLauncher
39
41
  def quit_server_on(*signals)
40
42
  signals.each do |signal|
41
43
  trap(signal.to_s) do
44
+ debug "Received #{signal}, quitting server"
42
45
  Process.kill signal.to_s, pid
43
46
  wait_until_server_quits
44
47
  exit
@@ -97,7 +100,9 @@ class UpstartUnicornLauncher
97
100
  private
98
101
 
99
102
  def debug(message)
100
- puts message
103
+ if verbose
104
+ puts message
105
+ end
101
106
  end
102
107
 
103
108
  def wait_for(timeout = 20, &block)
@@ -1,3 +1,3 @@
1
1
  class UpstartUnicornLauncher
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/spec/spec_helper.rb CHANGED
@@ -4,7 +4,7 @@ module ProjectSupport
4
4
  end
5
5
 
6
6
  def start_launcher
7
- @launcher_pid = Process.spawn "upstart-unicorn-launcher -s 1 -p spec/templates/test/unicorn.pid -- unicorn -p 7516 -c spec/templates/test/unicorn.rb spec/templates/test/config.ru"
7
+ @launcher_pid = Process.spawn "upstart-unicorn-launcher -v -s 1 -p spec/templates/test/unicorn.pid -- unicorn -p 7516 -c spec/templates/test/unicorn.rb spec/templates/test/config.ru"
8
8
  sleep 1
9
9
  puts "Launched upstart-unicorn-launcher with PID #{@launcher_pid}"
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: upstart-unicorn-launcher
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Ward