passenger 4.0.0.rc4 → 4.0.0.rc6

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 (83) hide show
  1. data.tar.gz.asc +12 -0
  2. data/.travis.yml +4 -4
  3. data/NEWS +46 -0
  4. data/bin/passenger-config +31 -1
  5. data/bin/passenger-install-apache2-module +1 -1
  6. data/bin/passenger-install-nginx-module +1 -0
  7. data/build/common_library.rb +4 -0
  8. data/build/cplusplus_support.rb +27 -6
  9. data/build/cxx_tests.rb +1 -1
  10. data/build/misc.rb +28 -6
  11. data/build/packaging.rb +72 -65
  12. data/build/test_basics.rb +1 -1
  13. data/dev/googlecode_upload.py +265 -0
  14. data/dev/run_travis.sh +9 -0
  15. data/doc/Users guide Apache.html +376 -193
  16. data/doc/Users guide Apache.idmap.txt +80 -62
  17. data/doc/Users guide Apache.txt +61 -35
  18. data/doc/Users guide Nginx.html +278 -83
  19. data/doc/Users guide Nginx.idmap.txt +26 -10
  20. data/doc/Users guide Nginx.txt +59 -31
  21. data/doc/Users guide Standalone.html +1 -1
  22. data/doc/users_guide_snippets/installation.txt +121 -11
  23. data/doc/users_guide_snippets/rvm_helper_tool.txt +56 -0
  24. data/ext/apache2/Bucket.cpp +1 -1
  25. data/ext/apache2/Configuration.cpp +7 -1
  26. data/ext/apache2/Configuration.hpp +4 -0
  27. data/ext/apache2/Hooks.cpp +2 -2
  28. data/ext/common/AgentsStarter.cpp +2 -2
  29. data/ext/common/AgentsStarter.h +1 -1
  30. data/ext/common/AgentsStarter.hpp +2 -2
  31. data/ext/common/ApplicationPool2/DirectSpawner.h +4 -8
  32. data/ext/common/ApplicationPool2/Group.h +17 -11
  33. data/ext/common/ApplicationPool2/Implementation.cpp +39 -11
  34. data/ext/common/ApplicationPool2/Pool.h +23 -4
  35. data/ext/common/ApplicationPool2/Process.h +30 -11
  36. data/ext/common/ApplicationPool2/SmartSpawner.h +3 -1
  37. data/ext/common/Constants.h +1 -1
  38. data/ext/common/EventedBufferedInput.h +4 -0
  39. data/ext/common/Utils.cpp +21 -3
  40. data/ext/common/Utils.h +8 -1
  41. data/ext/common/Utils/HttpHeaderBufferer.h +1 -1
  42. data/ext/common/Utils/IOUtils.cpp +5 -4
  43. data/ext/common/Utils/IOUtils.h +32 -14
  44. data/ext/common/Utils/MessagePassing.h +2 -2
  45. data/ext/common/Utils/ProcessMetricsCollector.h +47 -15
  46. data/ext/common/Utils/ScopeGuard.h +20 -3
  47. data/ext/common/Utils/StrIntUtils.h +14 -5
  48. data/ext/common/agents/Base.cpp +161 -50
  49. data/ext/common/agents/HelperAgent/AgentOptions.h +2 -2
  50. data/ext/common/agents/HelperAgent/Main.cpp +1 -0
  51. data/ext/common/agents/HelperAgent/RequestHandler.h +166 -52
  52. data/ext/common/agents/LoggingAgent/Main.cpp +1 -1
  53. data/ext/common/agents/Watchdog/Main.cpp +2 -2
  54. data/ext/nginx/Configuration.c +31 -4
  55. data/ext/nginx/Configuration.h +1 -0
  56. data/ext/nginx/ContentHandler.c +148 -34
  57. data/ext/nginx/ngx_http_passenger_module.c +4 -1
  58. data/ext/oxt/detail/spin_lock_pthreads.hpp +4 -4
  59. data/ext/oxt/macros.hpp +30 -8
  60. data/lib/phusion_passenger.rb +2 -2
  61. data/lib/phusion_passenger/classic_rails/thread_handler_extension.rb +1 -1
  62. data/lib/phusion_passenger/native_support.rb +19 -1
  63. data/lib/phusion_passenger/platform_info/compiler.rb +6 -0
  64. data/lib/phusion_passenger/platform_info/ruby.rb +54 -5
  65. data/lib/phusion_passenger/preloader_shared_helpers.rb +8 -1
  66. data/lib/phusion_passenger/rack/out_of_band_gc.rb +3 -1
  67. data/lib/phusion_passenger/rack/thread_handler_extension.rb +32 -5
  68. data/lib/phusion_passenger/request_handler/thread_handler.rb +28 -8
  69. data/lib/phusion_passenger/ruby_core_enhancements.rb +9 -1
  70. data/lib/phusion_passenger/standalone/runtime_installer.rb +1 -0
  71. data/lib/phusion_passenger/utils/unseekable_socket.rb +50 -5
  72. data/passenger.gemspec +1 -1
  73. data/resources/templates/apache2/config_snippets.txt.erb +1 -1
  74. data/test/cxx/ApplicationPool2/PoolTest.cpp +4 -9
  75. data/test/cxx/RequestHandlerTest.cpp +5 -5
  76. data/test/ruby/classic_rails/loader_spec.rb +1 -1
  77. data/test/ruby/classic_rails/preloader_spec.rb +1 -1
  78. data/test/ruby/request_handler_spec.rb +207 -1
  79. data/test/ruby/shared/loader_sharedspec.rb +1 -0
  80. data/test/ruby/spec_helper.rb +11 -1
  81. data/test/stub/apache2/httpd.conf.erb +1 -1
  82. metadata +5 -3
  83. metadata.gz.asc +12 -0
