From e9dc87914f5cb7dc95d564d2bce9c698ab5745e0 Mon Sep 17 00:00:00 2001 From: Jakob Skjerning Date: Fri, 1 Dec 2023 11:08:54 +0100 Subject: [PATCH 1/4] Use newest version of setup-ruby --- .github/workflows/ruby.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index a74c597..0bfafe3 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -34,10 +34,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Set up Ruby - # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, - # change this to (see https://github.com/ruby/setup-ruby#versioning): - # uses: ruby/setup-ruby@v1 - uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0 + uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true # runs 'bundle install' and caches installed gems automatically From d654e65989390d2ce8a58f3dc7ad1abb07cac098 Mon Sep 17 00:00:00 2001 From: Jakob Skjerning Date: Fri, 1 Dec 2023 11:01:42 +0100 Subject: [PATCH 2/4] Test just one version in the 6.x series 7.x is the only officially supported version of Rails, so let's focus on those versions. While we still support 6.x for now, we don't need to test on more than one version of it. --- .github/workflows/ruby.yml | 2 +- README.rdoc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 0bfafe3..96de591 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - rails-version: ['5.2.8.1', '6.0.3.7', '6.1.7.6', '7.0.8', '7.1.2', 'main'] + rails-version: ['5.2.8.1', '6.1.7.6', '7.0.8', '7.1.2', 'main'] ruby-version: ['2.7', '3.0', '3.1', '3.2'] exclude: - rails-version: '5.2.5' diff --git a/README.rdoc b/README.rdoc index c797579..89a6266 100644 --- a/README.rdoc +++ b/README.rdoc @@ -6,7 +6,7 @@ This gem hooks into the Rack middleware of Rails. This way all paths are downcas == Requirements -This gem is tested with 5.2.x, 6.0.x, 6.1.x., 7.x. It reportedly also works with Sinatra, although I do not use Sinatra myself. Sinatra test-cases will be most welcome. +This gem is tested with 5.2.x, 6.x, 7.x. It reportedly also works with Sinatra, although I do not use Sinatra myself. Sinatra test-cases will be most welcome. It has previously worked - and I presume still works - in Rails 5.0.x and 5.1.x. From b65e5d8e92290dcc9bd18b5080884de1a48f7289 Mon Sep 17 00:00:00 2001 From: Jakob Skjerning Date: Fri, 1 Dec 2023 11:03:58 +0100 Subject: [PATCH 3/4] Prepare for Ruby 3.3 --- .github/workflows/ruby.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 96de591..d0e5e5c 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -23,10 +23,10 @@ jobs: strategy: matrix: rails-version: ['5.2.8.1', '6.1.7.6', '7.0.8', '7.1.2', 'main'] - ruby-version: ['2.7', '3.0', '3.1', '3.2'] + ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3'] exclude: - - rails-version: '5.2.5' - ruby-version: '3.0' + - rails-version: '5.2.8.1' + ruby-version: '3.3' env: RAILS_VERSION: ${{ matrix.rails-version }} From 0a9ad944a75938ae4bf901e65a3b636fb923b197 Mon Sep 17 00:00:00 2001 From: Jakob Skjerning Date: Fri, 1 Dec 2023 11:05:11 +0100 Subject: [PATCH 4/4] Remove cruft This was never supposed to have been added --- test.rb | 103 -------------------------------------------------------- 1 file changed, 103 deletions(-) delete mode 100644 test.rb diff --git a/test.rb b/test.rb deleted file mode 100644 index 792f384..0000000 --- a/test.rb +++ /dev/null @@ -1,103 +0,0 @@ -# frozen_string_literal: true - -gem "activesupport" -# require 'active_support/all' -require "route_downcaser" -require "route_downcaser/downcase_route_middleware" -require "route_downcaser/original_downcase_route_middleware" - -require "benchmark" - -class FakeApp - def call(env) - end -end - -ITERATIONS = 1_000_000 - -app = FakeApp.new -original_downcaser = RouteDowncaser::OriginalDowncaseRouteMiddleware.new(app) -optimized_downcaser = RouteDowncaser::DowncaseRouteMiddleware.new(app) - -Benchmark.bmbm do |bm| - # bm.report("Original with small env") do - # ITERATIONS.times do - # env = { - # "PATH_INFO" => "/Here/Or/There", - # "REQUEST_URI" => "/Here/Or/There", - # "REQUEST_METHOD" => "GET", - # } - # original_downcaser.call(env) - # end - # end - bm.report("Original") do - ITERATIONS.times do - env = { - "PATH_INFO" => "/Here/Or/There", - "REQUEST_URI" => "/Here/Or/There", - "REQUEST_METHOD" => "GET", - "GATEWAY_INTERFACE" => "GATEWAY_INTERFACE", - "HTTP_ACCEPT" => "HTTP_ACCEPT", - "HTTP_ACCEPT_CHARSET" => "HTTP_ACCEPT_CHARSET", - "HTTP_ACCEPT_ENCODING" => "HTTP_ACCEPT_ENCODING", - "HTTP_ACCEPT_LANGUAGE" => "HTTP_ACCEPT_LANGUAGE", - "HTTP_CACHE_CONTROL" => "HTTP_CACHE_CONTROL", - "HTTP_CONNECTION" => "HTTP_CONNECTION", - "HTTP_COOKIE" => "HTTP_COOKIE", - "HTTP_HOST" => "HTTP_HOST", - "HTTP_KEEP_ALIVE" => "HTTP_KEEP_ALIVE", - "HTTP_REFERER" => "HTTP_REFERER", - "HTTP_USER_AGENT" => "HTTP_USER_AGENT", - "QUERY_STRING" => "QUERY_STRING", - "REMOTE_ADDR" => "REMOTE_ADDR", - "REMOTE_HOST" => "REMOTE_HOST", - "REMOTE_USER" => "REMOTE_USER", - "SERVER_NAME" => "SERVER_NAME", - "SERVER_PORT" => "SERVER_PORT", - "SERVER_PROTOCOL" => "SERVER_PROTOCOL", - "SERVER_SOFTWARE" => "SERVER_SOFTWARE" - } - original_downcaser.call(env) - end - end - # bm.report("Optimized with small env") do - # ITERATIONS.times do - # env = { - # "PATH_INFO" => "/Here/Or/There", - # "REQUEST_URI" => "/Here/Or/There", - # "REQUEST_METHOD" => "GET", - # } - # optimized_downcaser.call(env) - # end - # end - bm.report("Optimized") do - ITERATIONS.times do - env = { - "PATH_INFO" => "/Here/Or/There", - "REQUEST_URI" => "/Here/Or/There", - "REQUEST_METHOD" => "GET", - "GATEWAY_INTERFACE" => "GATEWAY_INTERFACE", - "HTTP_ACCEPT" => "HTTP_ACCEPT", - "HTTP_ACCEPT_CHARSET" => "HTTP_ACCEPT_CHARSET", - "HTTP_ACCEPT_ENCODING" => "HTTP_ACCEPT_ENCODING", - "HTTP_ACCEPT_LANGUAGE" => "HTTP_ACCEPT_LANGUAGE", - "HTTP_CACHE_CONTROL" => "HTTP_CACHE_CONTROL", - "HTTP_CONNECTION" => "HTTP_CONNECTION", - "HTTP_COOKIE" => "HTTP_COOKIE", - "HTTP_HOST" => "HTTP_HOST", - "HTTP_KEEP_ALIVE" => "HTTP_KEEP_ALIVE", - "HTTP_REFERER" => "HTTP_REFERER", - "HTTP_USER_AGENT" => "HTTP_USER_AGENT", - "QUERY_STRING" => "QUERY_STRING", - "REMOTE_ADDR" => "REMOTE_ADDR", - "REMOTE_HOST" => "REMOTE_HOST", - "REMOTE_USER" => "REMOTE_USER", - "SERVER_NAME" => "SERVER_NAME", - "SERVER_PORT" => "SERVER_PORT", - "SERVER_PROTOCOL" => "SERVER_PROTOCOL", - "SERVER_SOFTWARE" => "SERVER_SOFTWARE" - } - optimized_downcaser.call(env) - end - end -end