passenger 3.9.2.beta → 4.0.0.rc4

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of passenger might be problematic. Click here for more details.

Files changed (159) hide show
  1. data/.travis.yml +3 -0
  2. data/NEWS +77 -7
  3. data/README.md +3 -11
  4. data/bin/passenger-install-apache2-module +24 -20
  5. data/bin/passenger-install-nginx-module +25 -23
  6. data/build/agents.rb +11 -0
  7. data/build/apache2.rb +9 -5
  8. data/build/basics.rb +37 -30
  9. data/build/common_library.rb +4 -1
  10. data/build/cplusplus_support.rb +5 -5
  11. data/build/cxx_tests.rb +28 -8
  12. data/build/integration_tests.rb +6 -3
  13. data/build/nginx.rb +3 -3
  14. data/build/packaging.rb +95 -57
  15. data/build/ruby_extension.rb +34 -21
  16. data/build/ruby_tests.rb +4 -2
  17. data/build/test_basics.rb +1 -1
  18. data/dev/run_travis.sh +36 -1
  19. data/doc/Users guide Apache.html +425 -308
  20. data/doc/Users guide Apache.idmap.txt +78 -70
  21. data/doc/Users guide Apache.index.sqlite3 +0 -0
  22. data/doc/Users guide Apache.txt +33 -92
  23. data/doc/Users guide Nginx.html +519 -220
  24. data/doc/Users guide Nginx.idmap.txt +78 -60
  25. data/doc/Users guide Nginx.txt +115 -26
  26. data/doc/Users guide Standalone.html +8 -2
  27. data/doc/users_guide_snippets/analysis_and_system_maintenance.txt +1 -7
  28. data/doc/users_guide_snippets/installation.txt +167 -22
  29. data/doc/users_guide_snippets/rackup_specifications.txt +4 -0
  30. data/doc/users_guide_snippets/since_version.txt +1 -0
  31. data/doc/users_guide_snippets/support_information.txt +3 -7
  32. data/doc/users_guide_snippets/tips.txt +0 -24
  33. data/ext/apache2/Configuration.cpp +11 -33
  34. data/ext/apache2/Configuration.hpp +3 -18
  35. data/ext/apache2/DirectoryMapper.h +20 -70
  36. data/ext/apache2/Hooks.cpp +2 -2
  37. data/ext/common/AgentsStarter.cpp +0 -2
  38. data/ext/common/AgentsStarter.h +0 -1
  39. data/ext/common/AgentsStarter.hpp +1 -3
  40. data/ext/common/ApplicationPool2/AppTypes.cpp +74 -0
  41. data/ext/common/ApplicationPool2/AppTypes.h +202 -0
  42. data/ext/common/ApplicationPool2/Common.h +12 -10
  43. data/ext/common/ApplicationPool2/DirectSpawner.h +256 -0
  44. data/ext/common/ApplicationPool2/DummySpawner.h +90 -0
  45. data/ext/common/ApplicationPool2/Group.h +311 -94
  46. data/ext/common/ApplicationPool2/Implementation.cpp +405 -145
  47. data/ext/common/ApplicationPool2/Options.h +24 -26
  48. data/ext/common/ApplicationPool2/PipeWatcher.h +20 -13
  49. data/ext/common/ApplicationPool2/Pool.h +326 -183
  50. data/ext/common/ApplicationPool2/Process.h +205 -55
  51. data/ext/common/ApplicationPool2/README.md +1 -1
  52. data/ext/common/ApplicationPool2/Session.h +21 -10
  53. data/ext/common/ApplicationPool2/SmartSpawner.h +801 -0
  54. data/ext/common/ApplicationPool2/Spawner.h +141 -1149
  55. data/ext/common/ApplicationPool2/SpawnerFactory.h +132 -0
  56. data/ext/common/ApplicationPool2/SuperGroup.h +146 -223
  57. data/ext/common/Constants.h +4 -2
  58. data/ext/common/Exceptions.h +23 -1
  59. data/ext/common/Logging.cpp +17 -6
  60. data/ext/common/Logging.h +37 -7
  61. data/ext/common/ResourceLocator.h +1 -1
  62. data/ext/common/Utils.cpp +49 -1
  63. data/ext/common/Utils.h +13 -4
  64. data/ext/common/{AnsiColorConstants.h → Utils/AnsiColorConstants.h} +0 -0
  65. data/ext/common/{BCrypt.cpp → Utils/BCrypt.cpp} +0 -0
  66. data/ext/common/{BCrypt.h → Utils/BCrypt.h} +0 -0
  67. data/ext/common/{Blowfish.c → Utils/Blowfish.c} +0 -0
  68. data/ext/common/{Blowfish.h → Utils/Blowfish.h} +0 -0
  69. data/ext/common/Utils/CachedFileStat.hpp +27 -25
  70. data/ext/common/Utils/Curl.h +184 -0
  71. data/ext/common/{HttpConstants.h → Utils/HttpConstants.h} +3 -0
  72. data/ext/common/Utils/IOUtils.cpp +6 -2
  73. data/ext/common/{IniFile.h → Utils/IniFile.h} +0 -0
  74. data/ext/common/Utils/LargeFiles.cpp +30 -0
  75. data/ext/common/Utils/LargeFiles.h +40 -0
  76. data/ext/common/Utils/StrIntUtils.cpp +72 -8
  77. data/ext/common/Utils/StrIntUtils.h +24 -2
  78. data/ext/common/Utils/StringMap.h +12 -2
  79. data/ext/common/Utils/VariantMap.h +51 -2
  80. data/ext/common/Utils/jsoncpp.cpp +1 -1
  81. data/ext/common/agents/Base.cpp +147 -11
  82. data/ext/common/agents/HelperAgent/AgentOptions.h +14 -6
  83. data/ext/common/agents/HelperAgent/Main.cpp +79 -19
  84. data/ext/common/agents/HelperAgent/RequestHandler.h +36 -16
  85. data/ext/common/agents/LoggingAgent/LoggingServer.h +3 -5
  86. data/ext/common/agents/LoggingAgent/Main.cpp +2 -4
  87. data/ext/common/agents/LoggingAgent/RemoteSender.h +18 -24
  88. data/ext/common/agents/SpawnPreparer.cpp +7 -0
  89. data/ext/common/agents/Watchdog/Main.cpp +96 -38
  90. data/ext/nginx/Configuration.c +26 -22
  91. data/ext/nginx/Configuration.h +4 -2
  92. data/ext/nginx/ContentHandler.c +23 -52
  93. data/ext/nginx/ContentHandler.h +5 -11
  94. data/ext/nginx/config +10 -3
  95. data/ext/nginx/ngx_http_passenger_module.c +21 -6
  96. data/ext/nginx/ngx_http_passenger_module.h +4 -1
  97. data/ext/oxt/dynamic_thread_group.hpp +9 -1
  98. data/ext/oxt/system_calls.cpp +2 -2
  99. data/ext/ruby/extconf.rb +2 -1
  100. data/helper-scripts/backtrace-sanitizer.rb +2 -0
  101. data/helper-scripts/wsgi-loader.py +54 -21
  102. data/lib/phusion_passenger.rb +5 -3
  103. data/lib/phusion_passenger/abstract_installer.rb +18 -41
  104. data/lib/phusion_passenger/admin_tools/memory_stats.rb +2 -2
  105. data/lib/phusion_passenger/admin_tools/server_instance.rb +2 -2
  106. data/lib/phusion_passenger/common_library.rb +23 -3
  107. data/lib/phusion_passenger/debug_logging.rb +10 -3
  108. data/lib/phusion_passenger/packaging.rb +1 -0
  109. data/lib/phusion_passenger/platform_info.rb +113 -115
  110. data/lib/phusion_passenger/platform_info/compiler.rb +224 -134
  111. data/lib/phusion_passenger/platform_info/cxx_portability.rb +143 -0
  112. data/lib/phusion_passenger/platform_info/depcheck.rb +371 -0
  113. data/lib/phusion_passenger/platform_info/depcheck_specs/apache2.rb +124 -0
  114. data/lib/phusion_passenger/platform_info/depcheck_specs/compiler_toolchain.rb +97 -0
  115. data/lib/phusion_passenger/platform_info/depcheck_specs/gems.rb +39 -0
  116. data/lib/phusion_passenger/platform_info/depcheck_specs/libs.rb +118 -0
  117. data/lib/phusion_passenger/platform_info/depcheck_specs/ruby.rb +137 -0
  118. data/lib/phusion_passenger/platform_info/depcheck_specs/utilities.rb +15 -0
  119. data/lib/phusion_passenger/platform_info/operating_system.rb +6 -5
  120. data/lib/phusion_passenger/platform_info/ruby.rb +45 -34
  121. data/lib/phusion_passenger/request_handler.rb +35 -22
  122. data/lib/phusion_passenger/request_handler/thread_handler.rb +5 -6
  123. data/lib/phusion_passenger/ruby_core_enhancements.rb +7 -1
  124. data/lib/phusion_passenger/standalone/runtime_installer.rb +43 -34
  125. data/lib/phusion_passenger/utils/robust_interruption.rb +34 -18
  126. data/passenger.gemspec +25 -0
  127. data/resources/templates/standalone/config.erb +3 -1
  128. data/test/config.json.travis +2 -2
  129. data/test/cxx/ApplicationPool2/DirectSpawnerTest.cpp +37 -5
  130. data/test/cxx/ApplicationPool2/PoolTest.cpp +143 -50
  131. data/test/cxx/ApplicationPool2/ProcessTest.cpp +8 -0
  132. data/test/cxx/ApplicationPool2/SmartSpawnerTest.cpp +28 -17
  133. data/test/cxx/ApplicationPool2/SpawnerTestCases.cpp +31 -26
  134. data/test/cxx/RequestHandlerTest.cpp +17 -1
  135. data/test/cxx/UtilsTest.cpp +84 -10
  136. data/test/integration_tests/apache2_tests.rb +49 -163
  137. data/test/integration_tests/hello_world_wsgi_spec.rb +2 -2
  138. data/test/integration_tests/mycook_spec.rb +1 -1
  139. data/test/integration_tests/nginx_tests.rb +37 -19
  140. data/test/ruby/request_handler_spec.rb +1 -0
  141. data/test/ruby/spec_helper.rb +52 -1
  142. data/test/stub/nginx/nginx.conf.erb +2 -0
  143. data/test/stub/rack/start.rb +5 -0
  144. data/test/stub/rails3.0/Gemfile.lock +30 -30
  145. data/test/stub/rails3.1/Gemfile +1 -1
  146. data/test/stub/rails3.1/Gemfile.lock +3 -3
  147. data/test/stub/rails3.2/Gemfile +1 -1
  148. data/test/stub/rails3.2/Gemfile.lock +4 -4
  149. data/test/stub/rails_apps/2.3/mycook/app/controllers/welcome_controller.rb +1 -1
  150. data/test/stub/rails_apps/2.3/mycook/app/helpers/recipes_helper.rb +2 -0
  151. data/test/stub/rails_apps/2.3/mycook/app/helpers/test_helper.rb +2 -0
  152. data/test/stub/rails_apps/2.3/mycook/app/helpers/uploads_helper.rb +2 -0
  153. data/test/stub/rails_apps/2.3/mycook/app/helpers/welcome_helper.rb +2 -0
  154. data/test/support/nginx_controller.rb +2 -1
  155. metadata +160 -156
  156. data/build/gempackagetask.rb +0 -99
  157. data/build/packagetask.rb +0 -186
  158. data/ext/common/StringListCreator.h +0 -83
  159. data/lib/phusion_passenger/dependencies.rb +0 -657