@@ -0,0 +1,12 @@
1
+ -----BEGIN PGP SIGNATURE-----
2
+ Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
3
+ Comment: GPGTools - http://gpgtools.org
4
+
5
+ iQEcBAABAgAGBQJRZAnsAAoJECrHRaUKISqMxSwH/2cB1DU2Tbi9rlKSzaENWXZO
6
+ iagprli5Fzy2KS2b8U/37b8/XJfUs8aDcXM/mE90B3duFPv+HCL9kuTYDPRDHTQq
7
+ l4mlqLdUJLo0tODh4+yW41LUntq2e433e7/67BS6B0VGzyNv8oT7IRf5htmUC7Cj
8
+ vju3qkf2cdDU2k3WyR5P3rut5TFpN2pFaVr4pLTjYoctT3gVOeLKRQ4hDDugaWR8
9
+ XnVU9R4T/1gKrDbV26WY1exf6A3EIpVhUN8MtfMYL7q8cZ6qlBBlzVV3rEd+WC4R
10
+ S5hip9LfgniNl7+jsXtceyPUXWluvf6v9qfa9aK3HmdCsLoKpVkBQsbDMX8PCYw=
11
+ =Sv5D
12
+ -----END PGP SIGNATURE-----
@@ -4,10 +4,10 @@ env:
4
4
  - TEST_FULL_COMPILE=1
5
5
  - TEST_CXX=1
6
6
  - TEST_CXX=1 SUDO=1
7
- - TEST_RUBY=1 TEST_RUBY_VERSION=1.8.7
8
- - TEST_RUBY=1 TEST_RUBY_VERSION=1.9.3
9
- - TEST_NGINX=1
10
- - TEST_APACHE2=1
7
+ - TEST_RUBY=1 TEST_RUBY_VERSION=1.8.7 TEST_CLASSIC_RAILS=0
8
+ - TEST_RUBY=1 TEST_RUBY_VERSION=1.9.3 TEST_CLASSIC_RAILS=0
9
+ - TEST_NGINX=1 TEST_RUBYGEMS_VERSION=1.8.25
10
+ - TEST_APACHE2=1 TEST_RUBYGEMS_VERSION=1.8.25
11
11
 
