unicorn 1.1.4 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/GIT-VERSION-GEN CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/bin/sh
2
2
 
3
3
  GVF=GIT-VERSION-FILE
4
- DEF_VER=v1.1.4.GIT
4
+ DEF_VER=v1.1.5.GIT
5
5
 
6
6
  LF='
7
7
  '
data/GNUmakefile CHANGED
@@ -189,7 +189,7 @@ atom = <link rel="alternate" title="Atom feed" href="$(1)" \
189
189
  doc: .document $(ext)/unicorn_http.c NEWS ChangeLog
190
190
  for i in $(man1_rdoc); do echo > $$i; done
191
191
  find bin lib -type f -name '*.rbc' -exec rm -f '{}' ';'
192
- rdoc -a -t "$(shell sed -ne '1s/^= //p' README)"
192
+ rdoc -t "$(shell sed -ne '1s/^= //p' README)"
193
193
  install -m644 COPYING doc/COPYING
194
194
  install -m644 $(shell grep '^[A-Z]' .document) doc/
195
195
  $(MAKE) -C Documentation install-html install-man
data/Rakefile CHANGED
@@ -15,7 +15,7 @@ def tags
15
15
  timefmt = '%Y-%m-%dT%H:%M:%SZ'
16
16
  @tags ||= `git tag -l`.split(/\n/).map do |tag|
17
17
  next if tag == "v0.0.0"
18
- if %r{\Av[\d\.]+\z} =~ tag
18
+ if %r{\Av[\d\.]+} =~ tag
19
19
  header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
20
20
  header = header.split(/\n/)
21
21
  tagger = header.grep(/\Atagger /).first
@@ -168,8 +168,12 @@ task :fm_update do
168
168
  "changelog" => changelog,
169
169
  },
170
170
  }.to_json
171
- Net::HTTP.start(uri.host, uri.port) do |http|
172
- p http.post(uri.path, req, {'Content-Type'=>'application/json'})
171
+ if ! changelog.strip.empty? && version =~ %r{\A[\d\.]+\d+\z}
172
+ Net::HTTP.start(uri.host, uri.port) do |http|
173
+ p http.post(uri.path, req, {'Content-Type'=>'application/json'})
174
+ end
175
+ else
176
+ warn "not updating freshmeat for v#{version}"
173
177
  end
174
178
  end
175
179
 
data/lib/unicorn.rb CHANGED
@@ -489,12 +489,9 @@ module Unicorn
489
489
  # wait for a signal hander to wake us up and then consume the pipe
490
490
  # Wake up every second anyways to run murder_lazy_workers
491
491
  def master_sleep(sec)
492
- begin
493
- IO.select([ SELF_PIPE[0] ], nil, nil, sec) or return
494
- SELF_PIPE[0].read_nonblock(Const::CHUNK_SIZE, HttpRequest::BUF)
492
+ IO.select([ SELF_PIPE[0] ], nil, nil, sec) or return
493
+ SELF_PIPE[0].read_nonblock(Const::CHUNK_SIZE, HttpRequest::BUF)
495
494
  rescue Errno::EAGAIN, Errno::EINTR
496
- break
497
- end while true
498
495
  end
499
496
 
500
497
  def awaken_master
@@ -36,21 +36,24 @@ class Unicorn::Configurator < Struct.new(:set, :config_file, :after_reload)
36
36
 
37
37
  def initialize(defaults = {}) #:nodoc:
38
38
  self.set = Hash.new(:unset)
39
- use_defaults = defaults.delete(:use_defaults)
39
+ @use_defaults = defaults.delete(:use_defaults)
40
40
  self.config_file = defaults.delete(:config_file)
41
41
 
42
42
  # after_reload is only used by unicorn_rails, unsupported otherwise
43
43
  self.after_reload = defaults.delete(:after_reload)
44
44
 
45
- set.merge!(DEFAULTS) if use_defaults
46
- defaults.each { |key, value| self.send(key, value) }
45
+ set.merge!(DEFAULTS) if @use_defaults
46
+ defaults.each { |key, value| self.__send__(key, value) }
47
47
  Hash === set[:listener_opts] or
48
48
  set[:listener_opts] = Hash.new { |hash,key| hash[key] = {} }
49
49
  Array === set[:listeners] or set[:listeners] = []
50
- reload
50
+ reload(false)
51
51
  end
52
52
 
53
- def reload #:nodoc:
53
+ def reload(merge_defaults = true) #:nodoc:
54
+ if merge_defaults && @use_defaults
55
+ set.merge!(DEFAULTS) if @use_defaults
56
+ end
54
57
  instance_eval(File.read(config_file), config_file) if config_file
55
58
 
56
59
  parse_rackup_file
@@ -392,7 +395,10 @@ class Unicorn::Configurator < Struct.new(:set, :config_file, :after_reload)
392
395
 
393
396
  # sets the working directory for Unicorn. This ensures SIGUSR2 will
394
397
  # start a new instance of Unicorn in this directory. This may be
395
- # a symlink, a common scenario for Capistrano users.
398
+ # a symlink, a common scenario for Capistrano users. Unlike
399
+ # all other Unicorn configuration directives, this binds immediately
400
+ # for error checking and cannot be undone by unsetting it in the
401
+ # configuration file and reloading.
396
402
  def working_directory(path)
397
403
  # just let chdir raise errors
398
404
  path = File.expand_path(path)
data/lib/unicorn/const.rb CHANGED
@@ -8,8 +8,8 @@ module Unicorn
8
8
  # Symbols did not really improve things much compared to constants.
9
9
  module Const
10
10
 
11
- # The current version of Unicorn, currently 1.1.4
12
- UNICORN_VERSION="1.1.4"
11
+ # The current version of Unicorn, currently 1.1.5
12
+ UNICORN_VERSION="1.1.5"
13
13
 