@@ -21,6 +21,8 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
  # THE SOFTWARE.
23
23
 
24
+ require 'phusion_passenger/platform_info/cxx_portability'
25
+
24
26
  ########## Phusion Passenger common library ##########
25
27
 
26
28
  require 'phusion_passenger/common_library'
@@ -198,5 +200,6 @@ end
198
200
 
199
201
  libboost_oxt_cflags = ""
200
202
  libboost_oxt_cflags << " -faddress-sanitizer" if USE_ASAN
203
+ libboost_oxt_cflags.strip!
201
204
  LIBBOOST_OXT = define_libboost_oxt_task("common", COMMON_OUTPUT_DIR + "libboost_oxt", libboost_oxt_cflags)
202
- COMMON_LIBRARY.define_tasks
205
+ COMMON_LIBRARY.define_tasks(libboost_oxt_cflags)
@@ -23,11 +23,11 @@
23
23
 
24
24
  # Rake functions for compiling/linking C++ stuff.
25
25
 
26
- def compile_c(source, flags = "#{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS}")
26
+ def compile_c(source, flags = "#{EXTRA_PRE_CFLAGS} #{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS}")
27
27
  sh "#{CC} #{flags} -c #{source}"
28
28
  end
29
29
 
30
- def compile_cxx(source, flags = "#{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS}")
30
+ def compile_cxx(source, flags = "#{EXTRA_PRE_CXXFLAGS} #{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS}")
31
31
  sh "#{CXX} #{flags} -c #{source}"