12
12
  before_install:
13
13
  - sudo apt-get install apache2-mpm-worker apache2-threaded-dev
data/NEWS CHANGED
@@ -1,3 +1,49 @@
1
+ Release 4.0.0 release candidate 6
2
+ ---------------------------------
3
+
4
+ * WebSocket support on Nginx. Requires Nginx >= 1.3.15.
5
+ * Improved RVM support.
6
+ * Performance optimizations.
7
+ * Various bug fixes.
8
+
9
+
10
+ Release 4.0.0 release candidate 5
11
+ ---------------------------------
12
+
13
+ * The default config snippet for Apache has changed! It must now contain a
14
+ `PassengerDefaultRuby` option. The installer has been updated to output
15
+ this option. The `PassengerRuby` option still exists, but it's only used
16
+ for configuring different Ruby interpreters in different contexts. Please
17
+ refer to the manual for more information.
18
+ * We now provide GPG digital signatures for all file releases by Phusion.
19
+ More information can be found in the manual.
20
+ * `passenger-status` now displays process memory usage and time when it
21
+ was last used. The latter fixes issue #853.
22
+ * Exceptions in Rack application objects are now caught to prevent
23
+ application processes from exiting.
24
+ * The `passenger-config` tool now supports the `--ruby-command` argument,
25
+ which helps the user with figuring out the correct Ruby command to use
26
+ in case s/he wants to use multiple Ruby interpreters. The manual has
27
+ also been updated to mention this tool.
28
+ * Fixed streaming responses on Apache.
29
+ * Worked around an OS X Unix domain socket bug. Fixes issue #854.
30
+ * Out-of-Band Garbage Collection now works properly when the application
31
+ has disabled garbage collection. Fixes issue #859.
32
+ * Fixed support for /usr/bin/python on OS X. Fixes issue #855.
33
+ * Fixed looping-without-sleeping in the ApplicationPool garbage collector
34
+ if PassengerPoolIdleTime is set to 0. Fixes issue #858.
35
+ * Fixed some process memory usage measurement bugs.
36
+ * Fixed process memory usage measurement on NetBSD. Fixes issue #736.
37
+ * Fixed a file descriptor leak in the Out-of-Band Work feature. Fixes issue #864.
38
+ * The PassengerPreStart helper script now uses the default Ruby
39
+ interpreter specified in the web server configuration, and no longer
40
+ requires a `ruby` command to be in `$PATH`.
41
+ * Updated preferred PCRE version to 8.32.
42
+ * Worked around some RVM bugs.
43
+ * The ngx_http_stub_status_module is now enabled by default.
44
+ * Performance optimizations.
45
+
46
+
1
47
  Release 4.0.0 release candidate 4
2
48
  ---------------------------------
3
49
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  # Phusion Passenger - https://www.phusionpassenger.com/
3
- # Copyright (c) 2010 Phusion
3
+ # Copyright (c) 2010-2013 Phusion
4
4
  #
5
5
  # "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
6
6
  #
@@ -38,6 +38,7 @@ def help
38
38
  puts " --root Show Phusion Passenger's root directory."
39
39
  puts " --nginx-libs Show Nginx runtime library flags."
40
40
  puts " --compiled Check whether runtime libraries are compiled."
41
+ puts " --ruby-command Print the correct command for invoking the Ruby interpreter."
41
42
  puts " --version Show version number."
42
43
  end
43
44
 
@@ -68,6 +69,35 @@ when "--compiled"
68
69
  else
69
70
  exit 1
70
71
  end
