Skip to content

Commit

Permalink
Test on and support multiple versions of Rack
Browse files Browse the repository at this point in the history
With this change, Rack::Session::Redic now supports and tests against
both Rack v2 and v3 transparently.
  • Loading branch information
evanleck committed Sep 25, 2023
1 parent a1c19b5 commit 72d742d
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 8 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ jobs:
ports:
- 6379:6379

name: Test (${{ matrix.ruby }} / ${{ matrix.os }})
strategy:
fail-fast: false
matrix:
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
os: [ubuntu-latest]
rack: [2, 3]

name: "Test Ruby: ${{ matrix.ruby }} Rack: ${{ matrix.rack }} OS: ${{ matrix.os }}"

env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/rack${{ matrix.rack }}.gemfile

runs-on: ${{ matrix.os }}
steps:
Expand Down
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@ Or install it yourself as:
gem install rack-redic
```

### Rack 3

With the release of Rack v3.0.0 Rack's `Session` module has been extracted into
its own gem. To use `Rack::Session::Redic` with Rack v3 be sure to add `gem
'rack-session'` to your `Gemfile` as well.

## Usage

Anywhere in your Rack application just add:
Expand Down
13 changes: 13 additions & 0 deletions gemfiles/rack2.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true
source 'https://rubygems.org'

gemspec(path: '../')

gem 'minitest', '~> 5'
gem 'rack', '~> 2'
gem 'rake', '~> 13'
gem 'rubocop', '~> 1'
gem 'rubocop-minitest'
gem 'rubocop-packaging'
gem 'rubocop-performance', '~> 1'
gem 'rubocop-rake'
13 changes: 13 additions & 0 deletions gemfiles/rack3.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# frozen_string_literal: true
source 'https://rubygems.org'

gemspec(path: '../')

gem 'minitest', '~> 5'
gem 'rack', '~> 3'
gem 'rake', '~> 13'
gem 'rubocop', '~> 1'
gem 'rubocop-minitest'
gem 'rubocop-packaging'
gem 'rubocop-performance', '~> 1'
gem 'rubocop-rake'
3 changes: 2 additions & 1 deletion rack-redic.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ Gem::Specification.new do |spec|
spec.files = Dir['lib/**/*', 'README.md', 'LICENSE.txt']
spec.required_ruby_version = '>= 2.5.0'

spec.add_runtime_dependency 'rack', '~> 2'
spec.add_runtime_dependency 'rack', '>= 2.0.0', '< 4'
spec.add_runtime_dependency 'rack-session'
spec.add_runtime_dependency 'redic', '~> 1'

spec.metadata['bug_tracker_uri'] = "#{ spec.homepage }/issues"
Expand Down

0 comments on commit 72d742d

Please sign in to comment.