32
32
  end
33
33
 
@@ -43,15 +43,15 @@ def create_static_library(target, sources)
43
43
  sh "ranlib #{target}"
44
44
  end
45
45
 
46
- def create_executable(target, sources, linkflags = "#{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS} #{PlatformInfo.portability_ldflags} #{EXTRA_LDFLAGS}")
46
+ def create_executable(target, sources, linkflags = "#{EXTRA_PRE_CXXFLAGS} #{EXTRA_PRE_LDFLAGS} #{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS} #{PlatformInfo.portability_ldflags} #{EXTRA_LDFLAGS}")
47
47
  sh "#{CXX} #{sources} -o #{target} #{linkflags}"
48
48
  end
49
49
 
50
- def create_c_executable(target, sources, linkflags = "#{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS} #{PlatformInfo.portability_ldflags} #{EXTRA_LDFLAGS}")
50
+ def create_c_executable(target, sources, linkflags = "#{EXTRA_PRE_CFLAGS} #{EXTRA_PRE_LDFLAGS} #{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS} #{PlatformInfo.portability_ldflags} #{EXTRA_LDFLAGS}")
51
51
  sh "#{CC} #{sources} -o #{target} #{linkflags}"
52
52
  end
53
53
 
54
- def create_shared_library(target, sources, flags = "#{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS} #{PlatformInfo.portability_ldflags} #{EXTRA_LDFLAGS}")
54
+ def create_shared_library(target, sources, flags = "#{EXTRA_PRE_CXXFLAGS} #{EXTRA_PRE_LDFLAGS} #{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS} #{PlatformInfo.portability_ldflags} #{EXTRA_LDFLAGS}")
55
55
  if RUBY_PLATFORM =~ /darwin/