72
+ when "--ruby-command"
73
+ require 'phusion_passenger/platform_info/ruby'
74
+ ruby = PhusionPassenger::PlatformInfo.ruby_command
75
+ puts "passenger-config was invoked through the following Ruby interpreter:"
76
+ puts " Command: #{ruby}"
77
+ STDOUT.write " Version: "
78
+ STDOUT.flush
79
+ system("/bin/sh -c '#{ruby} -v'")
80
+ puts " To use in Apache: PassengerRuby #{ruby}"
81
+ puts " To use in Nginx : passenger_ruby #{ruby}"
82
+ puts " To use with Standalone: #{ruby} #{PhusionPassenger.bin_dir}/passenger start"
83
+ puts
84
+
85
+ ruby = PhusionPassenger::PlatformInfo.find_command('ruby')
86
+ if ruby
87
+ puts "The following Ruby interpreter was found first in $PATH:"
88
+ puts " Command: #{ruby}"
89
+ STDOUT.write " Version: "
90
+ STDOUT.flush
91
+ system("/bin/sh -c '#{ruby} -v'")
92
+ puts " To use in Apache: PassengerRuby #{ruby}"
93
+ puts " To use in Nginx : passenger_ruby #{ruby}"
94
+ puts " To use with Standalone: #{ruby} #{PhusionPassenger.bin_dir}/passenger start"
95
+ else
96
+ puts "No Ruby interpreter found in $PATH."
97
+ end
98
+ puts
99
+ puts "## Notes for RVM users"
100
+ puts "Do you want to know which command to use for a different Ruby interpreter? 'rvm use' that Ruby interpreter, then re-run 'passenger-config --ruby-command'."
71
101
  when "--version"
72
102
  puts PhusionPassenger::VERSION_STRING
73
103
  else
@@ -170,7 +170,7 @@ private
170
170
  if bare
171
171
  puts "LoadModule passenger_module #{PhusionPassenger.apache2_module_path}"
172
172
  puts "PassengerRoot #{PhusionPassenger.source_root}"
173
- puts "PassengerRuby #{PlatformInfo.ruby_command}"
173
+ puts "PassengerDefaultRuby #{PlatformInfo.ruby_command}"
174
174
  else
175
175
  puts
176
176
  line
@@ -412,6 +412,7 @@ private
412
412
  command = "sh ./configure --prefix='#{prefix}' "
413
413
  command << "--with-http_ssl_module "
414
414
  command << "--with-http_gzip_static_module "
415
+ command << "--with-http_stub_status_module "
415
416
  command << "--with-cc-opt='-Wno-error' "
416
417
  if @pcre_source_dir
417
418
  command << "--with-pcre='#{@pcre_source_dir}' "
@@ -21,6 +21,7 @@
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/compiler'
24
25
  require 'phusion_passenger/platform_info/cxx_portability'
25
26
 
26
27
  ########## Phusion Passenger common library ##########
@@ -151,6 +152,9 @@ else
151
152
  task :libev # do nothing
152
153
  end
153
154
 
155
+ # Apple Clang 4.2 complains about ambiguous member templates in ev++.h.
156
+ LIBEV_CFLAGS << " -Wno-ambiguous-member-template" if PlatformInfo.compiler_supports_wno_ambiguous_member_template?
157
+
154
158
 
155
159
  ########## libeio ##########
156
160
 
@@ -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
  #
@@ -23,12 +23,33 @@
23
23
 
24
24
  # Rake functions for compiling/linking C++ stuff.
25
25
 
26
+ def run_compiler(*command)
27
+ require 'phusion_passenger/utils/ansi_colors' if !defined?(PhusionPassenger::Utils::AnsiColors)
28
+ show_command = command.join(' ')
29
+ puts show_command
30
+ if !system(*command)
31
+ if $? && $?.exitstatus == 4
32
+ # This probably means the compiler ran out of memory.
33
+ msg = "<b>" +
34
+ "-----------------------------------------------\n" +
35
+ "Your compiler failed with the exit status 4. This " +
36
+ "probably means that it ran out of memory. To solve " +
37
+ "this problem, try increasing your swap space: " +
38
+ "https://www.digitalocean.com/community/articles/how-to-add-swap-on-ubuntu-12-04" +
39
+ "</b>"
40
+ fail(PhusionPassenger::Utils::AnsiColors.ansi_colorize(msg))
41
+ else
42
+ fail "Command failed with status (#{$? ? $?.exitstatus : 1}): [#{show_command}]"
43
+ end
44
+ end
45
+ end
46
+
26
47
  def compile_c(source, flags = "#{EXTRA_PRE_CFLAGS} #{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS}")
