@@ -525,10 +525,7 @@ private
525525 def insert_passenger_config_snippets ( prefix )
526526 config_file = locate_nginx_config_file ( prefix )
527527 contents = File . read ( config_file )
528- contents . sub! ( /^http \{ / ,
529- "http {\n " <<
530- " passenger_root #{ PhusionPassenger . install_spec } ;\n " <<
531- " passenger_ruby #{ PlatformInfo . ruby_command } ;\n " )
528+ contents . sub! ( /^http \{ / , "http {\n passenger_root #{ PhusionPassenger . install_spec } ;\n passenger_ruby #{ PlatformInfo . ruby_command } ;\n " )
532529 File . open ( config_file , 'w' ) do |f |
533530 f . write ( contents )
534531 end
@@ -556,20 +553,20 @@ private
556553 ] . compact . join ( " " ) . strip
557554
558555 command = "sh ./configure --prefix='#{ prefix } ' "
559- command << "--with-http_ssl_module "
560- command << "--with-http_v2_module "
561- command << "--with-http_realip_module "
562- command << "--with-http_gzip_static_module "
563- command << "--with-http_stub_status_module "
564- command << "--with-http_addition_module "
565- command << "--with-cc-opt=#{ Shellwords . escape extra_cflags } "
566- command << "--with-ld-opt=#{ Shellwords . escape extra_ldflags } "
556+ command += "--with-http_ssl_module "
557+ command += "--with-http_v2_module "
558+ command += "--with-http_realip_module "
559+ command += "--with-http_gzip_static_module "
560+ command += "--with-http_stub_status_module "
561+ command += "--with-http_addition_module "
562+ command += "--with-cc-opt=#{ Shellwords . escape extra_cflags } "
563+ command += "--with-ld-opt=#{ Shellwords . escape extra_ldflags } "
567564 if @pcre_source_dir
568- command << "--with-pcre='#{ @pcre_source_dir } ' "
565+ command += "--with-pcre='#{ @pcre_source_dir } ' "
569566 elsif !pcre_is_installed?
570- command << "--without-http_rewrite_module "
567+ command += "--without-http_rewrite_module "
571568 end
572- command << "--add-module='#{ PhusionPassenger . nginx_module_source_dir } ' #{ extra_configure_flags } "
569+ command += "--add-module='#{ PhusionPassenger . nginx_module_source_dir } ' #{ extra_configure_flags } "
573570 command . strip!
574571 return command
575572 end
@@ -583,11 +580,15 @@ private
583580 end
584581 Dir . chdir ( "#{ safe_tmpdir } " ) do
585582 # Nginx checks for PCRE in multiple places...
586- system ( "(gcc -I/usr/local/include -I/usr/include/pcre2 " <<
587- "-I/usr/pkg/include -I/opt/local/include " <<
588- "-I/opt/homebrew/include " <<
589- "-DPCRE2_CODE_UNIT_WIDTH=8 " <<
590- "-c passenger-check.c) >/dev/null 2>/dev/null" )
583+ system ( [ "gcc" ,
584+ "-I/usr/local/include" ,
585+ "-I/usr/include/pcre2" ,
586+ "-I/usr/pkg/include" ,
587+ "-I/opt/local/include" ,
588+ "-I/opt/homebrew/include" ,
589+ "-DPCRE2_CODE_UNIT_WIDTH=8" ,
590+ "-c" , "passenger-check.c" ,
591+ ">/dev/null" , "2>/dev/null" ] . join ( ' ' ) )
591592 end
592593 ensure
593594 File . unlink ( "#{ safe_tmpdir } /passenger-check.c" ) rescue nil
@@ -602,8 +603,7 @@ private
602603 # We do this instead of using #file, for Ruby 1.8.5 support.
603604 digest = Digest ::SHA256 . new
604605 File . open ( path , "rb" ) do |f |
605- buf = ''
606- buf . force_encoding ( 'binary' ) if buf . respond_to? ( :force_encoding )
606+ buf = String . new ( encoding : Encoding ::BINARY )
607607 while !f . eof?
608608 f . read ( 1024 * 16 , buf )
609609 digest . update ( buf )
@@ -625,33 +625,31 @@ parser = OptionParser.new do |opts|
625625
626626 indent = ' ' * 37
627627 opts . separator "Options:"
628- opts . on ( "--auto" , "Automatically confirm 'Press ENTER to\n " <<
629- "#{ indent } continue' prompts." ) do
628+ opts . on ( "--auto" , "Automatically confirm 'Press ENTER to\n #{ indent } continue' prompts." ) do
630629 options [ :auto ] = true
631630 end
632- opts . on ( "--prefix=DIR" , String , "Use the given Nginx install prefix instead\n " <<
633- "#{ indent } of asking for it interactively." ) do |dir |
631+ opts . on ( "--prefix=DIR" , String , "Use the given Nginx install prefix instead\n #{ indent } of asking for it interactively." ) do |dir |
634632 options [ :prefix ] = dir
635633 end
636- opts . on ( "--auto-download" , "Download and install Nginx automatically,\n " <<
637- "#{ indent } instead of asking interactively whether to\n " <<
638- "#{ indent } download+install or to use an existing\n " <<
639- "#{ indent } Nginx source directory." ) do
634+ opts . on ( "--auto-download" , [ "Download and install Nginx automatically," ,
635+ "#{ indent } instead of asking interactively whether to" ,
636+ "#{ indent } download+install or to use an existing" ,
637+ "#{ indent } Nginx source directory." ] . join ( " \n " ) ) do
640638 options [ :auto_download ] = true
641639 end
642- opts . on ( "--nginx-source-dir=DIR" , String , "Compile and install Nginx using the given\n " <<
643- "#{ indent } Nginx source directory, instead of\n " <<
644- "#{ indent } interactively asking to download+install\n " <<
645- "#{ indent } or to use an existing Nginx source\n " <<
646- "#{ indent } directory. Conflicts with --auto-download." ) do |dir |
640+ opts . on ( "--nginx-source-dir=DIR" , String , [ "Compile and install Nginx using the given" ,
641+ "#{ indent } Nginx source directory, instead of" ,
642+ "#{ indent } interactively asking to download+install" ,
643+ "#{ indent } or to use an existing Nginx source" ,
644+ "#{ indent } directory. Conflicts with --auto-download." ] . join ( " \n " ) ) do |dir |
647645 options [ :nginx_source_dir ] = dir
648646 end
649- opts . on ( "--extra-configure-flags=STRING" , String , "Pass these extra flags to Nginx's\n " <<
650- "#{ indent } 'configure' script, instead of asking for\n " <<
651- "#{ indent } it interactively. Specify 'none' if you\n " <<
652- "#{ indent } do not want to pass additional flags but do\n " <<
653- "#{ indent } not want this installer to ask\n " <<
654- "#{ indent } interactively either." ) do |flags |
647+ opts . on ( "--extra-configure-flags=STRING" , String , [ "Pass these extra flags to Nginx's" ,
648+ "#{ indent } 'configure' script, instead of asking for" ,
649+ "#{ indent } it interactively. Specify 'none' if you" ,
650+ "#{ indent } do not want to pass additional flags but do" ,
651+ "#{ indent } not want this installer to ask" ,
652+ "#{ indent } interactively either." ] . join ( " \n " ) ) do |flags |
655653 options [ :extra_configure_flags ] = flags
656654 end
657655 opts . on ( "--rake-command COMMAND" , String , "Customize Rake command to use" ) do |value |
@@ -660,9 +658,9 @@ parser = OptionParser.new do |opts|
660658 opts . on ( "--make-concurrency N" , Integer , "Use N parallel jobs when running 'make'." ) do |n |
661659 options [ :make_concurrency ] = n
662660 end
663- opts . on ( "--languages NAMES" , "Comma-separated list of interested\n " <<
664- "#{ indent } languages (e.g.\n " <<
665- "#{ indent } 'ruby,python,nodejs,meteor')" ) do |value |
661+ opts . on ( "--languages NAMES" , [ "Comma-separated list of interested" ,
662+ "#{ indent } languages (e.g." ,
663+ "#{ indent } 'ruby,python,nodejs,meteor')" ] . join ( " \n " ) ) do |value |
666664 options [ :languages ] = value . split ( "," )
667665 end
668666 opts . on ( "--force-colors" , "Display colors even if stdout is not a TTY" ) do
0 commit comments