From 337ad49fb32fa1af39b6ae1580e3c52df3d9aa50 Mon Sep 17 00:00:00 2001 From: Jakob Skjerning Date: Fri, 2 Jun 2023 10:47:37 +0200 Subject: [PATCH 1/8] Add GitHub Actions --- .github/workflows/ruby.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/ruby.yml diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 0000000..ba8e2f7 --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,38 @@ +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. +# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake +# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby + +name: Ruby + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +permissions: + contents: read + +jobs: + test: + + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: ['2.6', '2.7', '3.0'] + + 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 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Run tests + run: bundle exec rake From 45a371234163cab264194e6a37816a61ad9e7f8e Mon Sep 17 00:00:00 2001 From: Jakob Skjerning Date: Fri, 2 Jun 2023 10:49:51 +0200 Subject: [PATCH 2/8] Run the same commands as Travis --- .github/workflows/ruby.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index ba8e2f7..7aa764b 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -35,4 +35,6 @@ jobs: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Run tests - run: bundle exec rake + run: bundle exec rake build + - name: Lint + run: bundle exec standardrb From cf7448eb2cd97c549ca244c2e0302312b349d42a Mon Sep 17 00:00:00 2001 From: Jakob Skjerning Date: Fri, 2 Jun 2023 10:50:17 +0200 Subject: [PATCH 3/8] Test on the same Rubies as Travis did --- .github/workflows/ruby.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 7aa764b..c6a2a3a 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -22,7 +22,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['2.6', '2.7', '3.0'] + ruby-version: ['2.5', '2.6', '2.7', '3.0'] steps: - uses: actions/checkout@v3 From 55309fd2b371595b97f1037298faac99563c6c19 Mon Sep 17 00:00:00 2001 From: Jakob Skjerning Date: Fri, 2 Jun 2023 10:51:39 +0200 Subject: [PATCH 4/8] Run on the same Rails versions as Travis --- .github/workflows/ruby.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index c6a2a3a..7c31958 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -22,6 +22,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: + rails-version: ['5.2.5', '6.0.3.6', '6.1.3.1', 'main'] ruby-version: ['2.5', '2.6', '2.7', '3.0'] steps: @@ -32,6 +33,7 @@ jobs: # uses: ruby/setup-ruby@v1 uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0 with: + rails-version: ${{ matrix.rails-version }} ruby-version: ${{ matrix.ruby-version }} bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Run tests From cf50ecf749219fff7a267c2e1066a6da1ba1611c Mon Sep 17 00:00:00 2001 From: Jakob Skjerning Date: Fri, 2 Jun 2023 10:53:38 +0200 Subject: [PATCH 5/8] Fix standardrb offenses > standard: Use Ruby Standard Style (https://github.com/standardrb/standard) > Gemfile:11:9: Layout/CaseIndentation: Indent `when` as deep as `end`. > Gemfile:13:9: Layout/CaseIndentation: Indent `when` as deep as `end`. > route_downcaser.gemspec:18:80: Layout/LineContinuationSpacing: Use one space in front of backslash. > route_downcaser.gemspec:19:77: Layout/LineContinuationSpacing: Use one space in front of backslash. > route_downcaser.gemspec:23:3: Gemspec/DeprecatedAttributeAssignment: Do not set `test_files` in gemspec. > standard: Run `standardrb --fix` to fix up to 5 problems. --- Gemfile | 12 ++++++------ route_downcaser.gemspec | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index e79d56a..433ce3f 100644 --- a/Gemfile +++ b/Gemfile @@ -8,12 +8,12 @@ gemspec # Enable testing of multiple rails versions rails_version = ENV["RAILS_VERSION"] || "default" rails = case rails_version - when "main" - {github: "rails/rails", branch: "main"} - when "default" - ">= 6.1.0" - else - "~> #{rails_version}" +when "main" + {github: "rails/rails", branch: "main"} +when "default" + ">= 6.1.0" +else + "~> #{rails_version}" end gem "rails", rails ############################################### diff --git a/route_downcaser.gemspec b/route_downcaser.gemspec index ff9d6af..9d40577 100644 --- a/route_downcaser.gemspec +++ b/route_downcaser.gemspec @@ -15,12 +15,11 @@ Gem::Specification.new do |s| s.homepage = "https://github.com/carstengehling/route_downcaser" s.summary = "Makes routing in Rails case-insensitive" s.description = - "This gem hooks into the Rack middleware of Rails. This way all paths are "\ - "downcased before dispatching to Rails' routing mechanism. Querystring "\ + "This gem hooks into the Rack middleware of Rails. This way all paths are " \ + "downcased before dispatching to Rails' routing mechanism. Querystring " \ "parameters are not changed in any way." s.files = Dir["{lib}/**/*"] + ["MIT-LICENSE", "Rakefile", "README.rdoc"] - s.test_files = Dir["test/**/*"] s.add_runtime_dependency "activesupport", ">= 3.2" s.add_development_dependency "standard" end From 97787ab40c8cf4f7069b7aa0c39f94dbe9bd41c2 Mon Sep 17 00:00:00 2001 From: Jakob Skjerning Date: Fri, 2 Jun 2023 10:56:50 +0200 Subject: [PATCH 6/8] Expose Rails version in ENV --- .github/workflows/ruby.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 7c31958..ff69bea 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -25,6 +25,9 @@ jobs: rails-version: ['5.2.5', '6.0.3.6', '6.1.3.1', 'main'] ruby-version: ['2.5', '2.6', '2.7', '3.0'] + env: + RAILS_VERSION: ${{ matrix.rails-version }} + steps: - uses: actions/checkout@v3 - name: Set up Ruby @@ -33,7 +36,6 @@ jobs: # uses: ruby/setup-ruby@v1 uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0 with: - rails-version: ${{ matrix.rails-version }} ruby-version: ${{ matrix.ruby-version }} bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Run tests From 03a22b6bc675a38c7fe0b4f1f79b8043e6be917d Mon Sep 17 00:00:00 2001 From: Jakob Skjerning Date: Fri, 2 Jun 2023 11:15:36 +0200 Subject: [PATCH 7/8] Only run compatible combinations --- .github/workflows/ruby.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index ff69bea..d799415 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -24,6 +24,13 @@ jobs: matrix: rails-version: ['5.2.5', '6.0.3.6', '6.1.3.1', 'main'] ruby-version: ['2.5', '2.6', '2.7', '3.0'] + exclude: + - rails-version: 'main' + ruby-version: '2.5' + - rails-version: 'main' + ruby-version: '2.6' + - rails-version: '5.2.5' + ruby-version: '3.0' env: RAILS_VERSION: ${{ matrix.rails-version }} From c260260ce1720792db1887aaa7342639b1e6a8e9 Mon Sep 17 00:00:00 2001 From: Jakob Skjerning Date: Fri, 2 Jun 2023 11:23:37 +0200 Subject: [PATCH 8/8] Remove Travis references --- .travis.yml | 32 -------------------------------- README.rdoc | 2 -- 2 files changed, 34 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0743e78..0000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -language: ruby -rvm: - - 2.5.8 - - 2.6.6 - - 2.7.2 - - 3.0.0 - -env: - - "RAILS_VERSION=5.2.5" - - "RAILS_VERSION=6.0.3.6" - - "RAILS_VERSION=6.1.3.1" - - "RAILS_VERSION=main" - -matrix: - exclude: - - rvm: 3.0.0 - env: "RAILS_VERSION=5.2.5" - - rvm: 2.5.8 - env: "RAILS_VERSION=main" - - rvm: 2.6.6 - env: "RAILS_VERSION=main" - -addons: - code_climate: - repo_token: 9b174f785a3f1ad8986730da28c2756320f0413067e7e06bad278280f47743fd - -script: - - bundle exec rake build - - bundle exec standardrb - -after_success: - - bundle exec codeclimate-test-reporter diff --git a/README.rdoc b/README.rdoc index 076f864..9692cb8 100644 --- a/README.rdoc +++ b/README.rdoc @@ -1,7 +1,5 @@ = RouteDowncaser -{Build Status}[https://travis-ci.org/substancelab/route_downcaser] {}[https://codeclimate.com/github/substancelab/route_downcaser] - Makes routing in Rails case-insensitive (and other Rack-servers like Sinatra) This gem hooks into the Rack middleware of Rails. This way all paths are downcased before dispatching to Rails' routing mechanism. Querystring parameters and asset paths are not changed in any way.