From e9a73410630fbc46f547ab5c5d24efb2c569bb69 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 8 Feb 2024 12:16:31 +0000 Subject: treewide: future-proof frozen_string_literal changes Once again Ruby seems ready to introduce more incompatibilities and force busywork upon maintainers[1]. In order to avoid incompatibilities in the future, I used a Perl script[2] to prepend `frozen_string_literal: false' to every Ruby file. Somebody interested will have to go through every Ruby source file and enable frozen_string_literal once they've thoroughly verified it's safe to do so. [1] https://bugs.ruby-lang.org/issues/20205 [2] https://yhbt.net/add-fsl.git/74d7689/s/?b=add-fsl.perl --- lib/unicorn/app/old_rails.rb | 1 + lib/unicorn/app/old_rails/static.rb | 1 + lib/unicorn/cgi_wrapper.rb | 1 + lib/unicorn/configurator.rb | 1 + lib/unicorn/const.rb | 1 + lib/unicorn/http_request.rb | 1 + lib/unicorn/http_response.rb | 1 + lib/unicorn/http_server.rb | 1 + lib/unicorn/launcher.rb | 1 + lib/unicorn/oob_gc.rb | 1 + lib/unicorn/preread_input.rb | 1 + lib/unicorn/select_waiter.rb | 1 + lib/unicorn/socket_helper.rb | 1 + lib/unicorn/stream_input.rb | 1 + lib/unicorn/tee_input.rb | 1 + lib/unicorn/tmpio.rb | 1 + lib/unicorn/util.rb | 1 + lib/unicorn/worker.rb | 1 + 18 files changed, 18 insertions(+) (limited to 'lib/unicorn') diff --git a/lib/unicorn/app/old_rails.rb b/lib/unicorn/app/old_rails.rb index 1e8c41a..54b3e69 100644 --- a/lib/unicorn/app/old_rails.rb +++ b/lib/unicorn/app/old_rails.rb @@ -1,4 +1,5 @@ # -*- encoding: binary -*- +# frozen_string_literal: false # :enddoc: # This code is based on the original Rails handler in Mongrel diff --git a/lib/unicorn/app/old_rails/static.rb b/lib/unicorn/app/old_rails/static.rb index 2257270..cf34e02 100644 --- a/lib/unicorn/app/old_rails/static.rb +++ b/lib/unicorn/app/old_rails/static.rb @@ -1,4 +1,5 @@ # -*- encoding: binary -*- +# frozen_string_literal: false # :enddoc: # This code is based on the original Rails handler in Mongrel # Copyright (c) 2005 Zed A. Shaw diff --git a/lib/unicorn/cgi_wrapper.rb b/lib/unicorn/cgi_wrapper.rb index d9b7fe5..fb43605 100644 --- a/lib/unicorn/cgi_wrapper.rb +++ b/lib/unicorn/cgi_wrapper.rb @@ -1,4 +1,5 @@ # -*- encoding: binary -*- +# frozen_string_literal: false # :enddoc: # This code is based on the original CGIWrapper from Mongrel diff --git a/lib/unicorn/configurator.rb b/lib/unicorn/configurator.rb index b21a01d..3c81596 100644 --- a/lib/unicorn/configurator.rb +++ b/lib/unicorn/configurator.rb @@ -1,4 +1,5 @@ # -*- encoding: binary -*- +# frozen_string_literal: false require 'logger' # Implements a simple DSL for configuring a unicorn server. diff --git a/lib/unicorn/const.rb b/lib/unicorn/const.rb index 33ab4ac..8032863 100644 --- a/lib/unicorn/const.rb +++ b/lib/unicorn/const.rb @@ -1,4 +1,5 @@ # -*- encoding: binary -*- +# frozen_string_literal: false module Unicorn::Const # :nodoc: # default TCP listen host address (0.0.0.0, all interfaces) diff --git a/lib/unicorn/http_request.rb b/lib/unicorn/http_request.rb index ab3bd6e..a48dab7 100644 --- a/lib/unicorn/http_request.rb +++ b/lib/unicorn/http_request.rb @@ -1,4 +1,5 @@ # -*- encoding: binary -*- +# frozen_string_literal: false # :enddoc: # no stable API here require 'unicorn_http' diff --git a/lib/unicorn/http_response.rb b/lib/unicorn/http_response.rb index 0ed0ae3..3634165 100644 --- a/lib/unicorn/http_response.rb +++ b/lib/unicorn/http_response.rb @@ -1,4 +1,5 @@ # -*- encoding: binary -*- +# frozen_string_literal: false # :enddoc: # Writes a Rack response to your client using the HTTP/1.1 specification. # You use it by simply doing: diff --git a/lib/unicorn/http_server.rb b/lib/unicorn/http_server.rb index ed5bbf1..08fbe40 100644 --- a/lib/unicorn/http_server.rb +++ b/lib/unicorn/http_server.rb @@ -1,4 +1,5 @@ # -*- encoding: binary -*- +# frozen_string_literal: false # This is the process manager of Unicorn. This manages worker # processes which in turn handle the I/O and application process. diff --git a/lib/unicorn/launcher.rb b/lib/unicorn/launcher.rb index 78e8f39..bd3324e 100644 --- a/lib/unicorn/launcher.rb +++ b/lib/unicorn/launcher.rb @@ -1,4 +1,5 @@ # -*- encoding: binary -*- +# frozen_string_literal: false # :enddoc: $stdout.sync = $stderr.sync = true diff --git a/lib/unicorn/oob_gc.rb b/lib/unicorn/oob_gc.rb index db9f2cb..efd9177 100644 --- a/lib/unicorn/oob_gc.rb +++ b/lib/unicorn/oob_gc.rb @@ -1,4 +1,5 @@ # -*- encoding: binary -*- +# frozen_string_literal: false # Strongly consider https://github.com/tmm1/gctools if using Ruby 2.1+ # It is built on new APIs in Ruby 2.1, so it is more intelligent than diff --git a/lib/unicorn/preread_input.rb b/lib/unicorn/preread_input.rb index 12eb3e8..c62cc09 100644 --- a/lib/unicorn/preread_input.rb +++ b/lib/unicorn/preread_input.rb @@ -1,4 +1,5 @@ # -*- encoding: binary -*- +# frozen_string_literal: false module Unicorn # This middleware is used to ensure input is buffered to memory diff --git a/lib/unicorn/select_waiter.rb b/lib/unicorn/select_waiter.rb index cb84aab..d11ea57 100644 --- a/lib/unicorn/select_waiter.rb +++ b/lib/unicorn/select_waiter.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: false # fallback for non-Linux and Linux <4.5 systems w/o EPOLLEXCLUSIVE class Unicorn::SelectWaiter # :nodoc: def get_readers(ready, readers, timeout) # :nodoc: diff --git a/lib/unicorn/socket_helper.rb b/lib/unicorn/socket_helper.rb index 06ec2b2..986932f 100644 --- a/lib/unicorn/socket_helper.rb +++ b/lib/unicorn/socket_helper.rb @@ -1,4 +1,5 @@ # -*- encoding: binary -*- +# frozen_string_literal: false # :enddoc: require 'socket' diff --git a/lib/unicorn/stream_input.rb b/lib/unicorn/stream_input.rb index 9246f73..23a9976 100644 --- a/lib/unicorn/stream_input.rb +++ b/lib/unicorn/stream_input.rb @@ -1,4 +1,5 @@ # -*- encoding: binary -*- +# frozen_string_literal: false # When processing uploads, unicorn may expose a StreamInput object under # "rack.input" of the Rack environment when diff --git a/lib/unicorn/tee_input.rb b/lib/unicorn/tee_input.rb index 2ccc2d9..b3c6535 100644 --- a/lib/unicorn/tee_input.rb +++ b/lib/unicorn/tee_input.rb @@ -1,4 +1,5 @@ # -*- encoding: binary -*- +# frozen_string_literal: false # Acts like tee(1) on an input input to provide a input-like stream # while providing rewindable semantics through a File/StringIO backing diff --git a/lib/unicorn/tmpio.rb b/lib/unicorn/tmpio.rb index 0bbf6ec..deecd80 100644 --- a/lib/unicorn/tmpio.rb +++ b/lib/unicorn/tmpio.rb @@ -1,4 +1,5 @@ # -*- encoding: binary -*- +# frozen_string_literal: false # :stopdoc: require 'tmpdir' diff --git a/lib/unicorn/util.rb b/lib/unicorn/util.rb index b826de4..f28d929 100644 --- a/lib/unicorn/util.rb +++ b/lib/unicorn/util.rb @@ -1,4 +1,5 @@ # -*- encoding: binary -*- +# frozen_string_literal: false require 'fcntl' module Unicorn::Util # :nodoc: diff --git a/lib/unicorn/worker.rb b/lib/unicorn/worker.rb index 4af31be..d2445d5 100644 --- a/lib/unicorn/worker.rb +++ b/lib/unicorn/worker.rb @@ -1,4 +1,5 @@ # -*- encoding: binary -*- +# frozen_string_literal: false require "raindrops" # This class and its members can be considered a stable interface -- cgit v1.2.3-24-ge0c7