unicorn 4.3.1 → 4.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/GIT-VERSION-GEN +1 -1
  2. data/GNUmakefile +2 -29
  3. data/lib/unicorn.rb +1 -1
  4. data/lib/unicorn/const.rb +1 -1
  5. data/lib/unicorn/http_server.rb +12 -1
  6. data/lib/unicorn/socket_helper.rb +7 -7
  7. data/lib/unicorn/util.rb +1 -0
  8. data/script/isolate_for_tests +0 -18
  9. data/t/listener_names.ru +4 -0
  10. data/t/t0022-listener_names-preload_app.sh +32 -0
  11. data/test/exec/test_exec.rb +72 -86
  12. data/test/unit/test_util.rb +7 -8
  13. metadata +7 -103
  14. data/t/rails3-app/.gitignore +0 -4
  15. data/t/rails3-app/Gemfile +0 -26
  16. data/t/rails3-app/Rakefile +0 -10
  17. data/t/rails3-app/app/controllers/application_controller.rb +0 -4
  18. data/t/rails3-app/app/helpers/application_helper.rb +0 -2
  19. data/t/rails3-app/app/views/layouts/application.html.erb +0 -14
  20. data/t/rails3-app/config.ru +0 -4
  21. data/t/rails3-app/config/application.rb +0 -46
  22. data/t/rails3-app/config/boot.rb +0 -6
  23. data/t/rails3-app/config/database.yml +0 -22
  24. data/t/rails3-app/config/environment.rb +0 -5
  25. data/t/rails3-app/config/environments/development.rb +0 -19
  26. data/t/rails3-app/config/environments/production.rb +0 -42
  27. data/t/rails3-app/config/environments/test.rb +0 -32
  28. data/t/rails3-app/config/initializers/backtrace_silencers.rb +0 -7
  29. data/t/rails3-app/config/initializers/inflections.rb +0 -10
  30. data/t/rails3-app/config/initializers/mime_types.rb +0 -5
  31. data/t/rails3-app/config/initializers/secret_token.rb +0 -7
  32. data/t/rails3-app/config/initializers/session_store.rb +0 -8
  33. data/t/rails3-app/config/locales/en.yml +0 -5
  34. data/t/rails3-app/config/routes.rb +0 -58
  35. data/t/rails3-app/db/seeds.rb +0 -7
  36. data/t/rails3-app/doc/README_FOR_APP +0 -2
  37. data/t/rails3-app/lib/tasks/.gitkeep +0 -0
  38. data/t/rails3-app/public/404.html +0 -1
  39. data/t/rails3-app/public/500.html +0 -1
  40. data/t/rails3-app/public/x.txt +0 -1
  41. data/t/rails3-app/script/rails +0 -9
  42. data/t/rails3-app/test/performance/browsing_test.rb +0 -9
  43. data/t/rails3-app/test/test_helper.rb +0 -13
  44. data/t/rails3-app/vendor/plugins/.gitkeep +0 -0
  45. data/t/t0300-rails3-basic.sh +0 -28
  46. data/t/t0301-rails3-missing-config-ru.sh +0 -33
  47. data/t/t0302-rails3-alt-working_directory.sh +0 -32
  48. data/t/t0303-rails3-alt-working_directory_config.ru.sh +0 -56
  49. data/t/t0304-rails3-alt-working_directory_no_embed_cli.sh +0 -52
  50. data/t/test-rails3.sh +0 -27
  51. data/test/rails/app-1.2.3/.gitignore +0 -2
  52. data/test/rails/app-1.2.3/Rakefile +0 -7
  53. data/test/rails/app-1.2.3/app/controllers/application.rb +0 -6
  54. data/test/rails/app-1.2.3/app/controllers/foo_controller.rb +0 -36
  55. data/test/rails/app-1.2.3/app/helpers/application_helper.rb +0 -4
  56. data/test/rails/app-1.2.3/config/boot.rb +0 -11
  57. data/test/rails/app-1.2.3/config/database.yml +0 -12
  58. data/test/rails/app-1.2.3/config/environment.rb +0 -13
  59. data/test/rails/app-1.2.3/config/environments/development.rb +0 -9
  60. data/test/rails/app-1.2.3/config/environments/production.rb +0 -5
  61. data/test/rails/app-1.2.3/config/routes.rb +0 -6
  62. data/test/rails/app-1.2.3/db/.gitignore +0 -0
  63. data/test/rails/app-1.2.3/public/404.html +0 -1
  64. data/test/rails/app-1.2.3/public/500.html +0 -1
  65. data/test/rails/app-2.0.2/.gitignore +0 -2
  66. data/test/rails/app-2.0.2/Rakefile +0 -7
  67. data/test/rails/app-2.0.2/app/controllers/application.rb +0 -4
  68. data/test/rails/app-2.0.2/app/controllers/foo_controller.rb +0 -36
  69. data/test/rails/app-2.0.2/app/helpers/application_helper.rb +0 -4
  70. data/test/rails/app-2.0.2/config/boot.rb +0 -11
  71. data/test/rails/app-2.0.2/config/database.yml +0 -12
  72. data/test/rails/app-2.0.2/config/environment.rb +0 -17
  73. data/test/rails/app-2.0.2/config/environments/development.rb +0 -8
  74. data/test/rails/app-2.0.2/config/environments/production.rb +0 -5
  75. data/test/rails/app-2.0.2/config/routes.rb +0 -6
  76. data/test/rails/app-2.0.2/db/.gitignore +0 -0
  77. data/test/rails/app-2.0.2/public/404.html +0 -1
  78. data/test/rails/app-2.0.2/public/500.html +0 -1
  79. data/test/rails/app-2.1.2/.gitignore +0 -2
  80. data/test/rails/app-2.1.2/Rakefile +0 -7
  81. data/test/rails/app-2.1.2/app/controllers/application.rb +0 -4
  82. data/test/rails/app-2.1.2/app/controllers/foo_controller.rb +0 -36
  83. data/test/rails/app-2.1.2/app/helpers/application_helper.rb +0 -4
  84. data/test/rails/app-2.1.2/config/boot.rb +0 -111
  85. data/test/rails/app-2.1.2/config/database.yml +0 -12
  86. data/test/rails/app-2.1.2/config/environment.rb +0 -17
  87. data/test/rails/app-2.1.2/config/environments/development.rb +0 -7
  88. data/test/rails/app-2.1.2/config/environments/production.rb +0 -5
  89. data/test/rails/app-2.1.2/config/routes.rb +0 -6
  90. data/test/rails/app-2.1.2/db/.gitignore +0 -0
  91. data/test/rails/app-2.1.2/public/404.html +0 -1
  92. data/test/rails/app-2.1.2/public/500.html +0 -1
  93. data/test/rails/app-2.2.2/.gitignore +0 -2
  94. data/test/rails/app-2.2.2/Rakefile +0 -7
  95. data/test/rails/app-2.2.2/app/controllers/application.rb +0 -4
  96. data/test/rails/app-2.2.2/app/controllers/foo_controller.rb +0 -36
  97. data/test/rails/app-2.2.2/app/helpers/application_helper.rb +0 -4
  98. data/test/rails/app-2.2.2/config/boot.rb +0 -111
  99. data/test/rails/app-2.2.2/config/database.yml +0 -12
  100. data/test/rails/app-2.2.2/config/environment.rb +0 -17
  101. data/test/rails/app-2.2.2/config/environments/development.rb +0 -7
  102. data/test/rails/app-2.2.2/config/environments/production.rb +0 -5
  103. data/test/rails/app-2.2.2/config/routes.rb +0 -6
  104. data/test/rails/app-2.2.2/db/.gitignore +0 -0
  105. data/test/rails/app-2.2.2/public/404.html +0 -1
  106. data/test/rails/app-2.2.2/public/500.html +0 -1
  107. data/test/rails/test_rails.rb +0 -287
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,10 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new inflection rules using the following format
4
- # (all these examples are active by default):
5
- # ActiveSupport::Inflector.inflections do |inflect|
6
- # inflect.plural /^(ox)$/i, '\1en'
7
- # inflect.singular /^(ox)en/i, '\1'
8
- # inflect.irregular 'person', 'people'
9
- # inflect.uncountable %w( fish sheep )
10
- # end
@@ -1,5 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
5
- # Mime::Type.register_alias "text/html", :iphone
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Your secret key for verifying the integrity of signed cookies.
4
- # If you change this key, all old signed cookies will become invalid!
5
- # Make sure the secret is at least 30 characters and all random,
6
- # no regular words or you'll be exposed to dictionary attacks.
7
- Rails.application.config.secret_token = '71ca844cc99ed2057a65cc6bd66b57fbbf69e8d4aef00072e41c3e896635e99ea485a6ed45f6e846d5547d614235df146a9756920b8b4a1726a53e75cda45bd1'
@@ -1,8 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- Rails.application.config.session_store :cookie_store, :key => '_app_session'
4
-
5
- # Use the database for sessions instead of the cookie-based default,
6
- # which shouldn't be used to store highly confidential information
7
- # (create the session table with "rake db:sessions:create")
8
- # Rails.application.config.session_store :active_record_store
@@ -1,5 +0,0 @@
1
- # Sample localization file for English. Add more files in this directory for other locales.
2
- # See http://github.com/svenfuchs/rails-i18n/tree/master/rails%2Flocale for starting points.
3
-
4
- en:
5
- hello: "Hello world"
@@ -1,58 +0,0 @@
1
- App::Application.routes.draw do |map|
2
- # The priority is based upon order of creation:
3
- # first created -> highest priority.
4
-
5
- # Sample of regular route:
6
- # match 'products/:id' => 'catalog#view'
7
- # Keep in mind you can assign values other than :controller and :action
8
-
9
- # Sample of named route:
10
- # match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
11
- # This route can be invoked with purchase_url(:id => product.id)
12
-
13
- # Sample resource route (maps HTTP verbs to controller actions automatically):
14
- # resources :products
15
-
16
- # Sample resource route with options:
17
- # resources :products do
18
- # member do
19
- # get :short
20
- # post :toggle
21
- # end
22
- #
23
- # collection do
24
- # get :sold
25
- # end
26
- # end
27
-
28
- # Sample resource route with sub-resources:
29
- # resources :products do
30
- # resources :comments, :sales
31
- # resource :seller
32
- # end
33
-
34
- # Sample resource route with more complex sub-resources
35
- # resources :products do
36
- # resources :comments
37
- # resources :sales do
38
- # get :recent, :on => :collection
39
- # end
40
- # end
41
-
42
- # Sample resource route within a namespace:
43
- # namespace :admin do
44
- # # Directs /admin/products/* to Admin::ProductsController
45
- # # (app/controllers/admin/products_controller.rb)
46
- # resources :products
47
- # end
48
-
49
- # You can have the root of your site routed with "root"
50
- # just remember to delete public/index.html.
51
- # root :to => "welcome#index"
52
-
53
- # See how all your routes lay out with "rake routes"
54
-
55
- # This is a legacy wild controller route that's not recommended for RESTful applications.
56
- # Note: This route will make all actions in every controller accessible via GET requests.
57
- # match ':controller(/:action(/:id(.:format)))'
58
- end
@@ -1,7 +0,0 @@
1
- # This file should contain all the record creation needed to seed the database with its default values.
2
- # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
- #
4
- # Examples:
5
- #
6
- # cities = City.create([{ :name => 'Chicago' }, { :name => 'Copenhagen' }])
7
- # Mayor.create(:name => 'Daley', :city => cities.first)
@@ -1,2 +0,0 @@
1
- Use this README file to introduce your application and point to useful places in the API for learning more.
2
- Run "rake doc:app" to generate API documentation for your models, controllers, helpers, and libraries.
File without changes
@@ -1 +0,0 @@
1
- 404 Not Found
@@ -1 +0,0 @@
1
- 500 Internal Server Error
@@ -1 +0,0 @@
1
- HELLO
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- ENV_PATH = File.expand_path('../../config/environment', __FILE__)
5
- BOOT_PATH = File.expand_path('../../config/boot', __FILE__)
6
- APP_PATH = File.expand_path('../../config/application', __FILE__)
7
-
8
- require BOOT_PATH
9
- require 'rails/commands'
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
- require 'rails/performance_test_help'
3
-
4
- # Profiling results for each test method are written to tmp/performance.
5
- class BrowsingTest < ActionDispatch::PerformanceTest
6
- def test_homepage
7
- get '/'
8
- end
9
- end
@@ -1,13 +0,0 @@
1
- ENV["RAILS_ENV"] = "test"
2
- require File.expand_path('../../config/environment', __FILE__)
3
- require 'rails/test_help'
4
-
5
- class ActiveSupport::TestCase
6
- # Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
7
- #
8
- # Note: You'll currently still have to declare fixtures explicitly in integration tests
9
- # -- they do not yet inherit this setting
10
- fixtures :all
11
-
12
- # Add more helper methods to be used by all tests here...
13
- end
File without changes
@@ -1,28 +0,0 @@
1
- #!/bin/sh
2
- . ./test-rails3.sh
3
-
4
- t_plan 3 "Rails 3 (beta) tests"
5
-
6
- t_begin "setup and start" && {
7
- rails3_app=$(cd rails3-app && pwd)
8
- rm -rf $t_pfx.app
9
- mkdir $t_pfx.app
10
- cd $t_pfx.app
11
- ( cd $rails3_app && tar cf - . ) | tar xf -
12
- $RAKE db:sessions:create
13
- $RAKE db:migrate
14
- unicorn_setup
15
- unicorn_rails -D -c $unicorn_config
16
- unicorn_wait_start
17
- }
18
-
19
- # add more tests here
20
- t_begin "hit with curl" && {
21
- test xHELLO = x"$(curl -sSf http://$listen/x.txt)"
22
- }
23
-
24
- t_begin "killing succeeds" && {
25
- kill $unicorn_pid
26
- }
27
-
28
- t_done
@@ -1,33 +0,0 @@
1
- #!/bin/sh
2
- . ./test-rails3.sh
3
-
4
- t_plan 4 "Rails 3 (beta) tests for config.ru haters"
5
-
6
- t_begin "setup and start" && {
7
- rails3_app=$(cd rails3-app && pwd)
8
- rm -rf $t_pfx.app
9
- mkdir $t_pfx.app
10
- cd $t_pfx.app
11
- ( cd $rails3_app && tar cf - . ) | tar xf -
12
- rm config.ru
13
- $RAKE db:sessions:create
14
- $RAKE db:migrate
15
- unicorn_setup
16
- unicorn_rails -D -c $unicorn_config
17
- unicorn_wait_start
18
- }
19
-
20
- t_begin "static file serving works" && {
21
- test x"$(curl -sSf http://$listen/x.txt)" = xHELLO
22
- }
23
-
24
- # add more tests here
25
- t_begin "hit with curl" && {
26
- curl -v http://$listen/ || :
27
- }
28
-
29
- t_begin "killing succeeds" && {
30
- kill $unicorn_pid
31
- }
32
-
33
- t_done
@@ -1,32 +0,0 @@
1
- #!/bin/sh
2
- . ./test-rails3.sh
3
-
4
- t_plan 3 "Rails 3 (beta) inside alt working_directory (no config.ru)"
5
-
6
- t_begin "setup and start" && {
7
- unicorn_setup
8
- rails3_app=$(cd rails3-app && pwd)
9
- rm -rf $t_pfx.app
10
- mkdir $t_pfx.app
11
- cd $t_pfx.app
12
- ( cd $rails3_app && tar cf - . ) | tar xf -
13
- rm config.ru
14
- $RAKE db:sessions:create
15
- $RAKE db:migrate
16
- unicorn_setup
17
- rm $pid
18
- echo "working_directory '$t_pfx.app'" >> $unicorn_config
19
- cd /
20
- unicorn_rails -D -c $unicorn_config
21
- unicorn_wait_start
22
- }
23
-
24
- t_begin "static file serving works" && {
25
- test x"$(curl -sSf http://$listen/x.txt)" = xHELLO
26
- }
27
-
28
- t_begin "killing succeeds" && {
29
- kill $unicorn_pid
30
- }
31
-
32
- t_done
@@ -1,56 +0,0 @@
1
- #!/bin/sh
2
- . ./test-rails3.sh
3
-
4
- t_plan 5 "Rails 3 (beta) inside alt working_directory (w/ config.ru)"
5
-
6
- t_begin "setup and start" && {
7
- unicorn_setup
8
- rtmpfiles unicorn_config_tmp usocket
9
- if test -e $usocket
10
- then
11
- die "unexpected $usocket"
12
- fi
13
- rails3_app=$(cd rails3-app && pwd)
14
- rm -rf $t_pfx.app
15
- mkdir $t_pfx.app
16
- cd $t_pfx.app
17
- ( cd $rails3_app && tar cf - . ) | tar xf -
18
- $RAKE db:sessions:create
19
- $RAKE db:migrate
20
- unicorn_setup
21
- rm $pid
22
-
23
- echo "#\\--daemonize --host $host --port $port -l $usocket" \
24
- >> $t_pfx.app/config.ru
25
-
26
- # we have --host/--port in config.ru instead
27
- grep -v ^listen $unicorn_config |
28
- grep -v ^pid > $unicorn_config_tmp
29
- echo "working_directory '$t_pfx.app'" >> $unicorn_config_tmp
30
- cd /
31
- unicorn_rails -c $unicorn_config_tmp
32
- }
33
-
34
- t_begin "pids in the right place" && {
35
- if test -e $pid
36
- then
37
- die "pid=$pid not expected"
38
- fi
39
-
40
- unicorn_rails_pid="$t_pfx.app/tmp/pids/unicorn.pid"
41
- unicorn_pid=$(cat $unicorn_rails_pid)
42
- }
43
-
44
- t_begin "static file serving works" && {
45
- test x"$(curl -sSf http://$listen/x.txt)" = xHELLO
46
- }
47
-
48
- t_begin "socket created" && {
49
- test -S $usocket
50
- }
51
-
52
- t_begin "killing succeeds" && {
53
- kill $unicorn_pid
54
- }
55
-
56
- t_done
@@ -1,52 +0,0 @@
1
- #!/bin/sh
2
- . ./test-rails3.sh
3
-
4
- t_plan 5 "Rails 3 (beta) inside alt working_directory (no embedded switches)"
5
-
6
- t_begin "setup and start" && {
7
- unicorn_setup
8
- rtmpfiles unicorn_config_tmp usocket
9
- if test -e $usocket
10
- then
11
- die "unexpected $usocket"
12
- fi
13
- rails3_app=$(cd rails3-app && pwd)
14
- rm -rf $t_pfx.app
15
- mkdir $t_pfx.app
16
- cd $t_pfx.app
17
- ( cd $rails3_app && tar cf - . ) | tar xf -
18
- $RAKE db:sessions:create
19
- $RAKE db:migrate
20
- unicorn_setup
21
- rm $pid
22
-
23
- grep -v ^pid $unicorn_config > $unicorn_config_tmp
24
- echo "working_directory '$t_pfx.app'" >> $unicorn_config_tmp
25
- cd /
26
- unicorn_rails -c $unicorn_config_tmp \
27
- --daemonize --host $host --port $port -l $usocket
28
- }
29
-
30
- t_begin "pids in the right place" && {
31
- if test -e $pid
32
- then
33
- die "pid=$pid not expected"
34
- fi
35
-
36
- unicorn_rails_pid="$t_pfx.app/tmp/pids/unicorn.pid"
37
- unicorn_pid=$(cat $unicorn_rails_pid)
38
- }
39
-
40
- t_begin "static file serving works" && {
41
- test x"$(curl -sSf http://$listen/x.txt)" = xHELLO
42
- }
43
-
44
- t_begin "socket created" && {
45
- test -S $usocket
46
- }
47
-
48
- t_begin "killing succeeds" && {
49
- kill $unicorn_pid
50
- }
51
-
52
- t_done
data/t/test-rails3.sh DELETED
@@ -1,27 +0,0 @@
1
- . ./test-lib.sh
2
- RAILS_VERSION=${RAILS_VERSION-3.0.0}
3
- case $RUBY_VERSION in
4
- 1.8.7|1.9.2) ;;
5
- *)
6
- t_info "RUBY_VERSION=$RUBY_VERSION unsupported for Rails 3"
7
- exit 0
8
- ;;
9
- esac
10
-
11
- arch_gems=../tmp/isolate/ruby-$RUBY_VERSION/gems
12
- rails_gems=../tmp/isolate/rails-$RAILS_VERSION/gems
13
- rails_bin="$rails_gems/rails-$RAILS_VERSION/bin/rails"
14
- if ! test -d "$arch_gems" || ! test -d "$rails_gems" || ! test -x "$rails_bin"
15
- then
16
- ( cd ../ && ./script/isolate_for_tests )
17
- fi
18
-
19
- for i in $arch_gems/*-* $rails_gems/*-*
20
- do
21
- if test -d $i/lib
22
- then
23
- RUBYLIB=$(cd $i/lib && pwd):$RUBYLIB
24
- fi
25
- done
26
-
27
- export RUBYLIB
@@ -1,2 +0,0 @@
1
- /tmp
2
- /vendor
@@ -1,7 +0,0 @@
1
- require(File.join(File.dirname(__FILE__), 'config', 'boot'))
2
-
3
- require 'rake'
4
- require 'rake/testtask'
5
- require 'rake/rdoctask'
6
-
7
- require 'tasks/rails'
@@ -1,6 +0,0 @@
1
- # -*- encoding: binary -*-
2
-
3
- class ApplicationController < ActionController::Base
4
- # Pick a unique cookie name to distinguish our session data from others'
5
- session :session_key => "_unicorn_rails_test.#{rand}"
6
- end
@@ -1,36 +0,0 @@
1
- # -*- encoding: binary -*-
2
-
3
- require 'digest/sha1'
4
- class FooController < ApplicationController
5
- def index
6
- render :text => "FOO\n"
7
- end
8
-
9
- def xcookie
10
- cookies["foo"] = "cookie #$$"
11
- render :text => ""
12
- end
13
-
14
- def xnotice
15
- flash[:notice] = "session #$$"
16
- render :text => ""
17
- end
18
-
19
- def xpost
20
- if request.post?
21
- digest = Digest::SHA1.new
22
- out = "params: #{params.inspect}\n"
23
- if file = params[:file]
24
- loop do
25
- buf = file.read(4096) or break
26
- digest.update(buf)
27
- end
28
- out << "sha1: #{digest.to_s}\n"
29
- end
30
- headers['content-type'] = 'text/plain'
31
- render :text => out
32
- else
33
- render :status => 403, :text => "need post\n"
34
- end
35
- end
36
- end