56
56
  shlib_flag = "-flat_namespace -bundle -undefined dynamic_lookup"
57
57
  else
@@ -43,7 +43,9 @@ TEST_CXX_OBJECTS = {
43
43
  test/cxx/TestSupport.cpp
44
44
  test/cxx/TestSupport.h
45
45
  ext/common/SafeLibev.h
46
- ext/common/BackgroundEventLoop.cpp),
46
+ ext/common/BackgroundEventLoop.cpp
47
+ ext/common/Exceptions.h
48
+ ext/common/Utils.h),
47
49
  'test/cxx/ApplicationPool2/OptionsTest.o' => %w(
48
50
  test/cxx/ApplicationPool2/OptionsTest.cpp
49
51
  ext/common/ApplicationPool2/Options.h),
@@ -53,14 +55,16 @@ TEST_CXX_OBJECTS = {
53
55
  ext/common/ApplicationPool2/Options.h
54
56
  ext/common/ApplicationPool2/Process.h
55
57
  ext/common/ApplicationPool2/Socket.h
56
- ext/common/ApplicationPool2/Spawner.h),
58
+ ext/common/ApplicationPool2/Spawner.h
59
+ ext/common/ApplicationPool2/DirectSpawner.h),
57
60
  'test/cxx/ApplicationPool2/SmartSpawnerTest.o' => %w(
58
61
  test/cxx/ApplicationPool2/SmartSpawnerTest.cpp
59
62
  test/cxx/ApplicationPool2/SpawnerTestCases.cpp
60
63
  ext/common/ApplicationPool2/Options.h
61
64
  ext/common/ApplicationPool2/Process.h
62
65
  ext/common/ApplicationPool2/Socket.h
63
- ext/common/ApplicationPool2/Spawner.h),
66
+ ext/common/ApplicationPool2/Spawner.h
67
+ ext/common/ApplicationPool2/SmartSpawner.h),
64
68
  'test/cxx/ApplicationPool2/ProcessTest.o' => %w(
65
69
  test/cxx/ApplicationPool2/ProcessTest.cpp
66
70
  ext/common/ApplicationPool2/Process.h
@@ -71,7 +75,14 @@ TEST_CXX_OBJECTS = {
71
75
  ext/common/ApplicationPool2/SuperGroup.h
72
76
  ext/common/ApplicationPool2/Group.h
73
77
  ext/common/ApplicationPool2/Pool.h
74
- ext/common/ApplicationPool2/Spawner.h),
78
+ ext/common/ApplicationPool2/Process.h
79
+ ext/common/ApplicationPool2/Socket.h
80
+ ext/common/ApplicationPool2/Options.h
81
+ ext/common/ApplicationPool2/Spawner.h
82
+ ext/common/ApplicationPool2/SpawnerFactory.h
83
+ ext/common/ApplicationPool2/SmartSpawner.h
84
+ ext/common/ApplicationPool2/DirectSpawner.h
85
+ ext/common/ApplicationPool2/DummySpawner.h),
75
86
  'test/cxx/MessageReadersWritersTest.o' => %w(
76
87
  test/cxx/MessageReadersWritersTest.cpp
77
88
  ext/common/MessageReadersWriters.h
@@ -133,7 +144,12 @@ TEST_CXX_OBJECTS = {
133
144
  ext/common/ApplicationPool2/SuperGroup.h
134
145
  ext/common/ApplicationPool2/Group.h
135
146
  ext/common/ApplicationPool2/Process.h
136
- ext/common/ApplicationPool2/Spawner.h),
147
+ ext/common/ApplicationPool2/Options.h
148
+ ext/common/ApplicationPool2/Spawner.h
149
+ ext/common/ApplicationPool2/SpawnerFactory.h
150
+ ext/common/ApplicationPool2/SmartSpawner.h
151
+ ext/common/ApplicationPool2/DirectSpawner.h
152
+ ext/common/ApplicationPool2/DummySpawner.h),
137
153
  'test/cxx/FileBackedPipeTest.o' => %w(
138
154
  test/cxx/FileBackedPipeTest.cpp
139
155
  ext/common/agents/HelperAgent/FileBackedPipe.h),