27
- sh "#{CC} #{flags} -c #{source}"
48
+ run_compiler "#{CC} #{flags} -c #{source}"
28
49
  end
29
50
 
30
51
  def compile_cxx(source, flags = "#{EXTRA_PRE_CXXFLAGS} #{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS}")
31
- sh "#{CXX} #{flags} -c #{source}"
52
+ run_compiler "#{CXX} #{flags} -c #{source}"
32
53
  end
33
54
 
34
55
  def create_static_library(target, sources)
@@ -44,11 +65,11 @@ def create_static_library(target, sources)
44
65
  end
45
66
 
46
67
  def create_executable(target, sources, linkflags = "#{EXTRA_PRE_CXXFLAGS} #{EXTRA_PRE_LDFLAGS} #{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS} #{PlatformInfo.portability_ldflags} #{EXTRA_LDFLAGS}")
47
- sh "#{CXX} #{sources} -o #{target} #{linkflags}"
68
+ run_compiler "#{CXX} #{sources} -o #{target} #{linkflags}"
48
69
  end
49
70
 
50
71
  def create_c_executable(target, sources, linkflags = "#{EXTRA_PRE_CFLAGS} #{EXTRA_PRE_LDFLAGS} #{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS} #{PlatformInfo.portability_ldflags} #{EXTRA_LDFLAGS}")
51
- sh "#{CC} #{sources} -o #{target} #{linkflags}"
72
+ run_compiler "#{CC} #{sources} -o #{target} #{linkflags}"
52
73
  end
53
74
 
54
75
  def create_shared_library(target, sources, flags = "#{EXTRA_PRE_CXXFLAGS} #{EXTRA_PRE_LDFLAGS} #{PlatformInfo.portability_cflags} #{EXTRA_CXXFLAGS} #{PlatformInfo.portability_ldflags} #{EXTRA_LDFLAGS}")
