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
@@ -0,0 +1,97 @@
1
+ define 'gcc' do
2
+ name "GNU C compiler"
3
+ website "http://gcc.gnu.org/"
4
+ define_checker do
5
+ require 'phusion_passenger/platform_info/compiler'
6
+ check_for_command(PlatformInfo.cc)
7
+ end
8
+
9
+ on :debian do
10
+ apt_get_install "build-essential"
11
+ end
12
+ on :mandriva do
13
+ urpmi "gcc"
14
+ end
15
+ on :redhat do
16
+ yum_install "gcc"
17
+ end
18
+ on :gentoo do
19
+ emerge "gcc"
20
+ end
21
+ on :macosx do
22
+ xcode_install "Command Line Tools"
23
+ end
24
+ end
25
+
26
+ define 'g++' do
27
+ name "GNU C++ compiler"
28
+ website "http://gcc.gnu.org/"
29
+ define_checker do
30
+ require 'phusion_passenger/platform_info/compiler'
31
+ check_for_command(PlatformInfo.cxx)
32
+ end
33
+
34
+ on :debian do
35
+ apt_get_install "build-essential"
36
+ end
37
+ on :mandriva do
38
+ urpmi "gcc-c++"
39
+ end
40
+ on :redhat do
41
+ yum_install "gcc-c++"
42
+ end
43
+ on :gentoo do
44
+ emerge "gcc"
45
+ end
46
+ on :macosx do
47
+ xcode_install "Command Line Tools"
48
+ end
49
+ end
50
+
51
+ define 'make' do
52
+ name "The 'make' tool"
53
+ define_checker do
54
+ require 'phusion_passenger/platform_info/compiler'
55
+ check_for_command(PlatformInfo.make)
56
+ end
57
+
58
+ on :debian do
59
+ apt_get_install "build-essential"
60
+ end
61
+ on :mandriva do
62
+ urpmi "make"
63
+ end
64
+ on :redhat do
65
+ yum_install "make"
66
+ end
67
+ on :macosx do
68
+ xcode_install "Command Line Tools"
69
+ end
70
+ on :other_platforms do
71
+ website "http://www.gnu.org/software/make/"
72
+ end
73
+ end
74
+
75
+ define 'gmake' do
76
+ name "GNU make"
77
+ define_checker do
78
+ require 'phusion_passenger/platform_info/compiler'
79
+ check_for_command(PlatformInfo.gnu_make)
80
+ end
81
+
82
+ on :debian do
83
+ apt_get_install "build-essential"
84
+ end
85
+ on :mandriva do
86
+ urpmi "make"
87
+ end
88
+ on :redhat do
89
+ yum_install "make"
90
+ end
91
+ on :macosx do
92
+ xcode_install "Command Line Tools"
93
+ end
94
+ on :other_platforms do
95
+ website "http://www.gnu.org/software/make/"
96
+ end
97
+ end
@@ -0,0 +1,39 @@
1
+ define 'fastthread' do
2
+ name 'fastthread'
3
+ define_checker do
4
+ check_for_ruby_library('fastthread')
5
+ end
6
+ gem_install 'fastthread'
7
+ end
8
+
9
+ define 'rack' do
10
+ name 'rack'
11
+ define_checker do
12
+ check_for_ruby_library('rack')
13
+ end
14
+ gem_install 'rack'
15
+ end
16
+
17
+ define 'daemon_controller >= 1.1.0' do
18
+ name 'daemon_controller >= 1.1.0'
19
+ define_checker do
20
+ if check_for_ruby_library('daemon_controller')
21
+ gem_command = PlatformInfo.gem_command || "gem"
22
+ begin
23
+ require 'daemon_controller/version'
24
+ {
25
+ :found => DaemonController::VERSION_STRING >= '1.1.0',
26
+ "Installed version" => DaemonController::VERSION_STRING
27
+ }
28
+ rescue LoadError
29
+ {
30
+ :found => false,
31
+ "Installed version" => "way too old"
32
+ }
33
+ end
34
+ else
35
+ false
36
+ end
37
+ end
38
+ gem_install 'daemon_controller'
39
+ end
@@ -0,0 +1,118 @@
1
+ define 'openssl-dev' do
2
+ name "OpenSSL development headers"
3
+ website "http://www.openssl.org/"
4
+ define_checker do
5
+ check_for_header('openssl/ssl.h')
6
+ end
7
+
8
+ on :debian do
9
+ apt_get_install "libssl-dev"
10
+ end
11
+ on :redhat do
12
+ yum_install "openssl-devel"
13
+ end
14
+ end
15
+
16
+ define 'libcurl-dev' do
17
+ name "Curl development headers with SSL support"
18
+ website "http://curl.haxx.se/libcurl"
19
+ define_checker do
20
+ require 'phusion_passenger/platform_info/curl'
21
+ result = { :found => false }
22
+
23
+ if !(curl_config = PlatformInfo.find_command('curl-config'))
24
+ result[:error] = "Cannot find the `curl-config` command."
25
+ next result
26
+ else
27
+ result["curl-config location"] = curl_config
28
+ end
29
+
30
+ if !(header = PlatformInfo.find_header("curl/curl.h", :c, PlatformInfo.curl_flags))
31
+ result[:error] = "Cannot find the curl/curl.h header file."
32
+ next result
33
+ else
34
+ result[:found] = true
35
+ result["Header location"] = header == true ? "somewhere, not sure where" : header
36
+ end
37
+
38
+ begin
39
+ result["Version"] = `#{curl_config} --version`.strip
40
+ rescue SystemCallError => e
41
+ result[:error] = "Cannot run `curl-config --version`: #{e}"
42
+ next result
43
+ end
44
+
45
+ source = %Q{
46
+ #include <curl/curl.h>
47
+ int main() {
48
+ curl_global_init(CURL_GLOBAL_ALL);
49
+ return 0;
50
+ }
51
+ }
52
+ ret = PlatformInfo.try_compile_and_run("Checking for libcurl usability", :c, source,
53
+ "#{PlatformInfo.curl_flags} #{PlatformInfo.curl_libs}")
54
+ result["Usable"] = ret ? "yes" : "no"
55
+ if !ret
56
+ result[:error] = "libcurl was found, but it isn't usable. Set VERBOSE=1 to see why."
57
+ next result
58
+ end
59
+
60
+ result["Supports SSL"] = PlatformInfo.curl_supports_ssl? ? "yes" : "no"
61
+ if !PlatformInfo.curl_supports_ssl?
62
+ result[:error] = "libcurl was found, but it doesn't support SSL. Please reinstall it with SSL support."
63
+ next result
64
+ end
65
+
66
+ result
67
+ end
68
+
69
+ install_instructions "Please download Curl from <b>#{website}</b> " +
70
+ "and make sure you install it <b>with SSL support</b>."
71
+ on :debian do
72
+ install_instructions "Please run " +
73
+ "<b>apt-get install libcurl4-openssl-dev</b> " +
74
+ "or <b>libcurl4-gnutls-dev</b>, whichever you prefer."
75
+ end
76
+ on :redhat do
77
+ release = PlatformInfo.read_file("/etc/redhat-release")
78
+ if release =~ /release 4/
79
+ # http://code.google.com/p/phusion-passenger/issues/detail?id=554
80
+ yum_install "curl-devel zlib-devel e2fsprogs-devel krb5-devel libidn-devel"
81
+ else
82
+ yum_install "curl-devel"
83
+ end
84
+ end
85
+ end
86
+
87
+ define 'zlib-dev' do
88
+ name "Zlib development headers"
89
+ website "http://www.zlib.net/"
90
+ define_checker do
91
+ check_for_header('zlib.h')
92
+ end
93
+
94
+ on :debian do
95
+ apt_get_install "zlib1g-dev"
96
+ end
97
+ on :mandriva do
98
+ urpmi "zlib1-devel"
99
+ end
100
+ on :redhat do
101
+ yum_install "zlib-devel"
102
+ end
103
+ end
104
+
105
+ define 'pcre-dev' do
106
+ name "PCRE development headers"
107
+ website "http://www.pcre.org/"
108
+ define_checker do
109
+ check_for_header('pcre.h')
110
+ end
111
+
112
+ on :debian do
113
+ apt_get_install "libpcre3-dev"
114
+ end
115
+ on :redhat do
116
+ yum_install 'pcre-devel'
117
+ end
118
+ end
@@ -0,0 +1,137 @@
1
+ define 'ruby-dev' do
2
+ name "Ruby development headers"
3
+ website "http://www.ruby-lang.org/"
4
+ define_checker do
5
+ require 'rbconfig'
6
+ begin
7
+ require 'mkmf'
8
+ rb_config = PlatformInfo.rb_config
9
+ header_dir = rb_config['rubyhdrdir'] || rb_config['archdir']
10
+ filename = "#{header_dir}/ruby.h"
11
+ if File.exist?(filename)
12
+ { :found => true, "Location" => filename }
13
+ else
14
+ false
15
+ end
16
+ rescue LoadError, SystemExit
17
+ # On RedHat/Fedora/CentOS, if ruby-devel is not installed then
18
+ # mkmf.rb will print an error and call 'exit'. So here we
19
+ # catch SystemExit as well.
20
+ false
21
+ rescue NotImplementedError
22
+ # JRuby raises this.
23
+ false
24
+ end
25
+ end
26
+
27
+ if ruby_command =~ %r(^/usr/bin/ruby)
28
+ # Only tell user to install the headers with the system's package manager
29
+ # if Ruby itself was installed with the package manager.
30
+ on :debian do
31
+ apt_get_install "ruby-dev"
32
+ end
33
+ on :mandriva do
34
+ urpmi "ruby-devel"
35
+ end
36
+ on :redhat do
37
+ yum_install "ruby-devel"
38
+ end
39
+ end
40
+ on :other_platforms do
41
+ install_instructions "Please (re)install Ruby by downloading it from <b>#{website}</b>"
42
+ end
43
+ end
44
+
45
+ define 'ruby-openssl' do
46
+ name "OpenSSL support for Ruby"
47
+ if RUBY_PLATFORM =~ /java/
48
+ website "http://jruby.org/openssl"
49
+ install_instructions "Please install OpenSSL support for JRuby: #{website}"
50
+ else
51
+ website "http://www.ruby-lang.org/"
52
+ install_instructions "Please (re)install Ruby with OpenSSL support."
53
+ end
54
+ define_checker do
55
+ begin
56
+ require 'openssl'
57
+ { :found => true }
58
+ rescue LoadError
59
+ false
60
+ end
61
+ end
62
+
63
+ if ruby_command =~ %r(^/usr/bin/ruby)
64
+ # Only tell user to install ruby-openssl with the system's package manager
65
+ # if Ruby itself was installed with the package manager.
66
+ on :debian do
67
+ apt_get_install "libopenssl-ruby"
68
+ end
69
+ end
70
+ end
71
+
72
+ define 'rubygems' do
73
+ name "RubyGems"
74
+ website "http://rubyforge.org/frs/?group_id=126"
75
+ define_checker do
76
+ begin
77
+ require 'rubygems'
78
+ { :found => true }
79
+ rescue LoadError
80
+ false
81
+ end
82
+ end
83
+
84
+ install_instructions "Please download it from <b>#{website}</b>. " +
85
+ "Extract the tarball, and run <b>ruby setup.rb</b>"
86
+ if ruby_command =~ %r(^/usr/bin/ruby)
87
+ # Only tell user to install RubyGems with the system's package manager
88
+ # if Ruby itself was installed with the package manager.
89
+ #
90
+ # Older versions of Debian have totally messed up RubyGems by patching it to install binaries
91
+ # to /var/lib/gems/bin instead of /usr/bin or even /usr/local/bin. That
92
+ # wouldn't be so much of a problem were it not for the fact that
93
+ # /var/lib/gems/bin is not in $PATH by default, so on a regular basis people
94
+ # ask various Ruby/Rails support forums why they get a 'foo: command not found'
95
+ # after typing 'gem install foo'.
96
+ #
97
+ # Luckily newer Debian versions fixed this problem.
98
+ on :debian do
99
+ apt_get_install "rubygems"
100
+ end
101
+ end
102
+ end
103
+
104
+ # The 'rake' spec looks for a Rake instance that's installed for the same
105
+ # Ruby interpreter as the one that's currently running.
106
+ # For example if you're running this 'rake.rb' file with Ruby 1.8, then
107
+ # this checker will not find Ruby 1.9's Rake or JRuby's Rake.
108
+ define 'rake' do
109
+ name "Rake (associated with #{ruby_command})"
110
+ website "http://rake.rubyforge.org/"
111
+ define_checker do
112
+ require 'phusion_passenger/platform_info/ruby'
113
+ if result = PlatformInfo.rake_command
114
+ { :found => true,
115
+ "Location" => result }
116
+ else
117
+ false
118
+ end
119
+ end
120
+
121
+ if ruby_command =~ %r(^/usr/bin/ruby)
122
+ # Only tell user to install Rake with the system's package manager
123
+ # if Ruby itself was installed with the package manager.
124
+ on :debian do
125
+ apt_get_install "rake"
126
+ end
127
+ on :mandriva do
128
+ urpmi "rake"
129
+ end
130
+ on :redhat do
131
+ yum_install "rake"
132
+ end
133
+ end
134
+ on :other_platforms do
135
+ gem_install "rake"
136
+ end
137
+ end
@@ -0,0 +1,15 @@
1
+ define 'download-tool' do
2
+ name "A download tool like 'wget' or 'curl'"
3
+ define_checker do
4
+ check_for_command('wget') || check_for_command('curl')
5
+ end
6
+ on :debian do
7
+ apt_get_install "wget curl"
8
+ end
9
+ on :redhat do
10
+ yum_install "wget curl"
11
+ end
12
+ on :other_platforms do
13
+ install_instructions "Please install either wget (http://www.gnu.org/software/wget/) or curl (http://curl.haxx.se/)."
14
+ end
15
+ 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
  #