@@ -171,7 +187,8 @@ TEST_CXX_OBJECTS = {
171
187
  ext/common/Utils/VariantMap.h),
172
188
  'test/cxx/StringMapTest.o' => %w(
173
189
  test/cxx/StringMapTest.cpp
174
- ext/common/Utils/StringMap.h),
190
+ ext/common/Utils/StringMap.h
191
+ ext/common/Utils/HashMap.h),
175
192
  'test/cxx/ProcessMetricsCollectorTest.o' => %w(
176
193
  test/cxx/ProcessMetricsCollectorTest.cpp
177
194
  ext/common/Utils/ProcessMetricsCollector.h),
@@ -189,10 +206,10 @@ TEST_CXX_OBJECTS = {
189
206
  dependencies = [
190
207
  'test/cxx/CxxTestMain',
191
208
  'test/support/allocate_memory',
192
- :native_support,
209
+ NATIVE_SUPPORT_TARGET,
193
210
  AGENT_OUTPUT_DIR + 'SpawnPreparer',
194
211
  AGENT_OUTPUT_DIR + 'EnvPrinter'
195
- ]
212
+ ].compact
196
213
  desc "Run unit tests for the Apache 2 and Nginx C++ components"
197
214
  task 'test:cxx' => dependencies do
198
215
  args = ENV['GROUPS'].to_s.split(",").map{ |name| "-g #{name}" }
@@ -202,6 +219,9 @@ task 'test:cxx' => dependencies do
202
219
  elsif boolean_option('VALGRIND')
203
220
  command = "valgrind --dsymutil=yes --db-attach=yes --child-silent-after-fork=yes #{command}"
204
221
  end
222
+ if boolean_option('SUDO')
223
+ command = "sudo #{command}"
224
+ end
205
225
  if boolean_option('REPEAT')
206
226
  if boolean_option('GDB')
207
227
  abort "You cannot set both REPEAT=1 and GDB=1."
@@ -27,8 +27,9 @@ desc "Run all integration tests"
27
27
  task 'test:integration' => ['test:integration:apache2', 'test:integration:nginx'] do
28
28
  end
29
29
 
30
+ dependencies = [:apache2, NATIVE_SUPPORT_TARGET].compact
30
31
  desc "Run Apache 2 integration tests"
31
- task 'test:integration:apache2' => [:apache2, :native_support] do
32
+ task 'test:integration:apache2' => dependencies do
32
33
  if PlatformInfo.rspec.nil?
33
34
  abort "RSpec is not installed for Ruby interpreter '#{PlatformInfo.ruby_command}'. Please install it."
34
35
  else
@@ -38,8 +39,9 @@ task 'test:integration:apache2' => [:apache2, :native_support] do
38
39
  end
39
40
  end
40
41
 
42
+ dependencies = [:nginx, NATIVE_SUPPORT_TARGET].compact
41
43
  desc "Run Nginx integration tests"
42
- task 'test:integration:nginx' => :nginx do
44
+ task 'test:integration:nginx' => dependencies do
43
45
  if PlatformInfo.rspec.nil?
44
46
  abort "RSpec is not installed for Ruby interpreter '#{PlatformInfo.ruby_command}'. Please install it."
45
47
  else
@@ -49,8 +51,9 @@ task 'test:integration:nginx' => :nginx do
49
51
  end
50
52
  end
51
53
 
54
+ dependencies = [:apache2, NATIVE_SUPPORT_TARGET].compact
52
55
  desc "Run the 'restart' integration test infinitely, and abort if/when it fails"
53
- task 'test:restart' => [:apache2, :native_support] do
56
+ task 'test:restart' => dependencies do
54
57
  Dir.chdir("test") do
55
58
  color_code_start = "\e[33m\e[44m\e[1m"
56
59
  color_code_end = "\e[0m"
@@ -1,5 +1,5 @@
1
1
  # Phusion Passenger - https://www.phusionpassenger.com/
2
- # Copyright (c) 2010 Phusion
2
+ # Copyright (c) 2010-2013 Phusion
3
3
  #
4
4
  # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
5
5
  #
@@ -24,8 +24,8 @@
24
24
  desc "Build Nginx support files"