@@ -57,5 +78,5 @@ def create_shared_library(target, sources, flags = "#{EXTRA_PRE_CXXFLAGS} #{EXTR
57
78
  else
58
79
  shlib_flag = "-shared"
59
80
  end
60
- sh "#{CXX} #{shlib_flag} #{sources} -fPIC -o #{target} #{flags}"
81
+ run_compiler "#{CXX} #{shlib_flag} #{sources} -fPIC -o #{target} #{flags}"
61
82
  end
@@ -220,7 +220,7 @@ task 'test:cxx' => dependencies do
220
220
  command = "valgrind --dsymutil=yes --db-attach=yes --child-silent-after-fork=yes #{command}"
221
221
  end
222
222
  if boolean_option('SUDO')
223
- command = "sudo #{command}"
223
+ command = "#{PlatformInfo.ruby_sudo_command} #{command}"
224
224
  end
225
225
  if boolean_option('REPEAT')
226
226
  if boolean_option('GDB')
@@ -49,8 +49,7 @@ task :sloccount do
49
49
  end
50
50
  end
51
51
 
52
- desc "Convert the NEWS items for the latest release to HTML"
53
- task :news_as_html do
52
+ def extract_latest_news_contents_and_items
54
53
  # The text is in the following format:
55
54
  #
56
55
  # Release x.x.x
@@ -58,21 +57,31 @@ task :news_as_html do
58
57
  #
59
58
  # * Text.
60
59
  # * More text.
61
- # * A header.
60
+ # * A header.
62
61
  # With yet more text.
63
62
  #
64
63
  # Release y.y.y
65
64
  # -------------
66
65
  # .....
67
- require 'cgi'
68
66
  contents = File.read("NEWS")
69
67
 
70
68
  # We're only interested in the latest release, so extract the text for that.
71
69
  contents =~ /\A(Release.*?)^(Release|Older releases)/m
70
+ contents = $1
71
+ contents.sub!(/\A.*?\n-+\n+/m, '')
72
+ contents.sub!(/\n+\Z/, '')
72
73
 
73
74
  # Now split the text into individual items.
74
- items = $1.split(/^ \*/)
75
- items.shift # Delete the 'Release x.x.x' header.
75
+ items = contents.split(/^ \* /)
76
+ items.shift while items.first == ""
77
+
78
+ return [contents, items]
79
+ end
80
+
81
+ desc "Convert the NEWS items for the latest release to HTML"
82
+ task :news_as_html do
83
+ require 'cgi'
84
+ contents, items = extract_latest_news_contents_and_items
76
85
 
77
86
  puts "<dl>"
78
87
  items.each do |item|
@@ -134,6 +143,19 @@ task :news_as_html do
134
143
  puts "</dl>"
135
144
  end
136
145
 
146
+ desc "Convert the NEWS items for the latest release to Markdown"
147
+ task :news_as_markdown do
148
+ contents, items = extract_latest_news_contents_and_items
149
+
150
+ # Auto-link to issue tracker.
151
+ contents.gsub!(/(bug|issue) #(\d+)/i) do
152
+ url = "http://code.google.com/p/phusion-passenger/issues/detail?id=#{$2}"
153
+ %Q([#{$1} ##{$2}](#{url}))
154
+ end
155
+
156
+ puts contents
157
+ end
158
+
137
159
  dependencies = [
138
160
  COMMON_LIBRARY.link_objects,
139
161
  LIBBOOST_OXT,
@@ -23,8 +23,36 @@
23
23
 
24
24
  task :clobber => 'package:clean'
25
25
 
26
- desc "Build the gem and tarball"
27
- task 'package' => ['package:gem', 'package:tarball']
26
+ desc "Build, sign & upload gem & tarball"
27
+ task 'package:release' => ['package:gem', 'package:tarball', 'package:sign'] do
28
+ require 'phusion_passenger'
29
+ basename = "#{PhusionPassenger::PACKAGE_NAME}-#{PhusionPassenger::VERSION_STRING}"
30
+ version = PhusionPassenger::VERSION_STRING
31
+ is_enterprise = basename =~ /enterprise/
32
+ is_open_source = !is_enterprise
33
+ tag_prefix = is_open_source ? 'release' : 'enterprise'
34
+
35
+ sh "git tag -s #{tag_prefix}-#{version} -u 0A212A8C -m 'Release #{version}'"
36
+
37
+ puts "Proceed with pushing tag to remote Git repo and uploading the gem and signatures? [y/n]"
38
+ if STDIN.readline == "y\n"
39
+ sh "git push origin #{tag_prefix}-#{version}"
40
+ if is_open_source
41
+ sh "scp pkg/#{basename}.{gem.asc,tar.gz.asc} app@shell.phusion.nl:/u/apps/signatures/phusion-passenger/"
42
+ sh "./dev/googlecode_upload.py -p phusion-passenger -s 'Phusion Passenger #{version}' pkg/passenger-#{version}.tar.gz"
43
+ sh "gem push pkg/passenger-#{version}.gem"
44
+ puts "--------------"
45
+ puts "All done. Please update the version number in the Phusion Passenger website."
46
+ else
47
+ dir = "/u/apps/passenger_website/shared"
48
+ subdir = string_option('NAME', version)
49
+ sh "scp pkg/#{basename}.{gem,tar.gz,gem.asc,tar.gz.asc} app@shell.phusion.nl:#{dir}/"
50
+ sh "ssh app@shell.phusion.nl 'mkdir -p \"#{dir}/assets/#{subdir}\" && mv #{dir}/#{basename}.{gem,tar.gz,gem.asc,tar.gz.asc} \"#{dir}/assets/#{subdir}/\"'"
51
+ end
52
+ else
53
+ puts "Did not upload anything."
54
+ end
55
+ end
28
56
 
29
57
  task 'package:check' do
30
58
  require 'phusion_passenger'
@@ -35,16 +63,14 @@ task 'package:check' do
35
63
  end
36
64
  end
37
65
 
38
- desc "Build the gem"
39
- task 'package:gem' => [:doc, 'package:check'] do
66
+ task 'package:gem' => Packaging::ASCII_DOCS + ['package:check'] do
40
67
  require 'phusion_passenger'
41
- sh "gem build #{PhusionPassenger::PACKAGE_NAME}.gemspec"
68
+ sh "gem build #{PhusionPassenger::PACKAGE_NAME}.gemspec --sign --key 0x0A212A8C"
42
69
  sh "mkdir -p pkg"
43
70
  sh "mv #{PhusionPassenger::PACKAGE_NAME}-#{PhusionPassenger::VERSION_STRING}.gem pkg/"
44
71
  end
45
72
 
46
- desc "Build the tarball"
47
- task 'package:tarball' => [:doc, 'package:check'] do
73
+ task 'package:tarball' => Packaging::ASCII_DOCS + ['package:check'] do
48
74
  require 'phusion_passenger'
49
75
  require 'fileutils'
50
76
 
@@ -69,11 +95,47 @@ task 'package:tarball' => [:doc, 'package:check'] do
69
95
  sh "rm -rf pkg/#{basename}"
70
96
  end
71
97
 
72
- desc "Remove gem and tarball"
98
+ task 'package:sign' do
99
+ require 'phusion_passenger'
100
+
101
+ if File.exist?(File.expand_path("~/.gnupg/gpg-agent.conf")) || ENV['GPG_AGENT_INFO']
102
+ puts "It looks like you're using gpg-agent, so skipping automatically password caching."
103
+ else
104
+ begin
105
+ require 'highline'
106
+ rescue LoadError
107
+ abort "Please run `gem install highline` first."
108
+ end
109
+ h = HighLine.new
110
+ password = h.ask("Password for software-signing@phusion.nl GPG key: ") { |q| q.echo = false }
111
+ passphrase_opt = "--passphrase-file .gpg-password"
112
+ end
113
+
114
+ begin
115
+ if password
116
+ File.open(".gpg-password", "w", 0600) do |f|
117
+ f.write(password)
118
+ end
119
+ end
120
+ version = PhusionPassenger::VERSION_STRING
121
+ ["passenger-#{version}.gem",
122
+ "passenger-#{version}.tar.gz",
123
+ "passenger-enterprise-server-#{version}.gem",
124
+ "passenger-enterprise-server-#{version}.tar.gz"].each do |name|
125
+ if File.exist?("pkg/#{name}")
126
+ sh "gpg --sign --detach-sign #{passphrase_opt} --local-user software-signing@phusion.nl --armor pkg/#{name}"
127
+ end
128
+ end
129
+ ensure
130
+ File.unlink('.gpg-password') if File.exist?('.gpg-password')
131
+ end
132
+ end
133
+
134
+ desc "Remove gem, tarball and signatures"
73
135
  task 'package:clean' do
74
136
  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"
137
+ basename = "#{PhusionPassenger::PACKAGE_NAME}-#{PhusionPassenger::VERSION_STRING}"
138
+ sh "rm -f pkg/#{basename}.{gem,gem.asc,tar.gz,tar.gz.asc}"
77
139
  end
78
140
 
79
141
  desc "Create a fakeroot, useful for building native packages"
@@ -158,58 +220,3 @@ task 'package:debian' => 'package:check' do
158
220
 
159
221
  sh "debuild"
160
222
  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