unicorn 0.990.0 → 0.990.0.5.gbfb1
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/unicorn_rails +26 -4
- data/t/t0300-rails3-basic.sh +2 -30
- data/t/t0301-rails3-missing-config-ru.sh +33 -0
- data/t/test-rails3.sh +27 -0
- metadata +5 -3
data/bin/unicorn_rails
CHANGED
@@ -109,13 +109,31 @@ end
|
|
109
109
|
|
110
110
|
ru = ARGV[0] || (File.exist?('config.ru') ? 'config.ru' : nil)
|
111
111
|
|
112
|
+
def rails_dispatcher
|
113
|
+
if ::Rails::VERSION::MAJOR >= 3 && ::File.exist?('config/application.rb')
|
114
|
+
if ::File.read('config/application.rb') =~ /^module\s+([\w:]+)\s*$/
|
115
|
+
app_module = Object.const_get($1)
|
116
|
+
begin
|
117
|
+
result = app_module::Application
|
118
|
+
rescue NameError
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
if result.nil? && defined?(ActionController::Dispatcher)
|
124
|
+
result = ActionController::Dispatcher.new
|
125
|
+
end
|
126
|
+
|
127
|
+
result || abort("Unable to locate the application dispatcher class")
|
128
|
+
end
|
129
|
+
|
112
130
|
def rails_builder(daemonize)
|
113
131
|
# this lambda won't run until after forking if preload_app is false
|
114
132
|
lambda do ||
|
115
133
|
# Load Rails and (possibly) the private version of Rack it bundles.
|
116
134
|
begin
|
117
|
-
require 'config/boot'
|
118
|
-
require 'config/environment'
|
135
|
+
require ::File.expand_path('config/boot')
|
136
|
+
require ::File.expand_path('config/environment')
|
119
137
|
rescue LoadError => err
|
120
138
|
abort "#$0 must be run inside RAILS_ROOT: #{err.inspect}"
|
121
139
|
end
|
@@ -149,8 +167,12 @@ def rails_builder(daemonize)
|
|
149
167
|
use Rails::Rack::LogTailer unless daemonize
|
150
168
|
use Rails::Rack::Debugger if $DEBUG
|
151
169
|
map(map_path) do
|
152
|
-
|
153
|
-
|
170
|
+
if defined?(ActionDispatch::Static)
|
171
|
+
use ActionDispatch::Static, "#{Rails.root}/public"
|
172
|
+
else
|
173
|
+
use Rails::Rack::Static
|
174
|
+
end
|
175
|
+
run rails_dispatcher
|
154
176
|
end
|
155
177
|
end
|
156
178
|
end.to_app
|
data/t/t0300-rails3-basic.sh
CHANGED
@@ -1,33 +1,5 @@
|
|
1
1
|
#!/bin/sh
|
2
|
-
|
3
|
-
|
4
|
-
. ./test-lib.sh
|
5
|
-
|
6
|
-
case $RUBY_VERSION in
|
7
|
-
1.8.7|1.9.2) ;;
|
8
|
-
*)
|
9
|
-
t_info "RUBY_VERSION=$RUBY_VERSION unsupported for Rails 3"
|
10
|
-
exit 0
|
11
|
-
;;
|
12
|
-
esac
|
13
|
-
|
14
|
-
arch_gems=../tmp/isolate/ruby-$RUBY_VERSION/gems
|
15
|
-
rails_gems=../tmp/isolate/rails-$RAILS_VERSION/gems
|
16
|
-
rails_bin="$rails_gems/rails-$RAILS_VERSION/bin/rails"
|
17
|
-
if ! test -d "$arch_gems" || ! test -d "$rails_gems" || ! test -x "$rails_bin"
|
18
|
-
then
|
19
|
-
( cd ../ && $RAKE isolate )
|
20
|
-
fi
|
21
|
-
|
22
|
-
for i in $arch_gems/*-* $rails_gems/*-*
|
23
|
-
do
|
24
|
-
if test -d $i/lib
|
25
|
-
then
|
26
|
-
RUBYLIB=$(cd $i/lib && pwd):$RUBYLIB
|
27
|
-
fi
|
28
|
-
done
|
29
|
-
|
30
|
-
export RUBYLIB
|
2
|
+
. ./test-rails3.sh
|
31
3
|
|
32
4
|
t_plan 3 "Rails 3 (beta) tests"
|
33
5
|
|
@@ -40,7 +12,7 @@ t_begin "setup and start" && {
|
|
40
12
|
$RAKE db:sessions:create
|
41
13
|
$RAKE db:migrate
|
42
14
|
unicorn_setup
|
43
|
-
|
15
|
+
unicorn_rails -D -c $unicorn_config
|
44
16
|
unicorn_wait_start
|
45
17
|
}
|
46
18
|
|
@@ -0,0 +1,33 @@
|
|
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
|
data/t/test-rails3.sh
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
. ./test-lib.sh
|
2
|
+
RAILS_VERSION=${RAILS_VERSION-3.0.0.beta3}
|
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 ../ && $RAKE isolate )
|
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
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unicorn
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.990.0
|
4
|
+
version: 0.990.0.5.gbfb1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Unicorn hackers
|
@@ -188,7 +188,9 @@ files:
|
|
188
188
|
- t/t0001-reload-bad-config.sh
|
189
189
|
- t/t0002-config-conflict.sh
|
190
190
|
- t/t0300-rails3-basic.sh
|
191
|
+
- t/t0301-rails3-missing-config-ru.sh
|
191
192
|
- t/test-lib.sh
|
193
|
+
- t/test-rails3.sh
|
192
194
|
- test/aggregate.rb
|
193
195
|
- test/benchmark/README
|
194
196
|
- test/benchmark/dd.ru
|
@@ -304,9 +306,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
304
306
|
version:
|
305
307
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
306
308
|
requirements:
|
307
|
-
- - "
|
309
|
+
- - ">"
|
308
310
|
- !ruby/object:Gem::Version
|
309
|
-
version:
|
311
|
+
version: 1.3.1
|
310
312
|
version:
|
311
313
|
requirements: []
|
312
314
|
|