25
25
  task :nginx => [
26
26
  :nginx_without_native_support,
27
- :native_support
28
- ]
27
+ NATIVE_SUPPORT_TARGET
28
+ ].compact
29
29
 
30
30
  task :nginx_without_native_support => [
31
31
  AGENT_OUTPUT_DIR + 'PassengerHelperAgent',
@@ -1,5 +1,5 @@
1
1
  # Phusion Passenger - https://www.phusionpassenger.com/
2
- # Copyright (c) 2010, 2011, 2012 Phusion
2
+ # Copyright (c) 2010-2013 Phusion
3
3
  #
4
4
  # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
5
5
  #
@@ -21,6 +21,11 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
  # THE SOFTWARE.
23
23
 
24
+ task :clobber => 'package:clean'
25
+
26
+ desc "Build the gem and tarball"
27
+ task 'package' => ['package:gem', 'package:tarball']
28
+
24
29
  task 'package:check' do
25
30
  require 'phusion_passenger'
26
31
 
@@ -30,68 +35,46 @@ task 'package:check' do
30
35
  end
31
36
  end
32
37
 
33
- spec = Gem::Specification.new do |s|
34
- s.platform = Gem::Platform::RUBY
35
- s.homepage = "https://www.phusionpassenger.com/"
36
- s.summary = "Easy and robust Ruby web application deployment"
37
- s.name = "passenger"
38
- s.version = VERSION_STRING
39
- s.rubyforge_project = "passenger"
40
- s.author = "Phusion - http://www.phusion.nl/"
41
- s.email = "info@phusion.nl"
42
- s.require_paths = ["lib"]
43
- s.add_dependency 'rake', '>= 0.8.1'
44
- s.add_dependency 'fastthread', '>= 1.0.1'
45
- s.add_dependency 'daemon_controller', '>= 1.1.0'
46
- s.add_dependency 'rack'
47
- s.files = FileList[*Packaging::GLOB] - FileList[*Packaging::EXCLUDE_GLOB]
48
- s.executables = Packaging::USER_EXECUTABLES + Packaging::SUPER_USER_EXECUTABLES
49
- s.description = "Easy and robust Ruby web application deployment."
38
+ desc "Build the gem"
39
+ task 'package:gem' => [:doc, 'package:check'] do
40
+ require 'phusion_passenger'
41
+ sh "gem build #{PhusionPassenger::PACKAGE_NAME}.gemspec"
42
+ sh "mkdir -p pkg"
43
+ sh "mv #{PhusionPassenger::PACKAGE_NAME}-#{PhusionPassenger::VERSION_STRING}.gem pkg/"
50
44
  end
51
45
 
52
- Rake::GemPackageTask.new(spec) do |pkg|
53
- pkg.need_tar_gz = true
54
- end
46
+ desc "Build the tarball"
47
+ task 'package:tarball' => [:doc, 'package:check'] do
48
+ require 'phusion_passenger'
49
+ require 'fileutils'
55
50
 
56
- task 'package:filelist' do
57
- # The package:filelist task is used by Phusion Passenger Lite
58
- # to obtain a list of files that it must copy to a temporary
59
- # directory in order to compile Nginx and to compile Phusion
60
- # Passenger. The original Phusion Passenger sources might not
61
- # be writiable, e.g. when installed via a gem as root, hence
62
- # the reason for copying.
63
- #
64
- # The Asciidoc HTML files are in the packaging list, but
65
- # they're auto-generated and aren't included in the source
66
- # repository, so here we ensure that they exist. This is
67
- # generally only for people who are developing Phusion
68
- # Passenger itself; users who installed Phusion Passenger
69
- # via a gem, tarball or native package already have the
70
- # HTML files.
71
- #
72
- # The reason why we don't just specify Packaging::ASCII_DOCS
73
- # as a task dependency is because we only want to generate
74
- # the HTML files if they don't already exist; we don't want
75
- # to regenerate if they exist but their source .txt files
76
- # are modified. When the user installs Phusion Passenger
77
- # via a gem/tarball/package, all file timestamps are set
78
- # to the current clock time, which could lead Rake into
79
- # thinking that the source .txt files are modified. Since
80
- # the user probably has no write permission to the original
81
- # Phusion Passenger sources we want to avoid trying to
82
- # regenerate the HTML files.
83
- Packaging::ASCII_DOCS.each do |ascii_doc|
84
- Rake::Task[ascii_doc].invoke if !File.exist?(ascii_doc)
51
+ basename = "#{PhusionPassenger::PACKAGE_NAME}-#{PhusionPassenger::VERSION_STRING}"
52
+ sh "rm -rf pkg/#{basename}"
53
+ sh "mkdir -p pkg/#{basename}"
54
+ files = Dir[*PhusionPassenger::Packaging::GLOB] -
55
+ Dir[*PhusionPassenger::Packaging::EXCLUDE_GLOB]
56
+ files.each_with_index do |filename, i|
57
+ dir = File.dirname(filename)
58
+ if !File.exist?("pkg/#{basename}/#{dir}")
59
+ FileUtils.mkdir_p("pkg/#{basename}/#{dir}")
60
+ end
61
+ if !File.directory?(filename)
62
+ FileUtils.install(filename, "pkg/#{basename}/#{filename}")
63
+ end
64
+ printf "\r[%5d/%5d] [%3.0f%%] Copying files...", i, files.size, i * 100.0 / files.size
65
+ STDOUT.flush
85
66
  end
86
- puts spec.files
67
+ puts
68
+ sh "cd pkg && tar -c #{basename} | gzip --best > #{basename}.tar.gz"
69
+ sh "rm -rf pkg/#{basename}"
87
70
  end
88
71
 
89
- Rake::Task['package'].prerequisites.unshift(:doc)
90
- Rake::Task['package'].prerequisites.unshift('package:check')
91
- Rake::Task['package:gem'].prerequisites.unshift(:doc)
92
- Rake::Task['package:gem'].prerequisites.unshift('package:check')
93
- Rake::Task['package:force'].prerequisites.unshift(:doc)
94
- task :clobber => :'package:clean'
72
+ desc "Remove gem and tarball"
73
+ task 'package:clean' do
74
+ require 'phusion_passenger'
75
+ sh "rm -f #{PhusionPassenger::PACKAGE_NAME}-#{PhusionPassenger::VERSION_STRING}.gem"
76
+ sh "rm -f #{PhusionPassenger::PACKAGE_NAME}-#{PhusionPassenger::VERSION_STRING}.tar.gz"
77
+ end
95
78
 
96
79
  desc "Create a fakeroot, useful for building native packages"
97
80
  task :fakeroot => [:apache2, :nginx] + Packaging::ASCII_DOCS do
@@ -175,3 +158,58 @@ task 'package:debian' => 'package:check' do
175
158
 
176
159
  sh "debuild"
177
160
  end
161
+
162
+ desc "Sign all packaged files"
163
+ task 'package:sign' => 'package:check' do
164
+ require 'phusion_passenger'
165
+ begin
166
+ require 'highline'
167
+ rescue LoadError
168
+ abort "Please run `gem install highline` first."
169
+ end
170
+ h = HighLine.new
171
+ password = h.ask("Password for software-signing@phusion.nl GPG key: ") { |q| q.echo = false }
172
+ begin
173
+ File.open(".gpg-password", "w", 0600) do |f|
174
+ f.write(password)
175
+ end
176
+ version = PhusionPassenger::VERSION_STRING
177
+ ["passenger-#{version}.gem",
178
+ "passenger-#{version}.tar.gz",
179
+ "passenger-enterprise-server-#{version}.gem",
180
+ "passenger-enterprise-server-#{version}.tar.gz"].each do |name|
181
+ if File.exist?("pkg/#{name}")
182
+ sh "gpg --sign --detach-sign --passphrase-file .gpg-password --local-user software-signing@phusion.nl --armor pkg/#{name}"
183
+ end
184
+ end
185
+ ensure
186
+ File.unlink('.gpg-password') if File.exist?('.gpg-password')
187
+ end
188
+ end
189
+
190
+ desc "Upload packages and signatures"
191
+ task 'package:upload' => ['package', 'package:sign'] do
192
+ require 'phusion_passenger'
193
+ version = PhusionPassenger::VERSION_STRING
194
+
195
+ signatures = []
196
+ ["passenger-#{version}.gem.asc",
197
+ "passenger-#{version}.tar.gz.asc",
198
+ "passenger-enterprise-server-#{version}.gem.asc",
199
+ "passenger-enterprise-server-#{version}.tar.gz.asc"].each do |name|
200
+ if File.exist?("pkg/#{name}")
201
+ signatures << "pkg/#{name}"
202
+ end
203
+ end
204
+ sh "scp #{signatures.join(' ')} app@shell.phusion.nl:/u/apps/signatures/phusion-passenger/"
205
+
206
+ if File.exist?("pkg/passenger-#{version}.gem")
207
+ #sh "gem push pkg/passenger-#{version}.gem"
208
+ end
209
+
210
+ if File.exist?("pkg/passenger-#{version}.tar.gz")
211
+ puts "--------------"
212
+ puts "All done. Please upload pkg/passenger-#{version}.tar.gz " +
213
+ "to RubyForge and update the version number in the Phusion Passenger website."
214
+ end
215
+ end
@@ -1,5 +1,5 @@
1
1
  # Phusion Passenger - https://www.phusionpassenger.com/
2
- # Copyright (c) 2010 Phusion
2
+ # Copyright (c) 2010-2013 Phusion
3
3
  #
4
4
  # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
5
5
  #
@@ -21,28 +21,41 @@
21
21
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
  # THE SOFTWARE.
23
23
 
24
- output_dir = RUBY_EXTENSION_OUTPUT_DIR
25
- output_name = "passenger_native_support.#{LIBEXT}"
26
- source_dir = "ext/ruby"
24
+ if RUBY_PLATFORM =~ /java/
25
+ NATIVE_SUPPORT_TARGET = nil
27
26
 
28
- task :native_support => "#{output_dir}/#{output_name}"
29
- task :clean => 'native_support:clean'
27
+ task :native_support do
28
+ # Do nothing.
29
+ end
30
30
 
31
- dependencies = [
32
- "#{output_dir}/Makefile",
33
- "#{source_dir}/passenger_native_support.c"
34
- ]
35
- file("#{output_dir}/#{output_name}" => dependencies) do
36
- sh "mkdir -p '#{output_dir}'" if !File.exist?(output_dir)
37
- sh "cd '#{output_dir}' && make"
38
- end
31
+ task 'native_support:clean' do
32
+ # Do nothing.
33
+ end
34
+ else
35
+ output_dir = RUBY_EXTENSION_OUTPUT_DIR
36
+ output_name = "passenger_native_support.#{LIBEXT}"
37
+ source_dir = "ext/ruby"
38
+ NATIVE_SUPPORT_TARGET = "#{output_dir}/#{output_name}"
39
39
 
40
- file "#{output_dir}/Makefile" => "#{source_dir}/extconf.rb" do
41
- sh "mkdir -p '#{output_dir}'" if !File.exist?(output_dir)
42
- extconf_rb = File.expand_path("#{source_dir}/extconf.rb")
43
- sh "cd '#{output_dir}' && #{PlatformInfo.ruby_command} '#{extconf_rb}'"
44
- end
40
+ task :native_support => "#{output_dir}/#{output_name}"
41
+ task :clean => 'native_support:clean'
42
+
43
+ dependencies = [
44
+ "#{output_dir}/Makefile",
45
+ "#{source_dir}/passenger_native_support.c"
46
+ ]
47
+ file("#{output_dir}/#{output_name}" => dependencies) do
48
+ sh "mkdir -p '#{output_dir}'" if !File.exist?(output_dir)
49
+ sh "cd '#{output_dir}' && make"
50
+ end
51
+
52
+ file "#{output_dir}/Makefile" => "#{source_dir}/extconf.rb" do
53
+ sh "mkdir -p '#{output_dir}'" if !File.exist?(output_dir)
54
+ extconf_rb = File.expand_path("#{source_dir}/extconf.rb")
55
+ sh "cd '#{output_dir}' && #{PlatformInfo.ruby_command} '#{extconf_rb}'"
56
+ end
45
57
 
46
- task 'native_support:clean' do
47
- sh "echo rm -rf #{output_dir}"
58
+ task 'native_support:clean' do
59
+ sh "echo rm -rf #{output_dir}"
60
+ end
48
61
  end
@@ -23,8 +23,9 @@
23
23
 
24
24
  ### Ruby components tests ###
25
25
 
26
+ dependencies = [NATIVE_SUPPORT_TARGET, AGENT_OUTPUT_DIR + 'PassengerLoggingAgent'].compact
26
27
  desc "Run unit tests for the Ruby libraries"
27
- task 'test:ruby' => [:native_support, AGENT_OUTPUT_DIR + 'PassengerLoggingAgent'] do
28
+ task 'test:ruby' => dependencies do
28
29
  if PlatformInfo.rspec.nil?
29
30
  abort "RSpec is not installed for Ruby interpreter '#{PlatformInfo.ruby_command}'. Please install it."
30
31
  else
@@ -34,8 +35,9 @@ task 'test:ruby' => [:native_support, AGENT_OUTPUT_DIR + 'PassengerLoggingAgent'
34
35
  end
35
36
  end
36
37
 
38
+ dependencies = [NATIVE_SUPPORT_TARGET].compact
37
39
  desc "Run coverage tests for the Ruby libraries"
38
- task 'test:rcov' => :native_support do
40
+ task 'test:rcov' => dependencies do
39
41
  if PlatformInfo.rspec.nil?
40
42
  abort "RSpec is not installed for Ruby interpreter '#{PlatformInfo.ruby_command}'. Please install it."
41
43
  else