@@ -97,8 +97,9 @@ module PlatformInfo
97
97
  else
98
98
  arch = `uname -p`.strip
99
99
  # On some systems 'uname -p' returns something like
100
- # 'Intel(R) Pentium(R) M processor 1400MHz'.
101
- if arch == "unknown" || arch =~ / /
100
+ # 'Intel(R) Pentium(R) M processor 1400MHz' or
101
+ # 'Intel(R)_Xeon(R)_CPU___________X7460__@_2.66GHz'.
102
+ if arch == "unknown" || arch =~ / / || arch =~ /Hz$/
102
103
  arch = `uname -m`.strip
103
104
  end
104
105
  if arch =~ /^i.86$/
@@ -129,7 +130,7 @@ module PlatformInfo
129
130
  def self.supports_sfence_instruction?
130
131
  arch = cpu_architectures[0]
131
132
  return arch == "x86_64" || (arch == "x86" &&
132
- try_compile_and_run(:c, %Q{
133
+ try_compile_and_run("Checking for sfence instruction support", :c, %Q{
133
134
  int
134
135
  main() {
135
136
  __asm__ __volatile__ ("sfence" ::: "memory");
@@ -144,7 +145,7 @@ module PlatformInfo
144
145
  def self.supports_lfence_instruction?
145
146
  arch = cpu_architectures[0]
146
147
  return arch == "x86_64" || (arch == "x86" &&
147
- try_compile_and_run(:c, %Q{
148
+ try_compile_and_run("Checking for lfence instruction support", :c, %Q{
148
149
  int
149
150
  main() {
150
151
  __asm__ __volatile__ ("lfence" ::: "memory");
@@ -48,29 +48,30 @@ module PlatformInfo
48
48
  def self.ruby_command
49
49
  if in_rvm?
50
50
  name = rvm_ruby_string
51
- dir = rvm_path
52
- if name && dir
53
- filename = "#{dir}/wrappers/#{name}/ruby"
54
- if File.exist?(filename)
55
- contents = File.open(filename, 'rb') do |f|
56
- f.read
57
- end
58
- # Old wrapper scripts reference $HOME which causes
59
- # things to blow up when run by a different user.
60
- if contents.include?("$HOME")
51
+ dirs = rvm_paths
52
+ if name && dirs
53
+ dirs.each do |dir|
54
+ filename = "#{dir}/wrappers/#{name}/ruby"
55
+ if File.exist?(filename)
56
+ contents = File.open(filename, 'rb') do |f|
57
+ f.read
58
+ end
59
+ # Old wrapper scripts reference $HOME which causes
60
+ # things to blow up when run by a different user.
61
+ if contents.include?("$HOME")
62
+ filename = nil
63
+ end
64
+ else
61
65
  filename = nil
62
66
  end
63
- else
64
- filename = nil
65
- end
66
- if filename
67
- return filename
68
- else
69
- STDERR.puts "Your RVM wrapper scripts are too old. Please " +
70
- "update them first by running 'rvm get head && " +
71
- "rvm reload && rvm repair all'."
72
- exit 1
67
+ if filename
68
+ return filename
69
+ end
73
70
  end
71
+ STDERR.puts "Your RVM wrapper scripts are too old. Please " +
72
+ "update them first by running 'rvm get head && " +
73
+ "rvm reload && rvm repair all'."
74
+ exit 1
74
75
  else
75
76
  # Something's wrong with the user's RVM installation.
76
77
  # Raise an error so that the user knows this instead of
@@ -156,29 +157,39 @@ module PlatformInfo
156
157
  return bindir.include?('/.rvm/') || bindir.include?('/rvm/')
157
158
  end
158
159
 
159
- # If the current Ruby interpreter is managed by RVM, returns the
160
- # directory in which RVM places its working files. Otherwise returns
161
- # nil.
162
- def self.rvm_path
160
+ # If the current Ruby interpreter is managed by RVM, returns all
161
+ # directories in which RVM places its working files. This is usually
162
+ # ~/.rvm or /usr/local/rvm, but in mixed-mode installations there
163
+ # can be multiple such paths.
164
+ #
165
+ # Otherwise returns nil.
166
+ def self.rvm_paths
163
167
  if in_rvm?
168
+ result = []
164
169
  [ENV['rvm_path'], "~/.rvm", "/usr/local/rvm"].each do |path|
165
170
  next if path.nil?
166
171
  path = File.expand_path(path)
167
- script_path = File.join(path, 'scripts', 'rvm')
168
- return path if File.directory?(path) && File.exist?(script_path)
172
+ rubies_path = File.join(path, 'rubies')
173
+ if File.directory?(path) && File.directory?(rubies_path)
174
+ result << path
175
+ end
176
+ end
177
+ if result.empty?
178
+ # Failure to locate the RVM path is probably caused by the
179
+ # user customizing $rvm_path. Older RVM versions don't
180
+ # export $rvm_path, making us unable to detect its value.
181
+ STDERR.puts "Unable to locate the RVM path. Your RVM installation " +
182
+ "is probably too old. Please update it with " +
183
+ "'rvm get head && rvm reload && rvm repair all'."
184
+ exit 1
185
+ else
186
+ return result
169
187
  end
170
- # Failure to locate the RVM path is probably caused by the
171
- # user customizing $rvm_path. Older RVM versions don't
172
- # export $rvm_path, making us unable to detect its value.
173
- STDERR.puts "Unable to locate the RVM path. Your RVM installation " +
174
- "is probably too old. Please update it with " +
175
- "'rvm get head && rvm reload && rvm repair all'."
176
- exit 1
177
188
  else
178
189
  return nil
179
190
  end
180
191
  end
181
- memoize :rvm_path
192
+ memoize :rvm_paths
182
193
 
183
194
  # If the current Ruby interpreter is managed by RVM, returns the
184
195
  # RVM name which identifies the current Ruby interpreter plus the