diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index a74c597..d0e5e5c 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -22,11 +22,11 @@ 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'] - ruby-version: ['2.7', '3.0', '3.1', '3.2'] + 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', '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 }} @@ -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 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. 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