14
14
  DEFAULT_HOST = "0.0.0.0" # default TCP listen host address
15
15
  DEFAULT_PORT = 8080 # default TCP listen port
@@ -0,0 +1,82 @@
1
+ #!/bin/sh
2
+ . ./test-lib.sh
3
+ t_plan 9 "reloading unset config resets defaults"
4
+
5
+ t_begin "setup and start" && {
6
+ unicorn_setup
7
+ rtmpfiles unicorn_config_orig before_reload after_reload
8
+ cat $unicorn_config > $unicorn_config_orig
9
+ cat >> $unicorn_config <<EOF
10
+ logger Logger.new(STDOUT)
11
+ preload_app true
12
+ timeout 0x7fffffff
13
+ worker_processes 2
14
+ after_fork { |s,w| }
15
+ \$dump_cfg = lambda { |fp,srv|
16
+ defaults = Unicorn::Configurator::DEFAULTS
17
+ defaults.keys.map { |x| x.to_s }.sort.each do |key|
18
+ next if key =~ %r{\Astd(?:err|out)_path\z}
19
+ key = key.to_sym
20
+ def_value = defaults[key]
21
+ srv_value = srv.__send__(key)
22
+ fp << "#{key}|#{srv_value}|#{def_value}\\n"
23
+ end
24
+ }
25
+ before_fork { |s,w|
26
+ File.open("$before_reload", "a") { |fp| \$dump_cfg.call(fp, s) }
27
+ }
28
+ before_exec { |s| }
29
+ EOF
30
+ unicorn -D -c $unicorn_config env.ru
31
+ unicorn_wait_start
32
+ }
33
+
34
+ t_begin "ensure worker is started" && {
35
+ curl -sSf http://$listen/ > $tmp
36
+ }
37
+
38
+ t_begin "replace config file with original(-ish)" && {
39
+ grep -v ^pid < $unicorn_config_orig > $unicorn_config
40
+ cat >> $unicorn_config <<EOF
41
+ before_fork { |s,w|
42
+ File.open("$after_reload", "a") { |fp| \$dump_cfg.call(fp, s) }
43
+ }
44
+ EOF
45
+ }
46
+
47
+ t_begin "reload signal succeeds" && {
48
+ kill -HUP $unicorn_pid
49
+ while ! egrep '(done|error) reloading' $r_err >/dev/null
50
+ do
51
+ sleep 1
52
+ done
53
+
54
+ grep 'done reloading' $r_err >/dev/null
55
+ }
56
+
57
+ t_begin "ensure worker is started" && {
58
+ curl -sSf http://$listen/ > $tmp
59
+ }
60
+
61
+ t_begin "pid file no longer exists" && {
62
+ if test -f $pid
63
+ then
64
+ die "pid=$pid should not exist"
65
+ fi
66
+ }
67
+
68
+ t_begin "killing succeeds" && {
69
+ kill $unicorn_pid
70
+ }
71
+
72
+ t_begin "check stderr" && {
73
+ check_stderr
74
+ }
75
+
76
+ t_begin "ensure reloading restored settings" && {
77
+ awk < $after_reload -F'|' '
78
+ $1 != "before_fork" && $2 != $3 { print $0; exit(1) }
79
+ '
80
+ }
81
+
82
+ t_done
data/unicorn.gemspec CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
36
36
  s.homepage = %q{http://unicorn.bogomips.org/}
37
37
 
38
38
  summary = %q{Rack HTTP server for fast clients and Unix}
39
- s.rdoc_options = [ "-Na", "-t", "Unicorn: #{summary}" ]
39
+ s.rdoc_options = [ "-t", "Unicorn: #{summary}" ]
40
40
  s.require_paths = %w(lib ext)
41
41
  s.rubyforge_project = %q{mongrel}
42
42
  s.summary = summary
@@ -49,7 +49,7 @@ Gem::Specification.new do |s|
49
49
  # *strongly* recommended for security reasons.
50
50
  s.add_dependency(%q<rack>)
51
51
 
52
- s.add_development_dependency('isolate', '~> 2.0.2')
52
+ s.add_development_dependency('isolate', '~> 3.0.0')
53
53
 
54
54
  # s.licenses = %w(GPLv2 Ruby) # licenses= method is not in older RubyGems
55
55
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unicorn
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 4
10
- version: 1.1.4
9
+ - 5
10
+ version: 1.1.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Unicorn hackers
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-04 00:00:00 +00:00
18
+ date: 2010-10-27 00:00:00 +00:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -40,12 +40,12 @@ dependencies:
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- hash: 11
43
+ hash: 7
44
44
  segments:
45
- - 2
45
+ - 3
46
46
  - 0
47
- - 2
48
- version: 2.0.2
47
+ - 0
48
+ version: 3.0.0
49
49
  type: :development
50
50
  version_requirements: *id002
51
51
  description: |-
@@ -213,6 +213,7 @@ files:
213
213
  - t/t0008-back_out_of_upgrade.sh
214
214
  - t/t0009-winch_ttin.sh
215
215
  - t/t0011-active-unix-socket.sh
216
+ - t/t0012-reload-empty-config.sh
216
217
  - t/t0300-rails3-basic.sh
217
218
  - t/t0301-rails3-missing-config-ru.sh
218
219
  - t/t0302-rails3-alt-working_directory.sh
@@ -321,7 +322,6 @@ licenses: []
321
322
 
322
323
  post_install_message:
323
324
  rdoc_options:
324
- - -Na
325
325
  - -t
326
326
  - "Unicorn: Rack HTTP server for fast clients and Unix"
327
327
  require_paths: