From 9423df54060607e69d515ccea361fa008f226207 Mon Sep 17 00:00:00 2001 From: Artur Montenegro Date: Sat, 25 Apr 2020 19:40:36 -0300 Subject: [PATCH 1/8] Prefers the rackup file specified by the CLI --- lib/puma/dsl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puma/dsl.rb b/lib/puma/dsl.rb index 9bc51f77aa..13ab877c51 100644 --- a/lib/puma/dsl.rb +++ b/lib/puma/dsl.rb @@ -308,7 +308,7 @@ def debug # @example # rackup '/u/apps/lolcat/config.ru' def rackup(path) - @options[:rackup] = path.to_s + @options[:rackup] = path.to_s unless @options[:rackup] end def early_hints(answer=true) From ec6d0f5143bbce98012ff28ff527aeca18c6ea60 Mon Sep 17 00:00:00 2001 From: Artur Montenegro Date: Sat, 25 Apr 2020 19:40:55 -0300 Subject: [PATCH 2/8] Updates test --- test/config/with_rackup_from_dsl.rb | 1 + test/test_integration_single.rb | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 test/config/with_rackup_from_dsl.rb diff --git a/test/config/with_rackup_from_dsl.rb b/test/config/with_rackup_from_dsl.rb new file mode 100644 index 0000000000..269993e8a3 --- /dev/null +++ b/test/config/with_rackup_from_dsl.rb @@ -0,0 +1 @@ +rackup "test/rackup/hello-env.ru" \ No newline at end of file diff --git a/test/test_integration_single.rb b/test/test_integration_single.rb index e1afa97f4d..b719824b0e 100644 --- a/test/test_integration_single.rb +++ b/test/test_integration_single.rb @@ -43,6 +43,19 @@ def test_term_suppress assert_equal 0, status end + def test_prefer_rackup_file_specified_by_cli + skip_unless_signal_exist? :TERM + skip_on :jruby + + cli_server "-C test/config/with_rackup_from_dsl.rb test/rackup/hello.ru" + connection = connect + reply = read_body(connection) + _, status = stop_server + + assert_match("Hello World", reply) + assert_equal 15, status + end + def test_term_not_accepts_new_connections skip_unless_signal_exist? :TERM skip_on :jruby From d0e753da6041d96fdddd7e0d403fc678883ce70a Mon Sep 17 00:00:00 2001 From: Artur Montenegro Date: Sat, 25 Apr 2020 19:43:09 -0300 Subject: [PATCH 3/8] Updates HISTORY.md --- History.md | 1 + 1 file changed, 1 insertion(+) diff --git a/History.md b/History.md index ce96413323..94e72bc609 100644 --- a/History.md +++ b/History.md @@ -39,6 +39,7 @@ * Fix `out_of_band` hook never executed if the number of worker threads is > 1 (#2177) * Fix ThreadPool#shutdown timeout accuracy (#2221) * Fix `UserFileDefaultOptions#fetch` to properly use `default` (#2233) + * Prefer the rackup file specified by the CLI (#2225) * Refactor * Remove unused loader argument from Plugin initializer (#2095) From 192972e461f804e365348c969cee6c17acb0f6e8 Mon Sep 17 00:00:00 2001 From: Artur Montenegro Date: Sat, 25 Apr 2020 19:45:45 -0300 Subject: [PATCH 4/8] Adds final newline --- test/config/with_rackup_from_dsl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/config/with_rackup_from_dsl.rb b/test/config/with_rackup_from_dsl.rb index 269993e8a3..3c310d8772 100644 --- a/test/config/with_rackup_from_dsl.rb +++ b/test/config/with_rackup_from_dsl.rb @@ -1 +1 @@ -rackup "test/rackup/hello-env.ru" \ No newline at end of file +rackup "test/rackup/hello-env.ru" From 26393ae933dcad90510348db9033b14a67075e79 Mon Sep 17 00:00:00 2001 From: Artur Montenegro Date: Sat, 25 Apr 2020 22:31:54 -0300 Subject: [PATCH 5/8] Adds syntax sugar on method call --- lib/puma/dsl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puma/dsl.rb b/lib/puma/dsl.rb index 13ab877c51..41e03a1a7e 100644 --- a/lib/puma/dsl.rb +++ b/lib/puma/dsl.rb @@ -308,7 +308,7 @@ def debug # @example # rackup '/u/apps/lolcat/config.ru' def rackup(path) - @options[:rackup] = path.to_s unless @options[:rackup] + @options[:rackup] ||= path.to_s end def early_hints(answer=true) From 7203ffe2c9305930939d9d3c5a129c8cce43c5c2 Mon Sep 17 00:00:00 2001 From: Artur Montenegro Date: Sat, 25 Apr 2020 22:44:33 -0300 Subject: [PATCH 6/8] Reverts 26393ae --- lib/puma/dsl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puma/dsl.rb b/lib/puma/dsl.rb index 41e03a1a7e..13ab877c51 100644 --- a/lib/puma/dsl.rb +++ b/lib/puma/dsl.rb @@ -308,7 +308,7 @@ def debug # @example # rackup '/u/apps/lolcat/config.ru' def rackup(path) - @options[:rackup] ||= path.to_s + @options[:rackup] = path.to_s unless @options[:rackup] end def early_hints(answer=true) From 09260b7e65c69a38bae59d80defcfa5644dfefa4 Mon Sep 17 00:00:00 2001 From: Artur Montenegro Date: Mon, 27 Apr 2020 09:41:03 -0300 Subject: [PATCH 7/8] Tweaks test implementation --- test/test_integration_single.rb | 2 -- 1 file changed, 2 deletions(-) diff --git a/test/test_integration_single.rb b/test/test_integration_single.rb index b719824b0e..864c3385ae 100644 --- a/test/test_integration_single.rb +++ b/test/test_integration_single.rb @@ -45,7 +45,6 @@ def test_term_suppress def test_prefer_rackup_file_specified_by_cli skip_unless_signal_exist? :TERM - skip_on :jruby cli_server "-C test/config/with_rackup_from_dsl.rb test/rackup/hello.ru" connection = connect @@ -53,7 +52,6 @@ def test_prefer_rackup_file_specified_by_cli _, status = stop_server assert_match("Hello World", reply) - assert_equal 15, status end def test_term_not_accepts_new_connections From 4ce1e18452bddfc7bffccbe908460b4e8dc7deba Mon Sep 17 00:00:00 2001 From: Nate Berkopec Date: Tue, 28 Apr 2020 08:15:06 +0900 Subject: [PATCH 8/8] Update lib/puma/dsl.rb Co-Authored-By: Cristian Rivera --- lib/puma/dsl.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/puma/dsl.rb b/lib/puma/dsl.rb index 13ab877c51..41e03a1a7e 100644 --- a/lib/puma/dsl.rb +++ b/lib/puma/dsl.rb @@ -308,7 +308,7 @@ def debug # @example # rackup '/u/apps/lolcat/config.ru' def rackup(path) - @options[:rackup] = path.to_s unless @options[:rackup] + @options[:rackup] ||= path.to_s end def early_hints(answer=true)