passenger 4.0.30 → 4.0.31
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.
- data.tar.gz.asc +7 -7
- data/NEWS +31 -0
- data/bin/passenger +5 -5
- data/bin/passenger-config +6 -126
- data/bin/passenger-install-apache2-module +108 -26
- data/bin/passenger-install-nginx-module +81 -27
- data/bin/passenger-memory-stats +7 -6
- data/bin/passenger-status +13 -10
- data/build/agents.rb +8 -12
- data/build/apache2.rb +12 -7
- data/build/basics.rb +28 -20
- data/build/common_library.rb +4 -4
- data/build/cplusplus_support.rb +4 -4
- data/build/cxx_tests.rb +5 -3
- data/build/debian.rb +1 -2
- data/build/integration_tests.rb +25 -9
- data/build/misc.rb +2 -2
- data/build/oxt_tests.rb +5 -6
- data/build/packaging.rb +72 -40
- data/build/ruby_tests.rb +5 -1
- data/build/test_basics.rb +1 -2
- data/debian.template/locations.ini.template +1 -0
- data/debian.template/rules.template +2 -1
- data/dev/install_scripts_bootstrap_code.rb +42 -0
- data/dev/run_travis.sh +1 -0
- data/dev/runner +27 -0
- data/doc/Packaging.txt.md +5 -10
- data/doc/Users guide Apache.idmap.txt +3 -1
- data/doc/Users guide Apache.txt +5 -3
- data/doc/Users guide Nginx.idmap.txt +9 -5
- data/doc/Users guide Nginx.txt +47 -17
- data/doc/users_guide_snippets/environment_variables.txt +2 -2
- data/doc/users_guide_snippets/installation.txt +6 -2
- data/doc/users_guide_snippets/tips.txt +4 -0
- data/ext/apache2/Hooks.cpp +16 -3
- data/ext/common/Account.h +6 -5
- data/ext/common/AgentsStarter.h +1 -1
- data/ext/common/ApplicationPool2/Common.h +72 -0
- data/ext/common/ApplicationPool2/Group.h +263 -148
- data/ext/common/ApplicationPool2/Implementation.cpp +66 -44
- data/ext/common/ApplicationPool2/Options.h +1 -7
- data/ext/common/ApplicationPool2/Pool.h +96 -72
- data/ext/common/ApplicationPool2/Process.h +12 -17
- data/ext/common/ApplicationPool2/Socket.h +4 -4
- data/ext/common/ApplicationPool2/SuperGroup.h +20 -17
- data/ext/common/Constants.h +15 -1
- data/ext/common/MessageServer.h +22 -0
- data/ext/common/Utils.cpp +4 -1
- data/ext/common/Utils.h +3 -1
- data/ext/common/Utils/StrIntUtils.h +1 -0
- data/ext/common/Utils/Timer.h +15 -1
- data/ext/common/Utils/utf8/checked.h +0 -0
- data/ext/common/Utils/utf8/core.h +0 -0
- data/ext/common/Utils/utf8/unchecked.h +0 -0
- data/ext/common/agents/Base.cpp +59 -35
- data/ext/common/agents/HelperAgent/Main.cpp +23 -12
- data/ext/common/agents/HelperAgent/RequestHandler.h +10 -1
- data/ext/common/agents/LoggingAgent/FilterSupport.h +9 -5
- data/ext/common/agents/TempDirToucher.c +12 -3
- data/ext/common/agents/Watchdog/Main.cpp +8 -2
- data/ext/nginx/ConfigurationCommands.c +10 -0
- data/ext/nginx/ConfigurationFields.h +2 -0
- data/ext/nginx/ContentHandler.c +32 -19
- data/ext/nginx/CreateLocationConfig.c +5 -0
- data/ext/nginx/MergeLocationConfig.c +6 -0
- data/ext/nginx/config +13 -6
- data/ext/ruby/passenger_native_support.c +61 -2
- data/helper-scripts/classic-rails-loader.rb +9 -10
- data/helper-scripts/classic-rails-preloader.rb +10 -11
- data/helper-scripts/node-loader.js +3 -2
- data/helper-scripts/rack-loader.rb +8 -9
- data/helper-scripts/rack-preloader.rb +9 -10
- data/lib/phusion_passenger.rb +36 -7
- data/lib/phusion_passenger/abstract_installer.rb +16 -15
- data/lib/phusion_passenger/active_support3_extensions/init.rb +1 -1
- data/lib/phusion_passenger/admin_tools/memory_stats.rb +2 -2
- data/lib/phusion_passenger/admin_tools/server_instance.rb +5 -5
- data/lib/phusion_passenger/analytics_logger.rb +3 -3
- data/lib/phusion_passenger/classic_rails/thread_handler_extension.rb +1 -1
- data/lib/phusion_passenger/config.rb +125 -0
- data/lib/phusion_passenger/config/about_command.rb +183 -0
- data/lib/phusion_passenger/config/command.rb +57 -0
- data/lib/phusion_passenger/config/restart_app_command.rb +146 -0
- data/lib/phusion_passenger/config/utils.rb +108 -0
- data/lib/phusion_passenger/console_text_template.rb +2 -1
- data/lib/phusion_passenger/constants.rb +7 -2
- data/lib/phusion_passenger/loader_shared_helpers.rb +12 -21
- data/lib/phusion_passenger/message_client.rb +15 -4
- data/lib/phusion_passenger/native_support.rb +116 -98
- data/lib/phusion_passenger/nginx/config_options.rb +5 -0
- data/lib/phusion_passenger/platform_info.rb +1 -1
- data/lib/phusion_passenger/platform_info/apache.rb +9 -5
- data/lib/phusion_passenger/platform_info/apache_detector.rb +5 -6
- data/lib/phusion_passenger/platform_info/binary_compatibility.rb +3 -3
- data/lib/phusion_passenger/platform_info/compiler.rb +29 -11
- data/lib/phusion_passenger/platform_info/curl.rb +1 -1
- data/lib/phusion_passenger/platform_info/cxx_portability.rb +30 -16
- data/lib/phusion_passenger/platform_info/depcheck.rb +6 -6
- data/lib/phusion_passenger/platform_info/linux.rb +2 -2
- data/lib/phusion_passenger/platform_info/operating_system.rb +25 -5
- data/lib/phusion_passenger/platform_info/ruby.rb +7 -4
- data/lib/phusion_passenger/platform_info/zlib.rb +1 -1
- data/lib/phusion_passenger/plugin.rb +0 -1
- data/lib/phusion_passenger/preloader_shared_helpers.rb +1 -1
- data/lib/phusion_passenger/public_api.rb +1 -1
- data/lib/phusion_passenger/rack/thread_handler_extension.rb +1 -1
- data/lib/phusion_passenger/request_handler.rb +8 -9
- data/lib/phusion_passenger/request_handler/thread_handler.rb +21 -9
- data/lib/phusion_passenger/ruby_core_enhancements.rb +1 -1
- data/lib/phusion_passenger/standalone/app_finder.rb +2 -2
- data/lib/phusion_passenger/standalone/command.rb +10 -8
- data/lib/phusion_passenger/standalone/help_command.rb +1 -1
- data/lib/phusion_passenger/standalone/main.rb +3 -3
- data/lib/phusion_passenger/standalone/package_runtime_command.rb +2 -2
- data/lib/phusion_passenger/standalone/runtime_installer.rb +55 -13
- data/lib/phusion_passenger/standalone/runtime_locator.rb +3 -3
- data/lib/phusion_passenger/standalone/start_command.rb +6 -7
- data/lib/phusion_passenger/standalone/status_command.rb +1 -1
- data/lib/phusion_passenger/standalone/stop_command.rb +1 -1
- data/lib/phusion_passenger/standalone/utils.rb +1 -1
- data/lib/phusion_passenger/standalone/version_command.rb +2 -3
- data/lib/phusion_passenger/utils.rb +1 -1
- data/lib/phusion_passenger/utils/download.rb +1 -2
- data/lib/phusion_passenger/utils/file_system_watcher.rb +1 -1
- data/lib/phusion_passenger/utils/hosts_file_parser.rb +1 -1
- data/lib/phusion_passenger/utils/tee_input.rb +1 -1
- data/lib/phusion_passenger/utils/terminal_choice_menu.rb +217 -0
- data/lib/phusion_passenger/utils/unseekable_socket.rb +1 -1
- data/resources/templates/apache2/config_snippets.txt.erb +2 -3
- data/resources/templates/apache2/deployment_example.txt.erb +2 -2
- data/resources/templates/apache2/notify_apache_module_installed.txt.erb +3 -0
- data/resources/templates/nginx/config_snippets.txt.erb +1 -1
- data/resources/templates/nginx/deployment_example.txt.erb +2 -2
- data/resources/templates/nginx/nginx_module_sources_not_available.txt.erb +11 -5
- data/rpm/Vagrantfile +1 -0
- data/test/cxx/ApplicationPool2/PoolTest.cpp +224 -35
- data/test/cxx/ApplicationPool2/ProcessTest.cpp +6 -6
- data/test/cxx/MessagePassingTest.cpp +1 -1
- data/test/cxx/RequestHandlerTest.cpp +26 -26
- data/test/integration_tests/apache2_tests.rb +162 -243
- data/test/integration_tests/native_packaging_spec.rb +10 -10
- data/test/integration_tests/nginx_tests.rb +87 -107
- data/test/integration_tests/shared/example_webapp_tests.rb +246 -0
- data/test/integration_tests/source_packaging_test.rb +2 -1
- data/test/integration_tests/standalone_tests.rb +34 -19
- data/test/ruby/admin_tools_spec.rb +4 -4
- data/test/ruby/analytics_logger_spec.rb +1 -1
- data/test/ruby/debug_logging_spec.rb +2 -2
- data/test/ruby/message_channel_spec.rb +1 -1
- data/test/ruby/request_handler_spec.rb +171 -64
- data/test/ruby/shared/loader_sharedspec.rb +5 -5
- data/test/ruby/shared/rails/analytics_logging_extensions_sharedspec.rb +2 -2
- data/test/ruby/spec_helper.rb +4 -4
- data/test/ruby/standalone/runtime_installer_spec.rb +1 -1
- data/test/ruby/standalone/runtime_locator_spec.rb +1 -1
- data/test/ruby/utils/file_system_watcher_spec.rb +1 -1
- data/test/ruby/utils/hosts_file_parser.rb +1 -1
- data/test/ruby/utils/unseekable_socket_spec.rb +1 -1
- data/test/ruby/utils_spec.rb +4 -4
- data/test/stub/apache2/httpd.conf.erb +5 -0
- data/test/stub/index.html +1 -0
- data/test/stub/rack/config.ru +80 -33
- data/test/stub/{rails_apps/1.2/empty/app/models → rack/public}/.gitignore +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/Rakefile +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/application_controller.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/recipes_controller.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/uploads_controller.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/controllers/welcome_controller.rb +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/app/helpers/application_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/recipes_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/test_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/uploads_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/helpers/welcome_helper.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/layouts/default.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/create.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/index.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/recipes/new.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/uploads/index.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/uploads/new.html.erb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/welcome/cached.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/app/views/welcome/index.rhtml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/boot.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/database.yml +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/environment.rb +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/environments/development.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/environments/production.rb +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/initializers/inflections.rb +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/config/initializers/mime_types.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/config/routes.rb +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/log/useless.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/.htaccess +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/404.html +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/422.html +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/500.html +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.cgi +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.fcgi +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/dispatch.rb +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/favicon.ico +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/angrywizard.gif +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/cookbook.gif +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/images/header.png +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/public/images/rails.png +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/public/robots.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/uploads.html +0 -0
- data/test/stub/{rails_apps/1.2/empty/db → rails2.3-mycook/public/uploads}/.gitignore +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/public/welcome/cached.html +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/about +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/console +0 -0
- data/test/stub/{rails_apps/2.2/empty → rails2.3-mycook}/script/dbconsole +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/destroy +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/generate +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/performance/benchmarker +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/performance/profiler +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/performance/request +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/plugin +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/inspector +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/reaper +0 -0
- data/test/stub/{rails_apps/1.2/empty → rails2.3-mycook}/script/process/spawner +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/runner +0 -0
- data/test/stub/{rails_apps/2.0/empty → rails2.3-mycook}/script/server +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/sites/some.site/public/uploads.html +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/sites/some.site/public/welcome/cached.html +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/cache/useless.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/pids/useless.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/sessions/useless.txt +0 -0
- data/test/stub/{rails_apps/2.3/mycook → rails2.3-mycook}/tmp/sockets/useless.txt +0 -0
- data/test/stub/rails2.3/app/controllers/foo_controller.rb +1 -1
- data/test/stub/rails2.3/config/routes.rb +1 -2
- data/test/stub/wsgi/passenger_wsgi.py +47 -8
- data/test/stub/{rails_apps/1.2/empty/public/stylesheets → wsgi/public}/.gitignore +0 -0
- data/test/support/apache2_controller.rb +2 -2
- data/test/support/nginx_controller.rb +11 -5
- data/test/support/placebo-preloader.rb +2 -2
- data/test/support/test_helper.rb +26 -7
- metadata +78 -240
- metadata.gz.asc +7 -7
- data/debian.template/repack.sh +0 -42
- data/debian.template/watch +0 -3
- data/test/integration_tests/cgi_environment_spec.rb +0 -36
- data/test/integration_tests/hello_world_rack_spec.rb +0 -43
- data/test/integration_tests/hello_world_wsgi_spec.rb +0 -41
- data/test/integration_tests/mycook_spec.rb +0 -166
- data/test/stub/rack/public/rack.jpg +0 -0
- data/test/stub/rails_apps/1.2/empty/.gitignore +0 -3
- data/test/stub/rails_apps/1.2/empty/app/controllers/application.rb +0 -7
- data/test/stub/rails_apps/1.2/empty/config/boot.rb +0 -108
- data/test/stub/rails_apps/1.2/empty/config/database.yml +0 -31
- data/test/stub/rails_apps/1.2/empty/config/environment.rb +0 -66
- data/test/stub/rails_apps/1.2/empty/config/environments/development.rb +0 -21
- data/test/stub/rails_apps/1.2/empty/config/environments/production.rb +0 -18
- data/test/stub/rails_apps/1.2/empty/config/environments/staging.rb +0 -18
- data/test/stub/rails_apps/1.2/empty/config/environments/test.rb +0 -19
- data/test/stub/rails_apps/1.2/empty/config/routes.rb +0 -23
- data/test/stub/rails_apps/1.2/empty/doc/README_FOR_APP +0 -2
- data/test/stub/rails_apps/1.2/empty/public/.htaccess +0 -40
- data/test/stub/rails_apps/1.2/empty/public/500.html +0 -30
- data/test/stub/rails_apps/1.2/empty/public/dispatch.cgi +0 -10
- data/test/stub/rails_apps/1.2/empty/public/dispatch.fcgi +0 -24
- data/test/stub/rails_apps/1.2/empty/public/dispatch.rb +0 -10
- data/test/stub/rails_apps/1.2/empty/public/robots.txt +0 -1
- data/test/stub/rails_apps/1.2/empty/script/about +0 -3
- data/test/stub/rails_apps/1.2/empty/script/breakpointer +0 -3
- data/test/stub/rails_apps/1.2/empty/script/console +0 -3
- data/test/stub/rails_apps/1.2/empty/script/destroy +0 -3
- data/test/stub/rails_apps/1.2/empty/script/generate +0 -3
- data/test/stub/rails_apps/1.2/empty/script/plugin +0 -3
- data/test/stub/rails_apps/1.2/empty/script/runner +0 -3
- data/test/stub/rails_apps/1.2/empty/script/server +0 -3
- data/test/stub/rails_apps/1.2/empty/test/test_helper.rb +0 -28
- data/test/stub/rails_apps/2.0/empty/.gitignore +0 -3
- data/test/stub/rails_apps/2.0/empty/Rakefile +0 -10
- data/test/stub/rails_apps/2.0/empty/app/controllers/application.rb +0 -10
- data/test/stub/rails_apps/2.0/empty/app/helpers/application_helper.rb +0 -3
- data/test/stub/rails_apps/2.0/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/config/boot.rb +0 -108
- data/test/stub/rails_apps/2.0/empty/config/database.yml +0 -31
- data/test/stub/rails_apps/2.0/empty/config/environment.rb +0 -59
- data/test/stub/rails_apps/2.0/empty/config/environments/production.rb +0 -18
- data/test/stub/rails_apps/2.0/empty/config/environments/staging.rb +0 -18
- data/test/stub/rails_apps/2.0/empty/config/environments/test.rb +0 -22
- data/test/stub/rails_apps/2.0/empty/config/routes.rb +0 -35
- data/test/stub/rails_apps/2.0/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/doc/README_FOR_APP +0 -2
- data/test/stub/rails_apps/2.0/empty/public/.htaccess +0 -40
- data/test/stub/rails_apps/2.0/empty/public/404.html +0 -30
- data/test/stub/rails_apps/2.0/empty/public/dispatch.cgi +0 -10
- data/test/stub/rails_apps/2.0/empty/public/dispatch.fcgi +0 -24
- data/test/stub/rails_apps/2.0/empty/public/dispatch.rb +0 -10
- data/test/stub/rails_apps/2.0/empty/public/favicon.ico +0 -0
- data/test/stub/rails_apps/2.0/empty/public/images/rails.png +0 -0
- data/test/stub/rails_apps/2.0/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/script/performance/benchmarker +0 -3
- data/test/stub/rails_apps/2.0/empty/script/performance/profiler +0 -3
- data/test/stub/rails_apps/2.0/empty/script/process/inspector +0 -3
- data/test/stub/rails_apps/2.0/empty/script/process/reaper +0 -3
- data/test/stub/rails_apps/2.0/empty/script/process/spawner +0 -3
- data/test/stub/rails_apps/2.0/empty/test/test_helper.rb +0 -38
- data/test/stub/rails_apps/2.2/empty/.gitignore +0 -3
- data/test/stub/rails_apps/2.2/empty/Rakefile +0 -10
- data/test/stub/rails_apps/2.2/empty/app/controllers/application.rb +0 -15
- data/test/stub/rails_apps/2.2/empty/app/helpers/application_helper.rb +0 -3
- data/test/stub/rails_apps/2.2/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/config/boot.rb +0 -109
- data/test/stub/rails_apps/2.2/empty/config/database.yml +0 -31
- data/test/stub/rails_apps/2.2/empty/config/environment.rb +0 -75
- data/test/stub/rails_apps/2.2/empty/config/environments/development.rb +0 -17
- data/test/stub/rails_apps/2.2/empty/config/environments/production.rb +0 -24
- data/test/stub/rails_apps/2.2/empty/config/environments/staging.rb +0 -24
- data/test/stub/rails_apps/2.2/empty/config/environments/test.rb +0 -22
- data/test/stub/rails_apps/2.2/empty/config/initializers/inflections.rb +0 -10
- data/test/stub/rails_apps/2.2/empty/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails_apps/2.2/empty/config/initializers/new_rails_defaults.rb +0 -17
- data/test/stub/rails_apps/2.2/empty/config/locales/en.yml +0 -5
- data/test/stub/rails_apps/2.2/empty/config/routes.rb +0 -43
- data/test/stub/rails_apps/2.2/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/doc/README_FOR_APP +0 -5
- data/test/stub/rails_apps/2.2/empty/public/404.html +0 -30
- data/test/stub/rails_apps/2.2/empty/public/422.html +0 -30
- data/test/stub/rails_apps/2.2/empty/public/500.html +0 -33
- data/test/stub/rails_apps/2.2/empty/public/dispatch.cgi +0 -10
- data/test/stub/rails_apps/2.2/empty/public/dispatch.fcgi +0 -24
- data/test/stub/rails_apps/2.2/empty/public/dispatch.rb +0 -10
- data/test/stub/rails_apps/2.2/empty/public/favicon.ico +0 -0
- data/test/stub/rails_apps/2.2/empty/public/images/rails.png +0 -0
- data/test/stub/rails_apps/2.2/empty/public/robots.txt +0 -5
- data/test/stub/rails_apps/2.2/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/script/about +0 -4
- data/test/stub/rails_apps/2.2/empty/script/console +0 -3
- data/test/stub/rails_apps/2.2/empty/script/destroy +0 -3
- data/test/stub/rails_apps/2.2/empty/script/generate +0 -3
- data/test/stub/rails_apps/2.2/empty/script/performance/benchmarker +0 -3
- data/test/stub/rails_apps/2.2/empty/script/performance/profiler +0 -3
- data/test/stub/rails_apps/2.2/empty/script/performance/request +0 -3
- data/test/stub/rails_apps/2.2/empty/script/plugin +0 -3
- data/test/stub/rails_apps/2.2/empty/script/process/inspector +0 -3
- data/test/stub/rails_apps/2.2/empty/script/process/reaper +0 -3
- data/test/stub/rails_apps/2.2/empty/script/process/spawner +0 -3
- data/test/stub/rails_apps/2.2/empty/script/runner +0 -3
- data/test/stub/rails_apps/2.2/empty/script/server +0 -3
- data/test/stub/rails_apps/2.2/empty/test/performance/browsing_test.rb +0 -9
- data/test/stub/rails_apps/2.2/empty/test/test_helper.rb +0 -38
- data/test/stub/rails_apps/2.3/empty/.gitignore +0 -3
- data/test/stub/rails_apps/2.3/empty/Rakefile +0 -10
- data/test/stub/rails_apps/2.3/empty/app/controllers/application_controller.rb +0 -10
- data/test/stub/rails_apps/2.3/empty/app/helpers/application_helper.rb +0 -3
- data/test/stub/rails_apps/2.3/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/config/boot.rb +0 -110
- data/test/stub/rails_apps/2.3/empty/config/database.yml +0 -31
- data/test/stub/rails_apps/2.3/empty/config/environment.rb +0 -41
- data/test/stub/rails_apps/2.3/empty/config/environments/development.rb +0 -17
- data/test/stub/rails_apps/2.3/empty/config/environments/production.rb +0 -28
- data/test/stub/rails_apps/2.3/empty/config/environments/staging.rb +0 -28
- data/test/stub/rails_apps/2.3/empty/config/environments/test.rb +0 -28
- data/test/stub/rails_apps/2.3/empty/config/initializers/backtrace_silencers.rb +0 -7
- data/test/stub/rails_apps/2.3/empty/config/initializers/inflections.rb +0 -10
- data/test/stub/rails_apps/2.3/empty/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails_apps/2.3/empty/config/initializers/new_rails_defaults.rb +0 -21
- data/test/stub/rails_apps/2.3/empty/config/initializers/session_store.rb +0 -15
- data/test/stub/rails_apps/2.3/empty/config/locales/en.yml +0 -5
- data/test/stub/rails_apps/2.3/empty/config/routes.rb +0 -43
- data/test/stub/rails_apps/2.3/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/db/seeds.rb +0 -7
- data/test/stub/rails_apps/2.3/empty/doc/README_FOR_APP +0 -2
- data/test/stub/rails_apps/2.3/empty/public/404.html +0 -30
- data/test/stub/rails_apps/2.3/empty/public/422.html +0 -30
- data/test/stub/rails_apps/2.3/empty/public/500.html +0 -30
- data/test/stub/rails_apps/2.3/empty/public/favicon.ico +0 -0
- data/test/stub/rails_apps/2.3/empty/public/images/rails.png +0 -0
- data/test/stub/rails_apps/2.3/empty/public/robots.txt +0 -5
- data/test/stub/rails_apps/2.3/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/script/about +0 -4
- data/test/stub/rails_apps/2.3/empty/script/console +0 -3
- data/test/stub/rails_apps/2.3/empty/script/dbconsole +0 -3
- data/test/stub/rails_apps/2.3/empty/script/destroy +0 -3
- data/test/stub/rails_apps/2.3/empty/script/generate +0 -3
- data/test/stub/rails_apps/2.3/empty/script/performance/benchmarker +0 -3
- data/test/stub/rails_apps/2.3/empty/script/performance/profiler +0 -3
- data/test/stub/rails_apps/2.3/empty/script/plugin +0 -3
- data/test/stub/rails_apps/2.3/empty/script/runner +0 -3
- data/test/stub/rails_apps/2.3/empty/script/server +0 -3
- data/test/stub/rails_apps/2.3/empty/test/performance/browsing_test.rb +0 -9
- data/test/stub/rails_apps/2.3/empty/test/test_helper.rb +0 -38
- data/test/stub/rails_apps/2.3/mycook/Rakefile +0 -10
- data/test/stub/rails_apps/2.3/mycook/app/helpers/application_helper.rb +0 -3
- data/test/stub/rails_apps/2.3/mycook/config/environments/development.rb +0 -18
- data/test/stub/rails_apps/2.3/mycook/config/initializers/inflections.rb +0 -10
- data/test/stub/rails_apps/2.3/mycook/config/initializers/mime_types.rb +0 -5
- data/test/stub/rails_apps/2.3/mycook/public/404.html +0 -30
- data/test/stub/rails_apps/2.3/mycook/public/422.html +0 -30
- data/test/stub/rails_apps/2.3/mycook/public/500.html +0 -30
- data/test/stub/rails_apps/2.3/mycook/public/favicon.ico +0 -0
- data/test/stub/rails_apps/2.3/mycook/public/images/rails.png +0 -0
- data/test/stub/rails_apps/2.3/mycook/public/robots.txt +0 -5
- data/test/stub/rails_apps/2.3/mycook/public/uploads/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/mycook/script/about +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/console +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/dbconsole +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/destroy +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/generate +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/performance/benchmarker +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/performance/profiler +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/performance/request +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/plugin +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/process/inspector +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/process/reaper +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/process/spawner +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/runner +0 -3
- data/test/stub/rails_apps/2.3/mycook/script/server +0 -3
- data/test/stub/wsgi/public/wsgi-snake.jpg +0 -0
@@ -37,7 +37,7 @@ if (!defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby") && RUBY_VERSION < "1.8.7"
|
|
37
37
|
"gem install fastthread"
|
38
38
|
end
|
39
39
|
end
|
40
|
-
|
40
|
+
PhusionPassenger.require_passenger_lib 'native_support'
|
41
41
|
|
42
42
|
class Exception
|
43
43
|
def backtrace_string(current_location = nil)
|
@@ -20,7 +20,7 @@
|
|
20
20
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
21
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
22
|
# THE SOFTWARE.
|
23
|
-
|
23
|
+
PhusionPassenger.require_passenger_lib 'utils/file_system_watcher'
|
24
24
|
|
25
25
|
module PhusionPassenger
|
26
26
|
module Standalone
|
@@ -137,7 +137,7 @@ private
|
|
137
137
|
end
|
138
138
|
|
139
139
|
def load_config_file!(context, filename)
|
140
|
-
|
140
|
+
PhusionPassenger.require_passenger_lib 'utils/json' if !defined?(PhusionPassenger::Utils::JSON)
|
141
141
|
begin
|
142
142
|
data = File.open(filename, "r:utf-8") do |f|
|
143
143
|
f.read
|
@@ -21,9 +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
|
require 'optparse'
|
24
|
-
|
25
|
-
|
26
|
-
require 'phusion_passenger/standalone/utils'
|
24
|
+
PhusionPassenger.require_passenger_lib 'constants'
|
25
|
+
PhusionPassenger.require_passenger_lib 'standalone/utils'
|
27
26
|
|
28
27
|
module PhusionPassenger
|
29
28
|
module Standalone
|
@@ -94,7 +93,7 @@ private
|
|
94
93
|
end
|
95
94
|
|
96
95
|
def require_app_finder
|
97
|
-
|
96
|
+
PhusionPassenger.require_passenger_lib 'standalone/app_finder' unless defined?(AppFinder)
|
98
97
|
end
|
99
98
|
|
100
99
|
def debugging?
|
@@ -106,7 +105,7 @@ private
|
|
106
105
|
|
107
106
|
global_config_file = File.join(ENV['HOME'], USER_NAMESPACE_DIRNAME, "standalone", "config")
|
108
107
|
if File.exist?(global_config_file)
|
109
|
-
|
108
|
+
PhusionPassenger.require_passenger_lib 'standalone/config_file' unless defined?(ConfigFile)
|
110
109
|
global_options = ConfigFile.new(:global_config, global_config_file).options
|
111
110
|
@options.merge!(global_options)
|
112
111
|
end
|
@@ -182,8 +181,8 @@ private
|
|
182
181
|
end
|
183
182
|
|
184
183
|
def write_nginx_config_file
|
185
|
-
|
186
|
-
|
184
|
+
PhusionPassenger.require_passenger_lib 'platform_info/ruby'
|
185
|
+
PhusionPassenger.require_passenger_lib 'utils/tmpio'
|
187
186
|
@temp_dir = PhusionPassenger::Utils.mktmpdir(
|
188
187
|
"passenger-standalone.")
|
189
188
|
@config_filename = "#{@temp_dir}/config"
|
@@ -198,7 +197,10 @@ private
|
|
198
197
|
|
199
198
|
File.open(location_config_filename, 'w') do |f|
|
200
199
|
f.puts '[locations]'
|
201
|
-
f.puts "natively_packaged
|
200
|
+
f.puts "natively_packaged=#{PhusionPassenger.natively_packaged?}"
|
201
|
+
if PhusionPassenger.natively_packaged?
|
202
|
+
f.puts "native_packaging_method=#{PhusionPassenger.native_packaging_method}"
|
203
|
+
end
|
202
204
|
f.puts "lib_dir=#{@runtime_locator.find_lib_dir}"
|
203
205
|
f.puts "agents_dir=#{@runtime_locator.find_agents_dir}"
|
204
206
|
locations_ini_fields.each do |field|
|
@@ -20,7 +20,7 @@
|
|
20
20
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
21
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
22
|
# THE SOFTWARE.
|
23
|
-
|
23
|
+
PhusionPassenger.require_passenger_lib 'standalone/command'
|
24
24
|
|
25
25
|
module PhusionPassenger
|
26
26
|
module Standalone
|
@@ -20,7 +20,7 @@
|
|
20
20
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
21
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
22
|
# THE SOFTWARE.
|
23
|
-
|
23
|
+
PhusionPassenger.require_passenger_lib 'standalone/command'
|
24
24
|
|
25
25
|
module PhusionPassenger
|
26
26
|
module Standalone
|
@@ -43,7 +43,7 @@ class Main
|
|
43
43
|
COMMANDS.each do |command_spec|
|
44
44
|
command_name = command_spec[0]
|
45
45
|
filename = command_name.sub(/-/, '_') + "_command"
|
46
|
-
|
46
|
+
PhusionPassenger.require_passenger_lib "standalone/#{filename}"
|
47
47
|
command_class = Standalone.const_get(command_spec[1])
|
48
48
|
yield(command_name, command_class)
|
49
49
|
end
|
@@ -107,7 +107,7 @@ private
|
|
107
107
|
def get_command_class(spec)
|
108
108
|
command_name, class_name = spec
|
109
109
|
filename = command_name.sub(/-/, '_') + "_command"
|
110
|
-
|
110
|
+
PhusionPassenger.require_passenger_lib("standalone/#{filename}")
|
111
111
|
return Standalone.const_get(class_name)
|
112
112
|
end
|
113
113
|
end
|
@@ -31,8 +31,8 @@ class PackageRuntimeCommand < Command
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def self.require_libs
|
34
|
-
|
35
|
-
|
34
|
+
PhusionPassenger.require_passenger_lib 'platform_info/binary_compatibility'
|
35
|
+
PhusionPassenger.require_passenger_lib 'standalone/runtime_installer'
|
36
36
|
end
|
37
37
|
|
38
38
|
def run
|
@@ -23,15 +23,16 @@
|
|
23
23
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24
24
|
# THE SOFTWARE.
|
25
25
|
require 'fileutils'
|
26
|
-
require '
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
26
|
+
require 'logger'
|
27
|
+
PhusionPassenger.require_passenger_lib 'constants'
|
28
|
+
PhusionPassenger.require_passenger_lib 'abstract_installer'
|
29
|
+
PhusionPassenger.require_passenger_lib 'packaging'
|
30
|
+
PhusionPassenger.require_passenger_lib 'common_library'
|
31
|
+
PhusionPassenger.require_passenger_lib 'platform_info'
|
32
|
+
PhusionPassenger.require_passenger_lib 'platform_info/ruby'
|
33
|
+
PhusionPassenger.require_passenger_lib 'platform_info/binary_compatibility'
|
34
|
+
PhusionPassenger.require_passenger_lib 'standalone/utils'
|
35
|
+
PhusionPassenger.require_passenger_lib 'utils/tmpio'
|
35
36
|
|
36
37
|
module PhusionPassenger
|
37
38
|
module Standalone
|
@@ -146,7 +147,7 @@ protected
|
|
146
147
|
|
147
148
|
private
|
148
149
|
def check_for_download_tool
|
149
|
-
|
150
|
+
PhusionPassenger.require_passenger_lib 'platform_info/depcheck'
|
150
151
|
PlatformInfo::Depcheck.load('depcheck_specs/utilities')
|
151
152
|
result = PlatformInfo::Depcheck.find('download-tool').check
|
152
153
|
# Don't output anything if there is a download tool.
|
@@ -189,6 +190,7 @@ private
|
|
189
190
|
"because --no-compile-runtime is given."
|
190
191
|
exit(1)
|
191
192
|
end
|
193
|
+
check_nginx_module_sources_available || exit(1)
|
192
194
|
puts
|
193
195
|
check_dependencies(false) || exit(1)
|
194
196
|
puts
|
@@ -278,8 +280,15 @@ private
|
|
278
280
|
basename = "webhelper-#{@nginx_version}-#{PlatformInfo.cxx_binary_compatibility_id}.tar.gz"
|
279
281
|
url = "#{@binaries_url_root}/#{PhusionPassenger::VERSION_STRING}/#{basename}"
|
280
282
|
tarball = "#{@working_dir}/#{basename}"
|
281
|
-
|
282
|
-
|
283
|
+
logger = Logger.new(STDOUT)
|
284
|
+
logger.level = Logger::WARN
|
285
|
+
logger.formatter = proc { |severity, datetime, progname, msg| " #{msg}\n" }
|
286
|
+
result = download(url, tarball,
|
287
|
+
:cacert => PhusionPassenger.binaries_ca_cert_path,
|
288
|
+
:use_cache => true,
|
289
|
+
:logger => logger)
|
290
|
+
if !result
|
291
|
+
puts " No binary is available for your platform. Will compile it from source."
|
283
292
|
return false
|
284
293
|
end
|
285
294
|
|
@@ -406,6 +415,39 @@ private
|
|
406
415
|
puts
|
407
416
|
end
|
408
417
|
|
418
|
+
def check_nginx_module_sources_available
|
419
|
+
if PhusionPassenger.natively_packaged? && !File.exist?(PhusionPassenger.nginx_module_source_dir)
|
420
|
+
case PhusionPassenger.native_packaging_method
|
421
|
+
when "deb"
|
422
|
+
command = "sudo sh -c 'apt-get update && apt-get install #{DEB_DEV_PACKAGE}'"
|
423
|
+
when "rpm"
|
424
|
+
command = "sudo yum install #{RPM_DEV_PACKAGE}"
|
425
|
+
end
|
426
|
+
if command
|
427
|
+
if STDIN.tty?
|
428
|
+
puts " --> Installing #{PhusionPassenger::PROGRAM_NAME} web helper sources"
|
429
|
+
puts " Running: #{command}"
|
430
|
+
if system(command)
|
431
|
+
return true
|
432
|
+
else
|
433
|
+
puts " <red>*** Command failed: #{command}</red>"
|
434
|
+
return false
|
435
|
+
end
|
436
|
+
else
|
437
|
+
puts " --> #{PhusionPassenger::PROGRAM_NAME} web helper sources not installed"
|
438
|
+
puts " Please install them first: #{command}"
|
439
|
+
return false
|
440
|
+
end
|
441
|
+
else
|
442
|
+
puts " --> #{PhusionPassenger::PROGRAM_NAME} web helper sources not installed"
|
443
|
+
puts " <red>Please ask your operating system vendor how to install these.</red>"
|
444
|
+
return false
|
445
|
+
end
|
446
|
+
else
|
447
|
+
return true
|
448
|
+
end
|
449
|
+
end
|
450
|
+
|
409
451
|
def check_whether_we_can_write_to(dir)
|
410
452
|
FileUtils.mkdir_p(dir)
|
411
453
|
File.new("#{dir}/__test__.txt", "w").close
|
@@ -563,7 +605,7 @@ private
|
|
563
605
|
end
|
564
606
|
|
565
607
|
def install_nginx_from_source(source_dir)
|
566
|
-
|
608
|
+
PhusionPassenger.require_passenger_lib 'platform_info/compiler'
|
567
609
|
Dir.chdir(source_dir) do
|
568
610
|
shell = PlatformInfo.find_command('bash') || "sh"
|
569
611
|
command = ""
|
@@ -22,8 +22,8 @@
|
|
22
22
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
23
|
# THE SOFTWARE.
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
PhusionPassenger.require_passenger_lib 'platform_info/binary_compatibility'
|
26
|
+
PhusionPassenger.require_passenger_lib 'utils/json'
|
27
27
|
require 'etc'
|
28
28
|
|
29
29
|
module PhusionPassenger
|
@@ -55,7 +55,7 @@ class RuntimeLocator
|
|
55
55
|
|
56
56
|
if PhusionPassenger.originally_packaged?
|
57
57
|
if debugging?
|
58
|
-
@support_dir =
|
58
|
+
@support_dir = PhusionPassenger.buildout_dir
|
59
59
|
else
|
60
60
|
dir = "#{@runtime_dir}/#{version}/support-#{cxx_compat_id}"
|
61
61
|
if self.class.looks_like_support_dir?(dir)
|
@@ -23,10 +23,9 @@
|
|
23
23
|
require 'socket'
|
24
24
|
require 'thread'
|
25
25
|
require 'etc'
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
require 'phusion_passenger/platform_info/operating_system'
|
26
|
+
PhusionPassenger.require_passenger_lib 'plugin'
|
27
|
+
PhusionPassenger.require_passenger_lib 'standalone/command'
|
28
|
+
PhusionPassenger.require_passenger_lib 'platform_info/operating_system'
|
30
29
|
|
31
30
|
# We lazy load as many libraries as possible not only to improve startup performance,
|
32
31
|
# but also to ensure that we don't require libraries before we've passed the dependency
|
@@ -53,7 +52,7 @@ class StartCommand < Command
|
|
53
52
|
parse_my_options
|
54
53
|
sanity_check_options
|
55
54
|
|
56
|
-
|
55
|
+
PhusionPassenger.require_passenger_lib 'standalone/runtime_locator'
|
57
56
|
@runtime_locator = RuntimeLocator.new(@options[:runtime_dir],
|
58
57
|
@options[:nginx_version])
|
59
58
|
ensure_runtime_installed
|
@@ -321,7 +320,7 @@ private
|
|
321
320
|
begin
|
322
321
|
TCPServer.new('127.0.0.1', @options[:port]).close
|
323
322
|
rescue Errno::EACCES
|
324
|
-
|
323
|
+
PhusionPassenger.require_passenger_lib 'platform_info/ruby'
|
325
324
|
myself = `whoami`.strip
|
326
325
|
error "Only the 'root' user can run this program on port #{@options[:port]}. " <<
|
327
326
|
"You are currently running as '#{myself}'. Please re-run this program " <<
|
@@ -450,7 +449,7 @@ private
|
|
450
449
|
end
|
451
450
|
|
452
451
|
def install_runtime(runtime_locator)
|
453
|
-
|
452
|
+
PhusionPassenger.require_passenger_lib 'standalone/runtime_installer'
|
454
453
|
installer = RuntimeInstaller.new(
|
455
454
|
:targets => runtime_locator.install_targets,
|
456
455
|
:support_dir => runtime_locator.support_dir_install_destination,
|
@@ -20,7 +20,7 @@
|
|
20
20
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
21
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
22
|
# THE SOFTWARE.
|
23
|
-
|
23
|
+
PhusionPassenger.require_passenger_lib 'standalone/command'
|
24
24
|
|
25
25
|
module PhusionPassenger
|
26
26
|
module Standalone
|
@@ -20,7 +20,7 @@
|
|
20
20
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
21
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
22
|
# THE SOFTWARE.
|
23
|
-
|
23
|
+
PhusionPassenger.require_passenger_lib 'standalone/command'
|
24
24
|
|
25
25
|
module PhusionPassenger
|
26
26
|
module Standalone
|
@@ -28,7 +28,7 @@ module Utils
|
|
28
28
|
private
|
29
29
|
def require_platform_info_binary_compatibility
|
30
30
|
if !defined?(PlatformInfo) || !PlatformInfo.respond_to?(:cxx_binary_compatibility_id)
|
31
|
-
|
31
|
+
PhusionPassenger.require_passenger_lib 'platform_info/binary_compatibility'
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -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
|
#
|
@@ -20,8 +20,7 @@
|
|
20
20
|
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
21
21
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
22
22
|
# THE SOFTWARE.
|
23
|
-
|
24
|
-
require 'phusion_passenger/standalone/command'
|
23
|
+
PhusionPassenger.require_passenger_lib 'standalone/command'
|
25
24
|
|
26
25
|
module PhusionPassenger
|
27
26
|
module Standalone
|
@@ -22,8 +22,7 @@
|
|
22
22
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
23
|
# THE SOFTWARE.
|
24
24
|
|
25
|
-
|
26
|
-
require 'phusion_passenger/platform_info'
|
25
|
+
PhusionPassenger.require_passenger_lib 'platform_info'
|
27
26
|
require 'fileutils'
|
28
27
|
require 'shellwords'
|
29
28
|
|
@@ -22,7 +22,7 @@
|
|
22
22
|
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
23
|
# THE SOFTWARE.
|
24
24
|
|
25
|
-
|
25
|
+
PhusionPassenger.require_passenger_lib 'platform_info/operating_system'
|
26
26
|
|
27
27
|
module PhusionPassenger
|
28
28
|
module Utils
|
@@ -0,0 +1,217 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
# Phusion Passenger - https://www.phusionpassenger.com/
|
3
|
+
# Copyright (c) 2013 Phusion
|
4
|
+
#
|
5
|
+
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
6
|
+
#
|
7
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
# of this software and associated documentation files (the "Software"), to deal
|
9
|
+
# in the Software without restriction, including without limitation the rights
|
10
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
# copies of the Software, and to permit persons to whom the Software is
|
12
|
+
# furnished to do so, subject to the following conditions:
|
13
|
+
#
|
14
|
+
# The above copyright notice and this permission notice shall be included in
|
15
|
+
# all copies or substantial portions of the Software.
|
16
|
+
#
|
17
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
# THE SOFTWARE.
|
24
|
+
|
25
|
+
module PhusionPassenger
|
26
|
+
module Utils
|
27
|
+
|
28
|
+
class TerminalChoiceMenu
|
29
|
+
class Choice
|
30
|
+
attr_reader :name
|
31
|
+
attr_accessor :checked
|
32
|
+
|
33
|
+
alias checked? checked
|
34
|
+
|
35
|
+
def self.create(choice)
|
36
|
+
if choice.is_a?(Choice)
|
37
|
+
return choice
|
38
|
+
else
|
39
|
+
return Choice.new(choice)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def initialize(name, checked = false)
|
44
|
+
@name = name
|
45
|
+
@checked = checked
|
46
|
+
end
|
47
|
+
|
48
|
+
def toggle!
|
49
|
+
@checked = !@checked
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
def initialize(choices)
|
54
|
+
@choices = choices.map { |choice| Choice.create(choice) }
|
55
|
+
@pointer = 0
|
56
|
+
@index = index_choices
|
57
|
+
initialize_terminal_control
|
58
|
+
end
|
59
|
+
|
60
|
+
def display_choices
|
61
|
+
display(render_to_string)
|
62
|
+
end
|
63
|
+
|
64
|
+
def query
|
65
|
+
if STDIN.tty?
|
66
|
+
done = false
|
67
|
+
begin
|
68
|
+
raw_no_echo_mode
|
69
|
+
hide_cursor
|
70
|
+
while !done
|
71
|
+
display_choices
|
72
|
+
done = process_input
|
73
|
+
clear_screen if !done
|
74
|
+
end
|
75
|
+
ensure
|
76
|
+
restore_mode
|
77
|
+
show_cursor
|
78
|
+
puts
|
79
|
+
end
|
80
|
+
else
|
81
|
+
display_choices
|
82
|
+
puts
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def [](name)
|
87
|
+
return @index[name]
|
88
|
+
end
|
89
|
+
|
90
|
+
def selected_choices
|
91
|
+
@choices.find_all{ |c| c.checked? }.map{ |c| c.name }
|
92
|
+
end
|
93
|
+
|
94
|
+
private
|
95
|
+
JRUBY = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
|
96
|
+
|
97
|
+
def index_choices
|
98
|
+
index = {}
|
99
|
+
@choices.each do |choice|
|
100
|
+
index[choice.name] = choice
|
101
|
+
end
|
102
|
+
return index
|
103
|
+
end
|
104
|
+
|
105
|
+
def process_input
|
106
|
+
case STDIN.getc
|
107
|
+
when "\x1b"
|
108
|
+
process_cursor_move
|
109
|
+
return false
|
110
|
+
when " "
|
111
|
+
process_toggle
|
112
|
+
return false
|
113
|
+
when "\r"
|
114
|
+
return true
|
115
|
+
else
|
116
|
+
return false
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
def process_cursor_move
|
121
|
+
if STDIN.getc == "["
|
122
|
+
case STDIN.getc
|
123
|
+
when "A" # up
|
124
|
+
@pointer = [@pointer - 1, 0].max
|
125
|
+
when "B" # down
|
126
|
+
@pointer = [@pointer + 1, @choices.size - 1].min
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def process_toggle
|
132
|
+
@choices[@pointer].toggle!
|
133
|
+
end
|
134
|
+
|
135
|
+
def render_to_string
|
136
|
+
str = ""
|
137
|
+
@choices.each_with_index do |choice, i|
|
138
|
+
pointer = render_pointer(i)
|
139
|
+
checkbox = render_checkbox(choice.checked)
|
140
|
+
str << " #{pointer} #{checkbox} #{choice.name}\r\n"
|
141
|
+
end
|
142
|
+
str.chomp!
|
143
|
+
return str
|
144
|
+
end
|
145
|
+
|
146
|
+
def render_pointer(index)
|
147
|
+
return @pointer == index ? "‣" : " "
|
148
|
+
end
|
149
|
+
|
150
|
+
def render_checkbox(checked)
|
151
|
+
return checked ? "⬢" : "⬡"
|
152
|
+
end
|
153
|
+
|
154
|
+
def display(str)
|
155
|
+
STDOUT.write(str)
|
156
|
+
STDOUT.flush
|
157
|
+
end
|
158
|
+
|
159
|
+
def clear_screen
|
160
|
+
number_of_lines = render_to_string.split("\n").size
|
161
|
+
display("\r")
|
162
|
+
(number_of_lines - 1).times do
|
163
|
+
display(move_up)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def hide_cursor
|
168
|
+
display("\x1b[?25l")
|
169
|
+
end
|
170
|
+
|
171
|
+
def show_cursor
|
172
|
+
display("\x1b[?25h")
|
173
|
+
end
|
174
|
+
|
175
|
+
def move_up
|
176
|
+
return "\x1b[0A"
|
177
|
+
end
|
178
|
+
|
179
|
+
if JRUBY
|
180
|
+
require 'java'
|
181
|
+
require 'readline'
|
182
|
+
java_import 'jline.console.ConsoleReader'
|
183
|
+
|
184
|
+
def initialize_terminal_control
|
185
|
+
input = STDIN.to_inputstream
|
186
|
+
output = STDOUT.to_outputstream
|
187
|
+
@console = ConsoleReader.new(input, output)
|
188
|
+
@console.set_history_enabled(false)
|
189
|
+
@console.set_bell_enabled(true)
|
190
|
+
@console.set_pagination_enabled(false)
|
191
|
+
end
|
192
|
+
|
193
|
+
def raw_no_echo_mode
|
194
|
+
@terminal_state = @console.getEchoCharacter
|
195
|
+
@console.setEchoCharacter(0)
|
196
|
+
end
|
197
|
+
|
198
|
+
def restore_mode
|
199
|
+
@console.setEchoCharacter(@terminal_state)
|
200
|
+
end
|
201
|
+
else
|
202
|
+
def initialize_terminal_control
|
203
|
+
end
|
204
|
+
|
205
|
+
def raw_no_echo_mode
|
206
|
+
@terminal_state = `stty -g`
|
207
|
+
system("stty raw -echo -icanon isig")
|
208
|
+
end
|
209
|
+
|
210
|
+
def restore_mode
|
211
|
+
system("stty #{@terminal_state}")
|
212
|
+
end
|
213
|
+
end
|
214
|
+
end
|
215
|
+
|
216
|
+
end # module Utils
|
217
|
+
end # module PhusionPassenger
|